Map file standard
File naming
From now on (version 0.4) maps are single files, not directories. Generally there are no restrictions of map naming, but it's advisable to keep it in 8+3 format (DOS compatibility), and keep extensions .map (just a map).
Versions
It's first definition of map standard for Netcraft, but in future there may arise a problem. When defining new map standard, new informations must land after all informations from previous standard (relative to part of course), so older map editors would be able to read these maps.
Parts
Parts are organized like array (when objects are same size) or like lists. Each part contains informations about organisation of herself. It's valuable to store informations on top of the list. It will probably cause mapedit to read any map, doesn't mean newer or older.
Before any other data any part should contain informations on top:
offset: value: name: meaning:
0x0 char part_type 0 if part is like an array, 1 if like list
0x1 long size size of one record (0 if not array)
0x5 long offset absolute position of first record (suppose we'll need bigger part header...)
ends at 0x9
Header
offset: value: name: meaning:
0x0 "ncr.map" magic string
0x7 2xshort map standard number (major + minor) actually 0.2
0xb char flag of move graph (0 - absent, 1 - present)
0xc short map -> size_x map size
0xe short map -> size_y
0x10 char map -> tileset terrain type of map
0x11 char player_num number of all players
0x12 long units_num number of units
0x16 long dds_num number of doodads
0x1a long num_graph number of move graph vertexs
0x1e long map_offset offset to map data
0x22 long player_offset offset to players part
0x26 long units_offset offset to units part
0x2a long dds_offset offset to doodads part
0x2e long graph_offset offset to move graph part (valid if move graph exists, otherwise 0)
ends at 0x32
Procedure from src/map/m_file.c put parts in same order as numbers in header, but offsets are independent, so there is no need of putting things in same order.
Map
Each record is char sized and contains bck_number. Map is stored in columns.
Players
Because of lack of economy module, meningfull is only starting position of first player;
offset: value: name: meaning:
0x0 short start_0_x starting position of player (int tiles)
0x4 short start_0_y
ends at 0x4
Units
Fixed size records, 12 bytes each.
offset: value: name: meaning:
0x0 char type unit's type
0x1 long poz_x position (fixed pixels!)
0x5 long poz_y
0x9 char owner
ends at 0xa
Doodads
Fixed size records, 9 bytes each
offset: value: name: meaning:
0x0 char type type of doodad
0x1 long poz_x position (int tiles)
0x5 long poz_y
ends at 0x9
Move graph
Variable size records. Valid only if was set in header, otherwise empty (offset == 0). Each record contains one vertex of move graph.
offset: value: name: meaning:
0x0 long poz_x position (pixels)
0x4 long poz_y
0x8 long num_w number of incidential vertexs
0xb char head how sided is this vertex
0xc long next_offset offset to next record
0x11- - array of incidential vertexs
for each of them
0x0 long num number of vertex
0x4 long odl distance between these vertexs
total 8
Notes
Note that game memory contains some more informations than map. These informations must be automaticly generated from map data. This is used to make game routines easier and faster and to hold minimal amount of disk space for map.
Any compresion algorithm for maps is welcomed, but remember that game doesn't contain much space on disk and maps published in web are already compressed with gzip or other program like this. Compression cannot be put twice on same time.
All maps published in web (especially big ones) should not have move graph counted. This can be done automaticly by using mkmg from tools.