Intention Is Good, Profiling Is Better
Today I've finished the first version of Nordenfelt's editor. After testing it thoroughly I tried to build a short but complete level in it. Everything worked fine except the frame rate. Sometimes it dropped without any visible reason. I had some issues regarding frame rate lately. The tile render engine had too much overhead which was easy to fix. So I tipped again on a rendering bottleneck. I added some profiling hooks in the code and played the first level. The resulting CPU profile was surprising. The rendering wasn't the (main) reason for the frame rate drops:
The horizontal purple line (MAX_PER_FRAME) in the diagram marks 1/60 of a second. All other lines stacked must not exceed this threshold. Otherwise a frame rate drop occurs. The line named MainLoop_DrawScreen has some peaks over the threshold which was expected. But look at line MainLoop_ScreenUpdate. These peaks are really brutal. Don't ask me where they come from. But I know the solution:
It's time again for Captain Optimize!
After wiping out these flaws I'm going to show you a video of the editor in action. This should be the point where iterative game design takes off. I'm planning to publish incremental versions of the game at www.nordenfelt-thegame.com. I can't say when this will start but it has to start soon!
Cheers,
Thomas

