Game Engine Lessons Learned – Put Performance First

After a 2 year stint of developing a fully featured game engine, I can now look back on what went right and what I should have done differently. One of my regrets is putting design over performance.

It’s very tempting (and lets face it, easier) to write code to satisfy your natural logical thinking – I don’t know if there’s a term for it, but I’ll refer to it as “direct programming”.

Object-Oriented design could in (many) cases be considered direct programming. It’s parallel to the way we see things – as objects. We design systems the way they are because it “makes sense” to us conceptually.

What you end up with is a pretty set of logical classes and functions that directly address your problems, and while you’re proud of your amazingly flexible and extensible architecture, things start to drag – and that’s when you begin to optimise.

Too late!

Do yourself a favour and think about cache coherence, memory management and parallelism before anything else. I’m not saying that you shouldn’t design a pretty architecture (you should), but if you design and write code without hardware in mind you’ll regret it later.

Leave a Reply

Your email address will not be published. Required fields are marked *