Category Archives: Games

NES Emulation With a Real NES Pad

A Delorean Would be Nice

I’ve always had this feeling that I was born 10 years too late; getting to develop games on the PS2 but totally missing the glory days of other consoles. The NES was always my favourite and it’s pretty awesome to know that there’s a homebrew scene even now. You can even get tutorials! Seems like 10 years doesn’t matter after all. The first thing I wanted to get set up was a real NES pad interfacing with a NES emulator. Turns out there’s a way to do that…

A Working NES Controller over USB

Continue reading NES Emulation With a Real NES Pad

When the 0x01000000p Dropped

So, I got bit

More accurately, 32 of them and it sucked. It made me realise that my understanding of memory was fundamentally flawed and I hadn’t even noticed. I’ve fixed a lot of low level memory tramples and alignment issues in a lot of games too. Felt like I should know better, but then other people were surprised by the same behaviour.

Specifically, I’ve been bitten by cross word boundary memory access on little-endian architectures. In game terms, I was probably reading some awesome Fire-Breathing animation for a dapper dragon from a buffer.


Continue reading When the 0x01000000p Dropped

Picking a World Size


Most games require physics. Every character you push around the world, every bullet you fire, every mutant beast you follow probably has some physical simulation underpinning it. Now let’s say that your game is big, like, incredibly big. Deserts, mountains, huge continents… that sort of big. How are you going to make sure that the laser toting dinosaurs at the edge of the world work as well as those at the very center? Maybe you’ve never even considered that they wouldn’t Just Work. it’s all down to how machines represent both large and small values (such as distance), and most resources want you to know all about that representation before letting you know the cool tricks. This post won’t delve too deeply and will teach you one really useful trick to keep safe for a rainy day.

Continue reading Picking a World Size

How Alias Templates saved my sanity

Before we begin…

All the source I’ll refer to is up on GitHub, play around with it, break it and let me know what you think. I’m doing this to get better at what I do, and hopefully help people at the same time.

Are you sitting comfortably?

C++ supports two powerful abstractions, Object Orientation and Generic Programming. Ask any battle-hardened games industry veterans about the two and you’re likely to see an eye twitch with the latter. It’s not that Generic Programming is particularly hard but the errors you get out of the language can be particularly verbose without even getting to the private hell of errors relating solely to that usage…

But there’s hope. Our language is evolving. C++ 11 brought some incredible new functionality… Type Alias and Alias Templates and if we’d had them earlier the work I did on a title would have taken much less time and been infinitely more readable.

Continue reading How Alias Templates saved my sanity