Difference between revisions of "Minetest Schematic File Format"

From Minetest Developer Wiki
Jump to navigation Jump to search
(Created page with "The '''Minetest Schematic File Format''' if the file format used when schematics are seralized by e.g. minetest.create_schematic. Schematic files are supposed to have “....")
 
m (→‎Version changes: formatting)
Line 34: Line 34:
  
 
* 1—Initial version
 
* 1—Initial version
* 2—Fixed messy never/always place; 0 probability is now never, 0xFF is always
+
* 2—Fixed messy never/always place; the probability of <code>0</code> is now never, and <code>0xFF</code> is always
 
* 3—Added y-slice probabilities; this allows for variable height structures
 
* 3—Added y-slice probabilities; this allows for variable height structures
* 4—Compressed range of node occurence prob., added per-node force placement bit
+
* 4—Compressed range of node occurence probability, added per-node force placement bit

Revision as of 04:25, 15 August 2017

The Minetest Schematic File Format if the file format used when schematics are seralized by e.g. minetest.create_schematic. Schematic files are supposed to have “.mts” as a file name suffix.

Definition

The definition of version 4 of this file format follows. The original and latest defintion can be found in the Minetest source code at src/mg_schematic.h.

All values are stored in big-endian byte order.
[u32] signature: 'MTSM'
[u16] version: 4
[u16] size X
[u16] size Y
[u16] size Z
For each Y:
	[u8] slice probability value
[Name-ID table] Name ID Mapping Table
	[u16] name-id count
	For each name-id mapping:
		[u16] name length
		[u8[]] name
ZLib deflated {
For each node in schematic:  (for z, y, x)
	[u16] content
For each node in schematic:
	[u8] param1
	  bit 0-6: probability
	  bit 7:   specific node force placement
For each node in schematic:
	[u8] param2
}

Version changes

As of Minetest 0.4.16, the current version of the file format is 4.

  • 1—Initial version
  • 2—Fixed messy never/always place; the probability of 0 is now never, and 0xFF is always
  • 3—Added y-slice probabilities; this allows for variable height structures
  • 4—Compressed range of node occurence probability, added per-node force placement bit