Archived

This topic is now archived and is closed to further replies.

timmay314

Particle systems

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites