summaryrefslogtreecommitdiff
path: root/doc/mapformat.txt
blob: 430be2d48242bd0462d62b89d45170cdda52d895 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
=========================================
         Minetest World Format
=========================================

Format used as of 0.4.dev-120322
==================================

This applies to a world format carrying the serialization version 22 which
is used at least in version 0.4.dev-120322.

The serialization version used is 22. It does not fully specify every aspect
of this format; if compliance with this format is to be checked, it needs to
be done by detecting if the files and data indeed follows it.

Legacy stuff:
-------------
Data can, in theory, be contained in the flat file directory structure
described below in Version 17, but it is not officially supported.

Files:
------
Everything is contained in a directory, the name of which is freeform, but
often serves as the name of the world.

Currently the authentication and ban data is stored on a per-world basis. It
can be copied over from an old world to a newly created world.

World
|-- auth.txt ----- Authentication data
|-- env_meta.txt - Environment metadata
|-- ipban.txt ---- Banned ips/users
|-- map_meta.txt - Map metadata
|-- map.sqlite --- Map data
|-- players ------ Player directory
|   |-- player1 -- Player file
|   '-- player2 -- Player file
`-- world.mt ----- World metadata

auth.txt
---------
Contains authentication data, player per line.
<name>:<password hash as <name><password> SHA1 base64>:<privilege1,...>
Example lines:
Player "celeron55", no password, privileges "interact" and "shout":
celeron55::interact,shout
Player "Foo", password "bar", privileges "interact" and "shout":
foo:iEPX+SQWIR3p67lj/0zigSWTKHg:interact,shout

env_meta.txt
-------------
--- Example content ---
game_time = 73471
time_of_day = 19118
EnvArgsEnd
-----------------------

ipban.txt
----------


Format used as of 2011-05 or so
================================

Map data serialization format version 17.

Directory structure:
sectors/XXXXZZZZ or sectors2/XXX/ZZZ
XXXX, ZZZZ, XXX and ZZZ being the hexadecimal X and Z coordinates.
Under these, the block files are stored, called YYYY.

There also exists files map_meta.txt and chunk_meta, that are used by the
generator. If they are not found or invalid, the generator will currently
behave quite strangely.

The MapBlock file format (sectors2/XXX/ZZZ/YYYY):
-------------------------------------------------

NOTE: Byte order is MSB first.

u8 version
- map format version number, this one is version 17

u8 flags
- Flag bitmasks:
  - 0x01: is_underground: Should be set to 0 if there will be no light
    obstructions above the block. If/when sunlight of a block is updated and
	there is no block above it, this value is checked for determining whether
	sunlight comes from the top.
  - 0x02: day_night_differs: Whether the lighting of the block is different on
    day and night. Only blocks that have this bit set are updated when day
	transforms to night.
  - 0x04: lighting_expired: If true, lighting is invalid and should be updated.
    If you can't calculate lighting in your generator properly, you could try
	setting this 1 to everything and setting the uppermost block in every
	sector as is_underground=0. I am quite sure it doesn't work properly,
	though.

zlib-compressed map data:
- content:
  u8[4096]: content types
  u8[4096]: param1 values
  u8[4096]: param2 values

zlib-compressed node metadata
- content:
  u16 version (=1)
  u16 count of metadata
  foreach count:
    u16 position (= p.Z*MAP_BLOCKSIZE*MAP_BLOCKSIZE + p.Y*MAP_BLOCKSIZE + p.X)
	u16 type_id
	u16 content_size
	u8[content_size] misc. stuff contained in the metadata

u16 mapblockobject_count
- always write as 0.
- if read != 0, just fail.

foreach mapblockobject_count:
  - deprecated, should not be used. Length of this data can only be known by
    properly parsing it. Just hope not to run into any of this.

u8 static object version:
- currently 0

u16 static_object_count

foreach static_object_count:
  u8 type (object type-id)
  s32 pos_x * 1000
  s32 pos_y * 1000
  s32 pos_z * 1000
  u16 data_size
  u8[data_size] data

u32 timestamp
- Timestamp when last saved, as seconds from starting the game.
- 0xffffffff = invalid/unknown timestamp, nothing will be done with the time
               difference when loaded (recommended)

Node metadata format:
---------------------

Sign metadata:
  u16 string_len
  u8[string_len] string

Furnace metadata:
  TBD

Chest metadata:
  TBD

Locking Chest metadata:
  u16 string_len
  u8[string_len] string
  TBD

// END