Skip to main content
gamedev.net
🔒 Locked

Particle systems

Started by timmay314 4 replies 950+ views
Original Post
timmay314
timmay314
I have a working particle system using a particle class named CParticle and one that handles most of the stuff called. I''m going to have several different types of particles, so I need to know if I should make a different particle and particle system class for each or if I can reuse them somehow. How is this generally done?
evolutional
evolutional
I wrote a general particle system class that loaded various settings (start/end scale/velocity/acceleration/colour/etc) and worked like that.

At present, I have implemented each system with specific classes as I''m giving the particle systems different behaviours.

When I get my scripting system working, I''ll have the particle system control the particles from a default class and use the scripting to control colour/motion etc.
vcGamer
vcGamer
Although there are different ways, it''s always best to keep your code as clean as possible, so try to have only one generic class which supports almost all your needs, including winds, acceleratin, collision, color, ... Of course you can add some other features later. Just be careful, when you don''t need a special feature, don''t take use of it, in this way you can build up later on your last codes.


game/software developer/algorithm designer
Visit galaxyroad.com which soon will have english contents too
timmay314
timmay314
Would you then recommend having CParticle have a member variable thats an enum or something that says what type it is, then do a switch statement in the update method to do the appropriate update?
Raloth
Raloth
quote:
Original post by timmay314
Would you then recommend having CParticle have a member variable thats an enum or something that says what type it is, then do a switch statement in the update method to do the appropriate update?
use polymorphism
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
timmay314
timmay314
I''d heard that polymorphism was too slow for particle systems with lots of particles, but I suppose that the same performance hit would happen this way...

Topic Locked

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

Sign in to reply to this topic.