-
Notifications
You must be signed in to change notification settings - Fork 3
Map Format
Level data is stored in simple text files (example here) formatted in a way that is easy to parse and process but hard to read and understand on user side. By design, the file is read line by line so each object declaration must fit on a single line and informations come in a certain order to ensure the file integrity and coherence to build playable levels out of them.
In the following explanations, "?"
represent where the numerical values should be set for parameter.
This section contains critical informations about the file content (vertices and sectors amount). This line must be at the top of the file.
total vertexes ? sectors ?
Parameter | Possible Values | Explanations |
---|---|---|
vertexes | 3 >= ? > +INF |
At least 3 vertices are needed to build a polygon (triangle). |
sectors | 1 >= ? > +INF |
At least 1 sector is mandatory to play inside afterwards. |
This line is meant to locale the player inside the map. It can be anywhere in the file after the header.
player x ? y ? sector ? angle ?
Parameter | Possible Values | Explanations |
---|---|---|
x | 0 >= ? > +INF |
Our map-editor doesn't handle negative coordinates. |
y | 0 >= ? > +INF |
Our map-editor doesn't handle negative coordinates. |
sector | 0 >= ? > +INF |
There is at least 1 sector in the map which is sector 0. |
angle | 0 >= ? < 360 |
Since negative angles or above 360 are just multiple of these ones it simplify everything. |
This one locates the coordinates of a point on an endless oriented 2D plane. These objects are reused later in the format to build sectors so any given vertex declaration must be above every sector declaration that reference it.
vertex number ? x ? y ?
Parameter | Possible Values | Explanations |
---|---|---|
number | 0 >= ? > +INF |
Acts as a lookup index, negative values are invalid. |
x | 0 >= ? > +INF |
Our map-editor doesn't handle negative coordinates. |
y | 0 >= ? > +INF |
Our map-editor doesn't handle negative coordinates. |
And finally where all is brought together to build the surrounding world for the player. Theses objects need vertices to be assembled and fully functional so any given sector declaration must come after every referenced vertex declaration.
sector number ? texture ? type ? data ? light ? h_floor ? h_ceil ? gravity ? friction ? vertex_num ? vertexes ?...? portals ?....?
Parameter | Possible Values | Explanations |
---|---|---|
number | 0 >= ? > +INF |
Acts as a lookup index, negative values are invalid. |
texture | 0 >= ? >= 10 |
Acts as a lookup index, negative values and above 10 are invalid. |
type | -INF > ? > +INF |
Sector effector, plates (positive) and doors (negative) are unbound. |
data | -INF > ? > +INF |
Used in various way (money generation, elevation etc...), no-bounds. |
light | -1 >= INT_MAX |
Must be a color so up to 0xFFFFFF which is the highest color value possible. |
h_floor | -INF > ? > +INF |
Must be strictly lower than h_ceil . |
h_ceil | -INF > ? > +INF |
Must be strictly higher than `h_floor. |
gravity | 0 > ? <= 100 |
Negative gravity isn't possible and high ones aren't handled. |
friction | 0 >= ? <= 100 |
Negative friction isn't friction possible and high ones aren't handled. |
vertex_num | 0 >= ? > +INF |
Acts as a lookup variable. |
vertexes | 0 >= ? > +INF |
A list of referenced vertices. |
portals | 0 >= ? > +INF |
A list of linked sectors. |