Ventures of an ex indie game developer

Optimization and side scroller

Me and the kids started making a space side scroller á là Gradius in my game prototyping tool Trabant. I soon realized it wasn't possible to generate hundreds of objects and operate on them every frame. After quite a few hours hunkered down with some good old C++ optimization I'm more than a magnitude faster.

The top nine tests were run before optimizing, the bottom nine after. Most of the bottleneck was in the Trabant IDE-to-simulator API, which is string based. And frankly the C++ standard library isn't very fast at string and list operations. The bottleneck still remains in the string parsing of the API, which is sort of hilarious considering the collision detection and all the stuff the game engine is up to. I did find a couple of slow pieces of code here and there, most related to flagging and deleting objects in the physics engine (I'm using ODE for physics).

I used Very Sleepy CS for the performance analysis. It's basic, to the point, no bloat and just works - exactly the way I like it. As I've experienced in the past, it usually takes a couple of hours before you're able to use it efficiently to pinpoint the pain points, but from thereon it's smooth sailing.

I now realize I would be helped by C++11 rvalues and move constructors. So far I've mostly been doing some mix between C99 and C++03, but now the effects of such laziness is showing. Not only is my former expertise becoming extremely dated, but my code is also suffering. I need to take the bull by the horns. Or should I touch my balls to get hornsy?

Long story short, we are now able to produce a bunch of junk on screen.



I almost forgot: speed is still the most important feature. (Slow means epic fail.)

About the author

Mitt foto
Gothenburg, Sweden