[FIXED] Splitting chunk data
#1
I'll be splitting the chunk data into separate byte arrays for each of BlockType, BlockMeta, BlockLight and BlockSkyLight, to make it possible to implement dynamic chunk height. This means I'll be touching most chunk-data-related stuff, especially storage, generation and packetizing.

This message is only to inform other developers of the upcoming change and a plea that they refrain from changing stuff too much to avoid potential code conflicts Smile
Reply
Thanks given by:
#2
??? Why
Reply
Thanks given by:
#3
Because that needs to be done before you can have dynamic chunk height.
Reply
Thanks given by:
#4
Not really, but whatever
Reply
Thanks given by:
#5
Can you imagine indexing the array if you had dynamic chunk height AND a joined array?
m_BlockData[XZSliceSize * ChunkHeight + XZSliceNibbleSize * ChunkHeight + XZSliceNibbleSize * ChunkHeight + IndexToSkyLight]
There, finished. It's a bit cleaner now. And finally loaders and generators may pass heightmap of the new chunk, instad of having to recalculate it Smile
Reply
Thanks given by:
#6
I've had a hunch that the GetNibble() and SetNibble() functions might be a bit faster on unsigned chars. So I tried it out, turns out there's no differrence at all. Weird, considering that the signed char version has a few more assembly instructions in the code, converting between signed and unsigned. One would expect that on millions of calls that would have matterred. Seems like my knowledge of the x86 processors is being deprecated by the new models.

Anyway, we can now choose between the signed and unsigned variant simply by defining the BLOCKTYPE typedef in ChunkDef.h
Reply
Thanks given by:
#7
(03-15-2012, 06:21 AM)xoft Wrote: Can you imagine indexing the array if you had dynamic chunk height AND a joined array?
m_BlockData[XZSliceSize * ChunkHeight + XZSliceNibbleSize * ChunkHeight + XZSliceNibbleSize * ChunkHeight + IndexToSkyLight]

Actually we were already using offsetted pointers, so there's no need for IndexToSkyLight
Reply
Thanks given by:
#8
But the offsetted pointers would still have to be calculated dynamically upon each call.
And extending the chunk's height, when needed, would be painful Wink
Reply
Thanks given by:
#9
(03-15-2012, 07:55 AM)xoft Wrote: But the offsetted pointers would still have to be calculated dynamically upon each call.
And extending the chunk's height, when needed, would be painful Wink

Once every time the height changed :O

???

Right now you cannot be sure that the metadata comes right after the chunk data in memory
Reply
Thanks given by:
#10
Yes, you cannot, and the point is, you should not have to worry about that. You get your pointers to the specified data, that's all. If you want to merge it into a single array or not, that's up to you.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)