Skip to content

Level binary file structure description

ppelikan edited this page Jul 17, 2018 · 1 revision

Here is described structure of a binary files saved by the Map Editor. For example code, which properly decodes Level files, you can refer to entirelevel.cpp file in the Map Editor sources.

Thanks to the use of file section headers you can selectively ignore unneeded data (for example animations if they are not used by your game).

Data type Example value Description
int32 always: 99 File type header part 1
int32 always: 85 File type header part 2
string
(see below)
"My own level" Level name
int32 32 Tile size X in pixels
int32 32 Tile size Y in pixels
int32 3 Number of animations
Animations
(see below)
Animation1
Animation2
Animation3
Animations data
int32 always: 99 Start map data header part 1
int32 always: 80 Start map data header part 2
int32 3 Number of layers (maps)
Layers
(see below)
Layer1
Layer2
Layer3
Layers data
int32 always: 99 Start events data header part 1
int32 always: 90 Start events data header part 2
int32 3 Number of events
Events
(see below)
Event1
Event2
Event3
Events data
int32 always: 99 End of file header part 1
int32 always: 99 End of file header part 2

String structure:

Data type Example value Description
uint32 if string is empty: 0xFFFFFFFF,
otherwise string length in bytes: 8
String size
UTF-16
array
2-byte letters:
'T'
'e'
'x'
't'
UTF-16 string letters data array

Animation data structure

Data type Example value Description
int32 3 Number of frames
bool false:0
true:1
Is this a ping-pong type of animation
int32 15 Animation speed (FPS value)
int32
array
4
6
7
Respective indexes of tiles from texture file

Layer data structure

Data type Example value Description
int32 50 Layer map size X
int32 50 Layer map size Y
int32
2D array
0,0,8, ...
5,2,-1, ...
5,5,3, ...
... ... ...
Respective indexes of tiles
(value < 0 - index of animation,
value >= 0 - index of tile from texture file)

Event data structure

Data type Example value Description
string "Wall" Event name
string "bounce_factor=5" Event parameters
int32 3 Number of event occurrences in level
int32
2D array
x:5, y:3
x:5, y:4
x:6, y:4
... ...
Respective X and Y positions of the occuring events