I've been developing mainly on my desktop, but I need it to run at or near 60 FPS on my laptop. I had some framerate issues earlier because I was using multiple randomized floor tiles, so I replaced them with single large tiles custom for for each room. This brought my framerate back to 60 easily.
Unfortunately now that I have a near-complete level, I have a much bigger problem. Key to the game's appeal is the organically destructible elements (well, as organic as somebody who has been coding in their spare time since September can make them), mainly glass and drywall. The amount of these things present in the level I have built is crippling my laptop once enough chaos has transpired. It's only in my last big crunch of work that this has become a problem. Previously it could handle every single object in the building, and the framerate would only drop when I had the camera pulled all the way out.
I've uploaded a video as a demonstration. It was captured using my desktop, but FRAPS lowered the framerate down to almost the same that my laptop gets. This does not include the camera scaling that is present in normal gameplay to accommodate both players, which further impacts the framerate when too many fragments are lying about.
Here is what is happening when a destructible object is destroyed: debris instances are being created (in one case 60 instances at once), they scatter around and bounce off walls, and then when each one reaches a speed of 0 it replaces itself with an object that has no events. The bouncing doesn't cause any problems, but simply rendering the "dead" objects is crippling me. I have a couple little places where I can reduce object counts (I can group together some of the walls into new custom sprites, same as with the tiles) but I think that I need a systematic solution to make this work. I doubt that this game will be nearly as fun at a sub-60 framerate, or with a reduced number of destructible elements. Does anybody have any ideas? Maybe a way to capture all of the resting objects and render them as a single sprite?
Help me GMC, your my only hope!
Edited by nintendoeats, 04 March 2012 - 04:09 AM.