Computer Science Canada Particle Engine problems |
Author: | Clayton [ Mon Sep 18, 2006 6:43 pm ] | ||
Post subject: | Particle Engine problems | ||
I'm making a particle spray, but I'm having problems with the appearance of the particles, whenever a larger amount is on the screen, the "production" of more particles is basically non-existant for a short period of time, heres my code, if anyone can figure out whats going on it would be appreciated
|
Author: | Ultrahex [ Mon Sep 18, 2006 7:50 pm ] | ||
Post subject: | |||
Here As Requested Freakman, The Way I Decided to fix.
|
Author: | ericfourfour [ Tue Sep 19, 2006 9:39 pm ] | ||||||
Post subject: | |||||||
I'd recommend making a particle engine following this tutorial (credits go to Martin for finding it). I use it every time. Anyway, Ultrahex fixed it so I thought I'd give you a few pointers (no pun intended). The particles should not be 'freed' until you are absolutely done with them or you need more memory. The particles should have a flag saying there dead instead. This lowers the amount of times you allocate/deallocate memory already. Next, when you want to create another particle, find a particle with the dead flag. Then all you have to do is reinitialize it. Once again, you have lowered the amount of times you allocate/deallocate memory. I have a question for Ultrahex. Why did you cls then draw a black box over the screen?
Incase you didn't already know, you can set the background colour.
What this really does, is it sets the colour that will show up behind text. It doesn't really set the screen background. What cls does, is it outputs a full screen of blank text. Kind of like this:
What happens when you output a full screen of blank text with black as the text background? The whole screen goes black. |