Why 16-node blocks? #define MAP_BLOCKSIZE from constants.h

For people working on the C++ code.
Post Reply
User avatar
Posts: 33
Joined: Tue Aug 13, 2013 19:49

Why 16-node blocks? #define MAP_BLOCKSIZE from constants.h

by emugod » Post

Is there any reason for blocks to be 16^3 nodes, as opposed to any arbitrary size?

Code: Select all

// Dimension of a MapBlock
#define MAP_BLOCKSIZE 16
// This makes mesh updates too slow, as many meshes are updated during
// the main loop (related to TempMods and day/night)
//#define MAP_BLOCKSIZE 32
I've toyed with this just the tiniest bit, changing it to 10, and seen no negative results (actually confirming it was now loading/drawing blocks of 10^3 was a bit of doing, is there any easy way to get a block highlight?). A ton more testing to do, tons of questions like;
Would trying to load a map generated with different block size be any problem?
EDIT- Answer: Yes, it fails to load with an 'invalid block data' message.
Is there some innate desirability of sizes such as 8/16/32/etc. (powers of eight or two?), or for a particular specific size, or an absolute maximum size, due to the size of variables used in other parts of the code?
Is smaller always better performance, as larger would seem to be always worse?
Last edited by emugod on Sun Jul 20, 2014 21:28, edited 1 time in total.

User avatar
Posts: 6271
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom

Re: Why 16-node blocks? #define MAP_BLOCKSIZE from constants

by rubenwardy » Post

The map in Minetest is 2^15 from the centre (although map gen stops at 31000). I guess 16 is 2^4, so it fits inside a map of 2^15 without needing half blocks at the edges.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest