Scene-graph. Shaders.

2024-07-08 / Mark Sowden

← 2024-06-23

Since the last update, I introduced versioning for the binary version of my serialisation format. There are some improvements I'm looking to introduce to how strings are handled, so there aren't so many duplicates. It's not really urgent, but the changes I've made to the format should make it more extendable going forward.

It's probably not worth it much for saving on storage because the files will get compressed anyway when they're packaged, but it should result in a format that takes less time to load. Not that I've reached a point where that's a problem, but as some datasets get more complex, it'll probably become more important.

I do tend to optimise a lot sooner than I should...

And on that note, a relatively larger change has been to how the scene-graph API generally works. Previously, anything considered a 'node' in the tree would have a header with a tag, type and pointer to the associated 'class', and then another pointer to the related node as well. This was all incorporated with some rather over-the-top validation.

This resulted in an API that was a bit more verbose to use than my liking too. You would need to fetch the associated node for an object (i.e. a camera) and then do your scene operations, such as attaching it to something else, with that.

I've taken a deep breath and gone with a more simplistic but easier route now, instead...

typedef struct ApeWorldNode
	ApeWorldNodeMagic magic;


typedef struct ApeCamera
	// This should always come first!
	ApeWorldNode base;


There's some very basic validation that just confirms it starts with the tag we're expecting to be sure nobody is being an idiot (specifically me).

Why don't I just use C++? In hindsight, yeah. But at this point, it just doesn't really seem very practical without rewriting everything. Maybe it's something I'll look at for a future generation of the engine.

I've also migrated the rope physics implementation I originally did for Doom 3 over, so the game I'm working on will be able to use them. They're planned to represent the connections between things in the game I'm working on.

The day before, I started experimenting with a new "character" shader to try and get the specific look I'm after. Still some fiddling to go, but I'm pretty happy with the results so far. Unlike the default shader provided by the engine, much of this is all per-vertex instead (well, for the most part).

I'd originally implemented sphere maps for reflections, as in my head I thought they'd look pretty good. Nope.

There were also some last bits of polish for networking, such as fixing a crash when disconnecting from a server! So that was kinda nice.

← 2024-06-23