]> git.lizzy.rs Git - dragonfireclient.git/blob - doc/mapformat.txt
documentation update (mapformat.txt mainly)
[dragonfireclient.git] / doc / mapformat.txt
1 I'll try to quickly document the newest block format in here (might contain
2 errors). Refer to the mapgen or minetestmapper script for the directory
3 structure and file naming. There are two sector namings possible,
4 sector/XXXXZZZZ and sector/XXX/ZZZ.
5
6 There also exists files map_meta.txt and chunk_meta, that are used by the
7 generator. If they are not found or invalid, the generator will currently
8 behave quite strangely.
9
10 The MapBlock file format (sectors2/XXX/ZZZ/YYYY):
11
12 NOTE: Byte order is MSB first.
13
14 u8 version
15 - map format version number, this one is version 17
16
17 u8 flags
18 - Flag bitmasks:
19   - 0x01: is_underground: Should be set to 0 if there will be no light
20     obstructions above the block. If/when sunlight of a block is updated and
21         there is no block above it, this value is checked for determining whether
22         sunlight comes from the top.
23   - 0x02: day_night_differs: Whether the lighting of the block is different on
24     day and night. Only blocks that have this bit set are updated when day
25         transforms to night.
26   - 0x04: lighting_expired: If true, lighting is invalid and should be updated.
27     If you can't calculate lighting in your generator properly, you could try
28         setting this 1 to everything and setting the uppermost block in every
29         sector as is_underground=0. I am quite sure it doesn't work properly,
30         though.
31
32 zlib-compressed map data:
33 - content:
34   u8[4096]: content types
35   u8[4096]: param1 values
36   u8[4096]: param2 values
37
38 zlib-compressed node metadata
39 - content:
40   u16 version (=1)
41   u16 count of metadata
42   foreach count:
43     u16 position (= p.Z*MAP_BLOCKSIZE*MAP_BLOCKSIZE + p.Y*MAP_BLOCKSIZE + p.X)
44         u16 type_id
45         u16 content_size
46         u8[content_size] misc. stuff contained in the metadata
47
48 u16 mapblockobject_count
49 - always write as 0.
50 - if read != 0, just fail.
51
52 foreach mapblockobject_count:
53   - deprecated, should not be used. Length of this data can only be known by
54     properly parsing it. Just hope not to run into any of this.
55
56 u8 static object version:
57 - currently 0
58
59 u16 static_object_count
60
61 foreach static_object_count:
62   u8 type (object type-id)
63   s32 pos_x * 1000
64   s32 pos_y * 1000
65   s32 pos_z * 1000
66   u16 data_size
67   u8[data_size] data
68
69 u32 timestamp
70 - Timestamp when last saved, as seconds from starting the game.
71 - 0xffffffff = invalid/unknown timestamp, nothing will be done with the time
72                difference when loaded (recommended)
73
74 // END
75