Basic data structures
IRC logs on this subject
For the log dating 2011-11-07, the subject discussion starts at the end.
A node in Minetest is the equivalent of a block in Minecraft. They are the cubes that make up the world.
In code, a node (represented by the class MapNode) contains only a small amount of data that can be transferred easily between the client and the server. This data includes what type of node it is, eg. Dirt node or Sand node, and some other data for lighting and miscellaneous parameters.
Nodes don't have any interactive functionality, this is done by the client and the client knows what to do depending on what type of node it is.
Special nodes are ignore and air. They can not be overridden.
Where map is not generated, there's ignore. minetest.get_node gives ignore also if the map is not loaded, so to get the node in unloaded chunks you can use vmanip.
air is set when a node is removed, for the player it's nothing.
A block (MapBlock) in Minetest, is a collection of 16x16x16 nodes (described above), and they are the pieces that together make the world/map.
In code, the block (represented by the class MapBlock) contains one mesh (only client-side) for all 16x16x16 nodes. A mesh is the geometry of an object, in this case the block. A mesh contains a collection of materials aka. textures, which is how each node is represented visually.
The map block is saved like this:
// This describes version 22 and higher u8 flags; // is_underground:0x1, m_day_night_differs:0x2, !m_generated:0x8 u16 m_lighting_complete; // since version 27 u8 content_width; // can only be 1 or 2 u8 params_width; // always set to 2 bulk_data; // compressed metadata; // serialized and compressed // disk only u8 unused_zero; // only version 23 node_timers; // only version 24 objects; u32 timestamp; NameIdMapping nimap; // node ids in this block node_timers; // since version 25 // bulk_data (after decompression): u8 param0[nodecount]; // only if content_width=1, param0 contains the content // nodecount is 16*16*16 u16 param0[nodecount]; // only if content_width=2 u8 param1[nodecount]; // the light values u8 param2[nodecount]; // only if content_width=1 // param2 may contain param0 data in the upper 4 bits: // if param0[i] > 0x7f (which is 127) then // u16 param0[i] := (param0[i] << 4) | (param2[i] >> 4) // param2[i] := param2[i] & 0xf u8 param2[nodecount]; // only if content_width=2
A mapchunk in Minetest is a collection of 5x5x5 MapBlocks (described above), and each time map generates, another mapchunk appears.
The Map (class Map) stores MapBlocks and works as an abstraction layer for the MapBlocks, allowing the users of Map to see the world as a consistent bunch of MapNodes.
Map also knows how to load and save MapBlocks.
It also contains functionality for lighting and liquid updates.
The VoxelManipulator is an object that stores arbitrary areas from the Map, for transferring into other threads and allowing faster node access than the Map does.