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
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