Skip to main content
gamedev.net
🔒 Locked

particle system

Started by supagu Mar 20, 2003 at 2:29 AM 0 replies 250+ views
Original Post
supagu
supagu
just about to inplement some form of particle system, and was wondering, i have aparticle system class, which has a list of meshes/sprites, should each particle update it self, or should this be taken care of by the particle system class, i am currently thinking the only thing the particle system should handle is destroying and spawning particles, let each particle determine its own way around any ideas on the topic?
jhavna
jhavna
Personally, I would structure it like this:

Each particle as an individual object, hence with it''s own behaviour etc.
The system is then an object that controls a collection of particles.

So to answer your question, the behaviour of particles would be determined by each individual particle [its render method]. That way, you can have particles with different life spans and such to each other. I would say basic attributes for particles are:
- Lifespan
- Colour
- Weight (not always necessary)
- Direction (velocity can be stored here too)
- Position

The system should be responsible for:

Spawning the particles at a given point and giving the particle a direction and speed (which is stored in the particle itself) and ensuring there are always the right number of particles onscreen [hence the system would contain an array of particles or pointers to particles]. so when you want to relocate the place where the partciles spwan, you move the system...
so attributes:
- position
- direction (one direction, out in all directions - so could call it expulsion type)
- max number of particles
- explusion speed
- max number of particles

and also a method for rendering all relevant particles (or calling each particles render function)

hope that helps. I am sure there''s more to contribute though..

-----------------------
"Without a sense of humour we couldn''t react to a lot of things"
-----------------------"Without a sense of humour we couldn't react to a lot of things"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.