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

emugod
Member
 
Posts: 33
Joined: Tue Aug 13, 2013 19:49

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

by emugod » Sun Jul 20, 2014 01:04

Is there any reason for blocks to be 16^3 nodes, as opposed to any arbitrary size?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

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

by rubenwardy » Sun Jul 20, 2014 11:23

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.
 


Return to Minetest Engine

Who is online

Users browsing this forum: No registered users and 16 guests

cron