Add explanation to rtl switch to fonts README
[supertux.git] / docs / levelformat.txt
1 Note: the "official" editor for supertux is now flexlay
2 (http://flexlay.berlios.de)
3
4 - Level editing for SuperTux -
5 http://supertux.lethargik.org/
6
7 Last update: April 26, 2004
8
9 This document describes both the level format and
10 the level editor.
11
12 = LEVEL FORMAT =
13
14 Since the level editor does not support anything, you might have
15 to edit a couple of things directly from the level file, so it
16 might be a better idea to read this.
17
18 Level format should be pretty straight forward. The syntax is the
19 Scheme one. But even if you have no idea about it, no worry,
20 it is pretty intuitive.
21
22 Attention: this describes the new level format. But current levels
23 still use the old one, since the engine still supports it and also
24 level editors still use it.
25
26 To explain a bit of the level format, there is nothing better than
27 really looking at it. So here goes a quote of it. The comments
28 prefix-ed by a ';', describe what everything is about.
29
30 ; This is a comment!
31 ; Level made using SuperTux's built-in Level Editor
32 (supertux-level
33 ; version higher than 1 means that it follows the new level format (CVS)
34   (version 2)
35 ; Level's title and author name
36   (name "The Castle of Nolok")
37   (author "Ingo Ruhnke")
38 ; Time the player has to finish the level (it is not in seconds!)
39   (time 300)
40 ; Each level has one or more sectors. Sectors can be seen as levels inside this
41 ; level. Their use is for swapping.
42   (sector
43 ; Naming sectors is useful for swapping
44 ; "main" sectors are the ones that the player will start in
45     (name "main")
46 ; Setup an end sequence animation (blank for nothing).
47 ; Currently supported is fireworks that displays fireworks on exit.
48     (end-sequence-animation "fireworks")
49 ; Level's gravity (better let it 10)
50     (gravity 10)
51 ; We can have one or more playerspawn that can be used by doors.
52 ; "main" is the default one for this sector.
53   (playerspawn
54     (name "main")
55     (x 100)
56     (y 170)
57   )
58 ; Level's music file from data/music
59     (music "fortress.mod")
60 ; This level will use a vertical background
61 ; You can also set a background image by using:
62 ; (background "arctis.jpg")
63     (background
64       (top_red 0)
65       (top_green 0)
66       (top_blue 0)
67       (bottom_red 150)
68       (bottom_green 0)
69       (bottom_blue 0)
70     )
71 ; Now let's go for tilemaps. Tilemaps are the tiles field. We can have more
72 ; than one. Each one has the following properties:
73 ; layer - can be foreground (drawn above player), interactive (interacts with player,
74 ; (solid #t) has to be set, as well), background (drawn below the player).
75 ; speed - this can be used for parallax effects. Better use a level editor (though
76 ; there is not yet one that supports it) to edit this.
77     (tilemap
78       (layer "interactive")
79       (solid #t)
80       (speed 1)
81 ; width and height of the tilemap. Has to be specified.
82       (width 525)
83       (height 15)
84 ; Here goes the tilemap :
85       (tiles 64 64 69 68 68 ...
86        ....
87        ....)
88     )
89 ; Another tilemap, this is the background one
90     (tilemap
91       (layer "background")
92       (solid #f)
93       (speed 1)
94       (width 525)
95       (height 15)
96       (tiles 0 0 ...
97        ... )
98     )
99 ; Yet another one. Normally there are only three.
100     (tilemap
101       (layer "foreground")
102       (solid #f)
103       (speed 1)
104       (width 525)
105       (height 15)
106       (tiles 0 0 0 0 ...
107        ...)
108     )
109 ; Let's setup a few bad guys.
110     (jumpy
111       (x 1277)
112       (y 388)
113 ; stay-on-platform is a flag to tell them not to fall from
114 ; their platforms.
115       (stay-on-platform #f)
116     )
117     (mriceblock
118       (x 4345)
119       (y 380)
120       (stay-on-platform #f)
121     )
122     (stalactite
123       (x 790)
124       (y 96)
125       (stay-on-platform #f)
126     )
127 ; At last, but not least, the camera:
128 ; (Order doesn't matter for Lisp, so camera could be on top or the middle)
129     (camera
130 ; This is the ordinary mode, but we can also have an auto one.
131 ; "auto" can be used to create a path to the camera.
132 ; Here is an example of an auto camera:
133 ;  (camera
134 ;    (mode "autoscroll")
135 ;    (path
136 ;      (point (x 0) (y 0) (speed 0.5))
137 ;      (point (x 500) (y 0) (speed 2))
138 ;      (point (x 1200) (y 0) (speed 1))
139 ;      (point (x 3000) (y 0) (speed 1))
140 ;      (point (x 1500) (y 0) (speed 1.4))
141 ;      (point (x 99999) (y 0))
142 ;    )
143 ;  )
144       (mode "normal")
145 ; backscrolling is only set for normal. It says if player can back
146 ; scroll or not (just go to the front).
147       (backscrolling #t)
148     )
149 ; We could also setup other objects, like trampolines, doors (to swap),
150 ; and moving platform. Please check another level (ie. in test/) that
151 ; uses them to learn more about them.
152   )
153 )
154
155 = LEVEL EDITORS =
156
157 USING THE BUILT-IN LEVEL EDITOR:
158 --------------------------------
159
160 When opening the leveleditor, a menu will appear. This menu
161 can be used to select or add level subsets. A level subset is
162 a collection of levels. Subsets can be chose during gameplay
163 when starting a game.
164
165 After selecting the subset, have a look at the level editor.
166 The button bar in the right is the place where you can control
167 the actions related with editing. You can select levels and add
168 through there.
169
170 To select tiles (foreground or background) and enemies, the button
171 bar is the right place. There you can also save, test and setup
172 the level. It is also possible between two selection cursors! Give
173 a try to both. A right click in a button bar button will give you
174 a description and a shortcut for it.
175
176 To change a tile, just press the tile you want to change with a
177 left mouse click. The current tile will be used. Depending
178 on the selection behavior, you can or not select more
179 than one tiles.
180
181 To scroll, you just have to point over the two arrow buttons, or
182 use the right button click.
183
184 There is a small help that can be reached by pressing F1.
185
186 To go back to the menu, just press Esc.
187
188 The levels are saved under a .supertux/levels directory in
189 your home directory.
190
191
192 USING FLEXLAY:
193 --------------
194
195 FlexLay is an external project (it even uses different libraries)
196 that is developed by Ingo Ruhnke and supports a lot of different
197 games, including SuperTux (or else we wouldn't mention it :) ).
198
199 Anyway, it is pretty easy to use and is a lot more advanced than
200 the internal one. So, if you are considering doing a few levels
201 for us, it would be a good idea to check this out.
202
203 Its webpage is located at:
204 http://pingus.seul.org/~grumbel/flexlay/
205
206 It needs ClanLib and a few odd libraries... Anyway, it worths
207 it ;)
208
209 The only cons it has is that you have to have an accelerated
210 videocard (with the drivers working, obviously). For linux,
211 we advise nvidia videocards with the use of nvidia's closed
212 drivers. ATI drivers should be enough to run this game though.
213
214
215 = CONCLUSION =
216
217 To sum up, go build lots of levels and HAVE FUN!!
218
219 Please, send your levels or any art, including sketches, you
220 have created to the SuperTux mailing list.
221
222
223     - SuperTux developers