I wanted to start the discussion about how we should go about implementing a particle system for amethyst. I have been thinking about starting this project but I wanted to talk to the community about some of the possible methods of implementing the system. These are some of the features I want to support (eventually):
- Customizable Rendering( Sprites/Meshes, Tints, Size)
- Customizable Standard Physics ( Position, Velocity, Forces/Aceleration, Rotation, Angular Velocity)
- Customizable Particle Properties( Emission rate, lifetime, emission position ( point, line, area),etc)
- Changing Parameters based on other Parameters ( Size shrinks over time, Tint based of velocity, Sprite index based on angular Rotation)
- Modifiers of the Parameters ( Random between constants, Curves,etc)
- Emission space (Local or World)
- Shaders ( lightning, noise textures, custom)
- Looping and One shot modes
- Pre-warming and off screen pausing
- Max particle count / Memory usage
I am looking to get input on any features that I am missing here this is mostly based on unities features.
In order to achieve this I will suggest a few different implementations that could achieve this.
Emitters create new entities in the primary world with effects handled by systems:
Pros: The particles are entities and can interacted with everything else in the world super easily
Cons: can lead to major data fragmentation and could be very inefficient
Emitters contain a collection of all the particles the maintain with fixed functions to handle effects:
Pros: fairly efficient and compact
Cons: Fairly rigid in the functionality ( Some of the changing particle effects could be impossible)
Emitters emit into a shared sub_world with effects handled by systems:
Pros: A lot of customization options for particles as systems can be added to the entire system, tags could also be used to differentiate between types
Cons: A different world from the main would cause issue if you needed entities to interact with world objects( particles avoiding player,etc)
Emitters contain individual subs worlds with effects handled by systems:
Pros: A lot of customization options for particles as systems can be added by the end user on a per emitter basis
Cons: Individual sub-worlds could be memory intensive and systems would need to be run on each world causing some efficiency loss. Separate world would cause even more issues with interaction.
Please let me know if there are any other implementations I am missing.
Personally I am leaning towards a single sub world as I think it’s the best trade off between functionality and efficiency.
Rendering could be handled by a customizable render pass similar to Base_3d.
Please let me know your thoughts on this and if this is even the place to have this discussion ( discord seemed to informal and RFC seemed like over kill )
Thank you for you time.