File: mapformat

package info (click to toggle)
xtux 0.2.030306-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 10,212 kB
  • ctags: 2,009
  • sloc: ansic: 11,703; makefile: 174; perl: 126; sh: 44
file content (97 lines) | stat: -rw-r--r-- 3,673 bytes parent folder | download | duplicates (3)
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
Maps are stored in the "maps" subdirectory of wherever the data is stored.

A map in XTux is composed of 2 parts, the map header and the map data.

|----------|
|MAP HEADER|
|----------|

Line		Value					Description
 0			Map name				String (32)
 1			Map dimensions			integer x_tiles y_tiles
 2			Tile Table				String (32) Used to interpret map data.

Lines beginning with '#' are ignored, and can be used for comment.

|--------|
|MAP DATA|
|--------|

The map data consistss of the four map layers (BASE, OBJECT, TOPLEVEL, EVENT)
and the EVENTMETA, TEXT and ENTITY sections.
Each section begins with a line of the section name (previous uppercased words)
and the data follows on the subsequent lines until the next section label.

The TOPLEVEL, EVENT, EVENTMETA and TEXT sections are optional.

The four map layers are read in as MAP_HEIGHT lines of characters of length
MAP_WIDTH. There must be exactly the correct number of characters in each line,
even if there is no value in the OBJECT or TOPLEVEL layers (use spaces).
Characters represent keys in the tile table, which represent tiles in the game.
'#' is a valid tile value, so it can not be used for comments.

In all layers except for BASE, '-' or a space represents NO VALUE. The '-'
is useful to mark out walls to keep track of where things are.

The server uses the tile table to calculate what tiles are walkable by entites
while the client uses it to draw the map using pixmaps.

The EVENT and ENTITY sections are read by the server and represent events and
entities in the game.

The characters in the EVENT section correspond to specific events listed in
the EVENTMETA section, and are matched by the symbols (character). You can
choose any character but ' ' and '-'.

EVENTMETA consists of lines that take the form:

NAME c ...........

where NAME is the event name, c is the character symbol corresponding to EVENT
layer, and ........ are the arguments, that depend on what type of event iss
specified in NAME.

The ENTITY section consists of lines that take the form:

NAME x y dir vel

where NAME is an entity found in the data/entities file as header [NAME]. The
server will insert an entity of type NAME into the game at initial position
(x,y) direction dir and velocity vel.

Some characters have special values if inserted at the start of a line in the
EVENTMETA and ENTITY sections.

'#' means the line is ignored.
'$' means the line is only read in SAVETHEWORLD mode (against monsters).
'%' means the line is only read in HOLYWAR mode (deathmatch). 

|-----------|
|TILE TABLES|
|-----------|

Tile tables are located in the data directory. The existing tables have the
file extension ".table"
The tile table list the values of the character keys used in the XTux maps. They
have two sections, BASE and OBJECT and the parts are labelled with those section
names. The TOPLEVEL uses the same keys as the OBJECT layer. 

The character/tile lines have the format:

c Pixmap Cliplevel

where c is the character key used in the current layer (ie BASE or
OBJECT/TOPLEVEL) to represent the tile that is drawn as Pixmap and has the
cliplevel of Cliplevel.

c can be any printable character. Pixmap is something like "stone.xpm" and the
client will load the image "images/tiles/stone.xpm" to represent the tile in
the game. Cliplevel is used by the server to determine where entites can go,
and also to draw the picture in the minimap in the client. There are four
values:

NOCLIP		Any entity can pass
AICLIP      AI clips UNLESS they have a target (ie clip while patrolling)
GROUNDCLIP	Entities with cliplevel GROUNDCLIP can not pass.
ALLCLIP		Nothing can pass. Bullets/railguns/projectiles etc all stop.