Animated Particles

Posted By: jumpman

Animated Particles - 05/02/17 19:51

How do I make animated particles? I only know how to make static particles, and change them via my.bitmap (old A6).

Is there a way to make animated particles in A8? Also with roll rotation?
Posted By: alibaba

Re: Animated Particles - 05/02/17 20:22

Well I use sprite particles for that. There should be more information ins particles.c and the manual
Posted By: jumpman

Re: Animated Particles - 05/02/17 20:29

thank you friend!!!!!
Posted By: jumpman

Re: Animated Particles - 05/02/17 20:30

"Every emulated particle adds a function to the scheduler that runs during its lifespan."

Is this the same as having multiple entities each having a while() loop?
Posted By: Reconnoiter

Re: Animated Particles - 05/03/17 10:06

Originally Posted By: jumpman
"Every emulated particle adds a function to the scheduler that runs during its lifespan."

Is this the same as having multiple entities each having a while() loop?
, hi, might be cause of "Adjust max_entities and nexus if necessary. ". Check if the amount of functions raises in de f11 / diag window.
Posted By: alibaba

Re: Animated Particles - 05/03/17 11:07

Well kind of... as far as I know they are rendered faster than normal entities.
Posted By: Ezzett

Re: Animated Particles - 05/03/17 13:35

I don't think that "particle sprites" are rendered much faster than non-particle sprites. Maybe if you use instancing, because you have the pro edition.
Posted By: Kartoffel

Re: Animated Particles - 05/03/17 14:45

afaik, using particles is faster than using sprites but I'm not sure if they support animations. also, regarding your while-question, it's very unlikely that it's implemented that way - it's most likely using a static list (using 'max_particles' as size), iterates through them and calls every particle's event function.
Posted By: jumpman

Re: Animated Particles - 05/03/17 15:32

Hi friends!

Using the emulated particles, it does increase the entity count! If I shot out too many particles at once, or made them last too long while I was continually making more, I would get an "Adjust max_entities and nexus" warning

However, I was able to make the particles 3d models, and even animate each of them, like they were regular entities! I was able to rotate their pan and tilt as well. So in this case, Im sure these run way slower than regular particles, however the amount of control you gain is where its advantageous.
Posted By: Reconnoiter

Re: Animated Particles - 05/03/17 20:18

Originally Posted By: jumpman
Using the emulated particles, it does increase the entity count! If I shot out too many particles at once, or made them last too long while I was continually making more, I would get an "Adjust max_entities and nexus" warning
, it obviously increases entity count (otherwise the holy manual would be lying wink ), but as Kartoffel mentions it probably uses static list and not a while for each sprite particle (which saves some speed). You double check it in the f11 / diag window under functions.
Posted By: jumpman

Re: Animated Particles - 05/03/17 21:53

The emulated particles do increase the count of functions running!
Posted By: 3run

Re: Animated Particles - 05/04/17 10:04

Hey, jumpman

Look into 'particles.c' in game studio root folder. You can see that each particle has it's own while loop (p_run_sprite). But I guess you could make your own particles with sprites and handle all of them in one loop.

Greets!

Edit:
Originally Posted By: Reconnoiter
it probably uses static list and not a while for each sprite particle
Nothing build-in works that way tongue
Code:
// internal sprite lifetime and movement function
function p_run_sprite(ENTITY* p)
{
   while (p._LIFESPAN > 0) 
   {
      vec_fill(p.scale_x,0.1*p._SIZE);
      wait(1);

	   if(is(p,_MOVE)) 
	   {
		   VECTOR speed;
		   vec_set(speed,p._VEL_X);
		   vec_scale(speed,time_step);
		   p._VEL_Z -= p._GRAVITY * time_step;
		   vec_add(p.x,speed);  
		}
	   
	   p._LIFESPAN -= time_step;
   }
   ent_remove(p); 
}

Posted By: Ezzett

Re: Animated Particles - 05/04/17 12:27

These emulated particles are using ent_createlocal which is identical to ent_create (except when your are creating a game with online functionalities). Each emulated particle is an entity like every other entity.
Posted By: Reconnoiter

Re: Animated Particles - 05/04/17 12:57

How about using standard particles and change the p.bmap in the p.event function? You can use skill_a...skill_z as timer conditions or whatever. Might be worth a try.
Posted By: jumpman

Re: Animated Particles - 05/04/17 23:01

Thanks! I can do that, though I wouldnt be able to rotate the sprite, which is probably the main reason why I looked into the emulated particles.
Posted By: Reconnoiter

Re: Animated Particles - 05/05/17 10:27

Ah okay. You could somewhat simulate the rotation by using several rotated versions of a bmap for particles but I dont know if that is worth the effort. The fps gain might be minimal anyway in the big picture.
© 2024 lite-C Forums