I’ve run into a “performance” related problem, but I believe it’s more of a technique issue than anything else. My game programming experience is limited to non-existant so I have a question relating to some general methodology in resource management.
Here is the scenario:
I want to have a “blast” effect triggered whenever a projectile comes into contact with a surface. I have this effect working, and I’ve tried both a ParticleSystem and a Quad with a texture. Both have caused a hiccup in fps. I think it is related to the fact that, in an effort to remain object oriented, I have created a Blast class that creates its own texture states, particle manager, alpha states, etc. I think the slowdown is because of this somewhat large overhead for each blast effect.
My question is this: how do you guys manage a somewhat complex, but frequent effects like this?
These are my ideas:
- I have tried to create a ResourcePool class that will hold the states, textures, and sounds that will be used over and over again so that the only thing that needs to be created is the quad/system (I can apply these “global” states to the object). This didn’t seem to help much, but there is some more work I can do before I give up on this.
- Have some type of array of pre-set blasts that are either active or not. A rolling index would keep track of which blast to activate. For a blast, just update the location at that index and activate. This limits the number of on-screen blasts to the size of my array. I don’t really like this idea, but it seems like it might be fast.
Do you guys have any others? Am I missing an easier way?
Thanks in advance.