It seems like a huge issue when creating mods is everything must be packed into a fixed width, resulting in all sorts of weird compromises. I keep wanting to add metadata to nodes, but I am worried about the impact of doing so because I don't know how the engine stores and accesses additional data.
My instinct tells me the engine probably tries to isolate anything rendering-related so it can pump it out as quickly as possible, which is why nodes are limited to ID, light, and model/rotation data. I assume there is a parallel array of pointers to metadata, with a flag in the 'main' array value to signal its existence at a given coordinate..?
I love the elegance of UTF-8 character encoding: https://en.wikipedia.org/wiki/UTF-8#Encoding
Essentially, the first (most significant) bit of a byte communicates its relation to the following byte. If it is 0, the remaining 7 bits are the whole definition of the character. If it is 1, the next byte is part of the description.
As a sacrifice to help with locating the start of a character from any point in a stream of bytes, every byte which isn't the start of a character begins with 10, allowing the remaining 6 bits to store data. Thus, a 2-byte character automatically must begin with 110, but then the following byte can store 6 additional bits of data:
Code: Select all
Capacity Bits
128 0xxxxxxx
2048 110xxxxx 10xxxxxx
65536 1110xxxx 10xxxxxx 10xxxxxx
2097152 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
Any insight on this would be greatly appreciated!