Well.
...
Well.
Excuse me while I continuously beat my head on my desk for being completly stupid.
Creating Bullets
i'm hardly any authority on this matter, but i've been advised that new/delete is kind of slow, and that allocating/deallocating memory on the fly as each bullet is fired/destroyed might not be the most efficient way to do it performancewise.
personally i handle it like the particles in my particle system, i initialize a rather big buffer with bullets, that are either live==true or live==false. each frame i loop the buffer until currentbulletnum is reached and blit all that are (live). when i need to add a new bullet the buffer is searched until an instance with live==false is found. (which is initialized and live=true, obviously.)
not sure whether this is a good solution.
i suppose it depends on the situation, allocating memory on the fly for each bullet might not be a problem with muzzleloaders, but might get tricky when dealing with MG42's or GAU-8's.
edit: stupid typo
[edited by - CheeseWeaver on August 17, 2003 1:17:27 PM]
personally i handle it like the particles in my particle system, i initialize a rather big buffer with bullets, that are either live==true or live==false. each frame i loop the buffer until currentbulletnum is reached and blit all that are (live). when i need to add a new bullet the buffer is searched until an instance with live==false is found. (which is initialized and live=true, obviously.)
not sure whether this is a good solution.
i suppose it depends on the situation, allocating memory on the fly for each bullet might not be a problem with muzzleloaders, but might get tricky when dealing with MG42's or GAU-8's.
edit: stupid typo
[edited by - CheeseWeaver on August 17, 2003 1:17:27 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement