Strings are often used as identifiers in games: object names, sound effect names, particle type names, etc. They’re a bit like enums with the advantage of allowing your game to be data-driven: you don’t necessarily need to recompile your program to accept new values.
But strings are no fun: storing them efficiently is a headache, they’re bigger and they’re slower than enums.
Fortunately there’s an alternative: string hashes. We like them a lot at Pastagames, and here are our humble solutions to the practical problems that come with them.
I attended Mike Acton’s master class during last year’s Game Connection in Paris.
Unsurprisingly it was about data-oriented design, but it was a workshop, a practical exercise, and it showed us (or at least me)
a new facet of the concept, as well as a few interesting techniques.
I feel like I’ve been saying this a lot lately ‒ at least once per intern we take at Pastagames ‒ so I guess it’s time I write it down.
There’s nothing new here, this has been said a hundred times over on the Internet,
but since a lot of people are still not aware of it, here is my contribution.