printf-based TOSTR on the stack

As I might have written before I like printf-style string-formating. It’s imho the most convenient way to format strings and it can be really powerful if needed. However something that can be a bit tedious is output:ing “composite” values such as a vec3 or quaternion as there will be quite a bunch of repetition.

printf("{ %.2f, %.2f, %.2f }", vec.x, vec.x, vec.z);

Doing this for multiple values really get verbose and its easy to make simple copy-paste-errors ( see above! ).

Read More

A story about an unexpected ABI break

This is the story of an unexpected ABI break that I thought would be worth documenting.

At Avalanche we use a small class wrapping 32bit hashes called CHashString, it is basically just a wrapper around uint32_t and one should be able to treat it as a uint32_t in code except for operations that do not make sense on a hash-value.

Why would you want a class like this you might ask, well we use it for adding a const char* c_str()-function that can be used in logging and also we use it to add custom natvis-support in visual studio so that you can just hover a CHashString and have a lookup of the hash-value performed.

Read More

Builtin resources and the resource-system

I have written, in passing, about the resource-system and VFS ( Virtual File System ) I use in my own game-engine. This time it will however not be “in passing” but will dig down a bit deeper into one “feature” in it that I find kind of neat. I’m sure it has been done before but I have not seen it myself somewhere else. I’ll be writing about how I handle builtin resources in the engine.

Read More