New Version! System sleep💤, new part_type functions and more!


Hey there! here I come with a brand new update.

System Updates:

  • Particle limits 🚫: Now you can set system caps to the amount of particles you have by simple changing the threshold variable of your system. This will work adaptively, so if you surpass the amount of particles, all related emitters will adjust their emitted particles accordingly. This is done through a timer and you can adapt the frequency of it in the options.
    There is also a per-system and global particle_factor that adjust the particle amounts percentually (the variable in systems is called "factor" and it is what gets modified with the threshold mechanic).
  • Sleep  ðŸ’¤: Systems can now be make_asleep and make_awake. What does that mean? Well, it will delete the particle_system index, but it will keep all the references and properties set in Pulse. That way, you can shut down a system when its not in use, improving performance, without losing the config or causing errors due to missing references. You can change the configuration with the variables wake_on_emit and sleep_when_empty. Wake on emit will re-assign a system index and awake the system whenever you emit particles in it. Sleep when empty will make it fall asleep, but only when there is a threshold active.
  • Super-Sampling💠 : This is still being tested, but here it goes: what if you wanted to slow-mo particles? You would have 2 options, either emit them slower, or super sample them. Super sampling means that the particle system is updated twice (or more) every step, and then switched to being sampled once every step. This will deactivate the automatic update, for hopefully obvious reasons. You can set it with set_super_sampling(_active, _samples) and update it with update_system(_resample=1). If you do try it out, let me know how it goes.
    There is, of course, a processing cost to this, but, by my tests, you should be ok unless you super sample like a 100 systems 10 times each. Which you shouldn't. Just don't.

Emitter Updates:

  • Local Forces 🌪: You can now add local forces to your emitters. Local forces are defined in the context of whatever object you are creating your emitter with new pulse_force(_x,_y,_direction,_type = PULSE_FORCE.DIRECTION,_weight = 1, _force = 1) and they come in two flavours: Directional and Radial. You can set ranges to these types, which means how much will they influence particles that are spawned into their range. Notice that they only affect particles' starting properties. It's just how particles work in GM. By default, their ranges are infinite. Forces get saved into an array within the emitter and forces can be added to it by add_local_force(_force) or remove_local_force(_force).
  • Displacement and color maps more POWERFUL 💪: Now they both can be scaled and offset, requiring no further processing of the buffer or anything like that. They are also their own struct now, which means all the property setters have moved from the emitter to the particular map. E.g. : emitter.displacement_map.set_offset(x,y).set_uv_scale(u,v)
    I got more plans for these 2 in the future, but that's it for now.

Particle Updates:

  • New functions incorporated: GM's new particle functions are incorporated, and they are part_type_size_x and y  and part_type_subimage.
    I've incorporated these into the previously existing functions set_size and set_sprite. set_sprite now has an extra argument for the sub image, and set_size takes arrays as arguments, so you can write set_size(1,3) for the regular version or set_size( [.2,1] , [.5,3] ) for the x/y version. Or you can do set_size( 1 , [.5,3] ), or even set_size( 1 , 3,[0,.02] ) which will increase size but only for the y axis.
  • Scale time and space ? âš›: Yes. SCALE THEM. Unrelated to either the special or general theory of relativity, this set of functions will help you make a particle do the same movement but faster (or slower) or do the same movement but in a smaller or bigger scale (with or without changing their sprite's size).
  • Set size... but in pixels! 🎯:  This one removes a bit of the guesswork that is sometimes related to particles. You can now replace your sprite without worrying about the particle ending up a different size.

And.. i think that's it? There might be more, but I forgot!

Anyway, if you are interested in tutorials to make particle effects, please, do let me know!
I've been thinking of doing some for snow and fire, and then maybe any suggestions if there are any.

Files

pulse_0_6_0.yymps 33 kB
Sep 10, 2023

Get Pulse - Particle magic for GM

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.