]> git.xonotic.org Git - xonotic/xonotic.git/blob - Docs/mapping.txt
Merge branch 'master' of /var/cache/git/xonotic/xonotic
[xonotic/xonotic.git] / Docs / mapping.txt
1 ==============\r
2 =Mapping Help=\r
3 ==============\r
4 \r
5 While I can't help you make a map, I can help you get it listed in the menu and\r
6 working in the maplist. :p  The central object is the .mapinfo file, but\r
7 there's much more available.\r
8 \r
9 Table of Contents\r
10 -----------------\r
11 I        Map Lists & Scripts\r
12          (get your map listed and working)\r
13   i.     mapinfo\r
14   ii.    mapname.cfg\r
15 \r
16 II       Map Image\r
17 \r
18 III      Domination\r
19 \r
20 IV       CTF\r
21 \r
22 V        Rune Match\r
23 \r
24 VI       Race/CTS\r
25 \r
26 VII      Nexball\r
27 \r
28 Appendix A - Advanced mapinfo\r
29 \r
30 Appendix B - Helpful extras\r
31   i.     Team Colors\r
32   ii.    Text Colors\r
33 \r
34 Appendix C - Advanced Darkplaces shaders\r
35 \r
36 ========================\r
37 =I. Map Lists & Scripts=\r
38 ========================\r
39 \r
40 There now is just a single script/cfg file available to you, containing all map\r
41 specific settings:\r
42 \r
43 mapname.mapinfo\r
44 \r
45 The mapinfo is actually required - however, the game is so nice that it\r
46 automatically generates a draft of it for you.\r
47 \r
48 ------------------\r
49 -The mapinfo file-\r
50 ------------------\r
51 \r
52 *cue even more scary music*\r
53 \r
54 The mapinfo file is basically what gets your map listed in the menu, and sets\r
55 up the options needed to change to it. If no mapinfo file exists, the menu\r
56 will automatically generate a rough draft for you on game startup. It will get\r
57 stored into data/data/mapname.mapinfo.\r
58 \r
59 As an example, let's say I make a map called "wazat1.bsp". As long as I'm\r
60 fantasizing, I might as well say this map is so well done I'm actually willing\r
61 to release it for friends, neighbors, fellow forum visitors and other people\r
62 who like me to judge me by. Let's also assume that I want domination,\r
63 deathmatch/team deathmatch and runematch to all be playable on my map.\r
64 \r
65 This is very easy. First, I start the game and exit it again so the game writes\r
66 data/data/wazat1.mapinfo for me. The file may look like:\r
67 \r
68     title Wazat's Great Map\r
69     description Bleh.\r
70     author Unknown\r
71     _diameter 1966.839355\r
72     _spawnpoints 5\r
73     has weapons\r
74         cdtrack 5\r
75     gametype dm // defaults: timelimit=20 pointlimit=30 leadlimit=0\r
76     gametype dom // defaults: timelimit=20 pointlimit=200 teams=2 leadlimit=0\r
77     gametype rune // defaults: timelimit=20 pointlimit=200 leadlimit=0\r
78     gametype lms // defaults: timelimit=20 lives=9 leadlimit=0\r
79     gametype arena // defaults: timelimit=20 pointlimit=10 leadlimit=0\r
80 \r
81 As I see, the menu autodetected that my map may be suitable for deathmatch,\r
82 domination, runematch, last man standing and arena. But I want the map to be\r
83 played in domination, deathmatch, team deathmatch, runematch only, and I also\r
84 want different timelimits/fraglimits, so I will change the "gametype" lines to:\r
85 \r
86     gametype dom pointlimit=100 timelimit=15\r
87     gametype rune pointlimit=1000 timelimit=25\r
88     gametype dm pointlimit=40 timelimit=15\r
89     gametype tdm pointlimit=50 timelimit=0 teams=2\r
90 \r
91 Also, while I am at it, I should fix the placeholders in the map description lines:\r
92 \r
93     title Wibble\r
94     description A large multi level arena map\r
95     author Wazat\r
96 \r
97 Although not entirely necessary, I will now move the .mapinfo file from\r
98 data/data/maps/wazat1.mapinfo to data/maps/wazat1.mapinfo, so it is at the same\r
99 place as my map. Next time I start the game, my map will be shown supporting\r
100 the right game modes and with the right description in the menu.\r
101 \r
102 Also, note the "has weapons" line. If this line is not there (which happens if\r
103 the map contains no weapon entities other than the Nex), the map will run in\r
104 MinstaGib only and not be shown in the menu normally. So if you look for your\r
105 map and don't find it, add "has weapons" to the mapinfo file, and make sure you\r
106 have weapon entities placed.\r
107 \r
108 There's much more power in a mapinfo file. See Appendix A for more details.\r
109 \r
110 Gametype        | Syntax                                                                                                   | Notes\r
111 ----------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------\r
112 Deathmatch      | gametype dm [timelimit=...] [pointlimit=...] [leadlimit=...]                                             |\r
113 Team Deathmatch | gametype tdm [timelimit=...] [pointlimit=...] [teams=...] [leadlimit=...]                                | 2, 3, or 4 teams\r
114 Domination      | gametype dom [timelimit=...] [pointlimit=...] [teams=...] [leadlimit=...]                                | 2, 3, or 4 teams, only if map has no dom_team ents\r
115 CTF             | gametype ctf [timelimit=...] [caplimit=...] [leadlimit=...]                                              |\r
116 Runematch       | gametype rune [timelimit=...] [pointlimit=...] [leadlimit=...]                                           |\r
117 LMS             | gametype lms [timelimit=...] [lives=...] [leadlimit=...]                                                 |\r
118 Arena           | gametype arena [timelimit=...] [pointlinit=...] [leadlimit=...]                                          |\r
119 Key Hunt        | gametype kh [timelimit=...] [pointlimit=...] [teams=...] [leadlimit=...]                                 | 2, 3, or 4 teams\r
120 Assault         | gametype as [timelimit=...]                                                                              | never uses points\r
121 Onslaught       | gametype ons [timelimit=...]                                                                             | never uses points\r
122 Race            | gametype rc [timelimit=...] [qualifying_timelimit=...] [laplimit=...] [teamlaplimit=...] [leadlimit=...] | g_race_teams: teamlaplimit is used instead of laplimit\r
123 CTS             | gametype cts [timelimit=...] [skill=...]                                                                 | never uses points\r
124 CA              | gametype ca [timelimit=...] [pointlimit=...] [leadlimit=...]                                             |\r
125 Nexball         | gametype nb [timelimit=...] [pointlimit=...] [leadlimit=...]                                             |\r
126 Freeze Tag      | gametype ft [timelimit=...] [pointlimit=...] [teams=...] [leadlimit=...]                                 |\r
127 Keepaway        | gametype ka [timelimit=...] [pointlimit=...]                                                             |\r
128 \r
129 \r
130 ===============\r
131 =II. Map Image=\r
132 ===============\r
133 \r
134 So, you've got your map listed in the menu and it plays properly, but the menu\r
135 isn't showing your picture! Or the picture is scaled badly! What manner of man\r
136 would create such an accursed abomination?!\r
137 \r
138 Well... That sounds like something I'd do. :D\r
139 \r
140 And it is really easy: just make a screenshot of the map in action (preferably\r
141 with crosshair and HUD switched off), and place it next to the map as\r
142 mapname.jpg. For best rendering and file size, make the image in 4:3 aspect\r
143 ratio, but scale it to the resolution 256x256 or possibly 512x512. It will look\r
144 skewed in your image editing app, but the menu will show it right, and your\r
145 graphics card LOVES images of such dimension.\r
146 \r
147 \r
148 =================\r
149 =III. Domination=\r
150 =================\r
151 \r
152 In order to get Domination working well in your map, you need to place dom_team\r
153 and dom_controlpoint entites. You *must* have at least 3 dom_team entities - 2\r
154 minimum teams and one blank one (empty netname and no team). You can have up to\r
155 4 teams (5 dom_team entities), and remember: if you set 3 teams, the third team\r
156 must be the yellow one, according to the team order.\r
157 \r
158 Dom Team\r
159 --------\r
160 classname  dom_team\r
161 netname    name of team (Red Team). Set to "" or don't define for the required\r
162            blank team.\r
163 cnt        color of the team. See the "Helpful Extras" section for info.\r
164 model      When this team captures control points, the points turn to this\r
165            model. If this is the neutral team, points start out as this model.\r
166 noise      Sound to be played on the control point when it's captured. Only\r
167            players nearby will hear it.\r
168 noise1     Sound to be played to all players when the control point is\r
169            captured. Also good for an annoncer voice ("Red Team has captured a\r
170            control point")\r
171 \r
172 Control Points\r
173 --------------\r
174 classname  dom_controlpoint\r
175 message    message to be displayed to all players when this point is captured,\r
176            preceded by the team's name. This defaults to " has captured a control point".\r
177            You can specify different names for each point, for example " has captured the\r
178            Lava Room".\r
179 origin     where in the map this point is\r
180 wait       How often this point gives its controlling team frags.\r
181 frags      How many frags this point gives each wait cycle.\r
182 \r
183 Here is an example entry in a .ent file that includes colored text and 3 teams:\r
184 \r
185 {\r
186 "classname" "dom_team"\r
187 "netname" ""\r
188 "model" "models/domination/dom_unclaimed.md3"\r
189 }\r
190 {\r
191 "classname" "dom_team"\r
192 "netname" "^4Blue Team"\r
193 "cnt" "13"\r
194 "noise" ""\r
195 "noise1" "domination/claim.wav"\r
196 "model" "models/domination/dom_blue.md3"\r
197 }\r
198 {\r
199 "classname" "dom_team"\r
200 "netname" "^1Red Team"\r
201 "cnt" "4"\r
202 "noise" ""\r
203 "noise1" "domination/claim.wav"\r
204 "model" "models/domination/dom_red.md3"\r
205 }\r
206 {\r
207 "classname" "dom_team"\r
208 "netname" "^3Yellow Team"\r
209 "cnt" "12"\r
210 "noise" ""\r
211 "noise1" "domination/claim.wav"\r
212 "model" "models/domination/dom_yellow.md3"\r
213 }\r
214 {\r
215 "classname" "dom_team"\r
216 "netname" "^6Pink Team"\r
217 "cnt" "9"\r
218 "noise" ""\r
219 "noise1" "domination/claim.wav"\r
220 "model" "models/domination/dom_pink.md3"\r
221 }\r
222 {\r
223 "classname" "dom_controlpoint"\r
224 "message" " ^3has captured the ^1Hallways"\r
225 "origin" "-206.0 -488.8 -150.0"\r
226 "frags" "3"\r
227 "wait" "5"\r
228 "scale" "1.3"\r
229 }\r
230 {\r
231 "classname" "dom_controlpoint"\r
232 "message" " ^3has captured the ^1Lavaroom"\r
233 "origin" "1457.1  19.9 -110.0"\r
234 "frags" "1"\r
235 "wait" "5"\r
236 }\r
237 {\r
238 "classname" "dom_controlpoint"\r
239 "message" " ^3controls the ^1Nex & Strength"\r
240 "origin" "-259.8 299.3  5"\r
241 "frags" "1"\r
242 "wait" "5"\r
243 }\r
244 {\r
245 "classname" "dom_controlpoint"\r
246 "message" " ^3has captured the ^1Upper Platform"\r
247 "origin" "539.7 1206.0 182.0"\r
248 "frags" "1"\r
249 "wait" "5"\r
250 }\r
251 {\r
252 "classname" "dom_controlpoint"\r
253 "message" " ^3has captured the ^1Teleport Room"\r
254 "origin" "-1000.0 636.2 -16.0"\r
255 "frags" "1"\r
256 "wait" "5"\r
257 }\r
258 \r
259 \r
260 As you can see in the example, there are 5 dom_team ents: one blank, Red, Blue,\r
261 Yellow and Pink. Each control point has a different message (giving it a\r
262 special name), and the one in the hallways gives 3 frags every 5 seconds\r
263 instead of just one, making it more valuable.\r
264 \r
265 If your map contains the required entities for Domination, the menu will\r
266 automatically detect it for supporting Domination. To force the map to get\r
267 re-detected after you add such entities, delete the data/data/mapname.mapinfo\r
268 file - or simply edit it to add the "gametype dom" line.\r
269 \r
270 \r
271 =========\r
272 =IV. CTF=\r
273 =========\r
274 \r
275 Capture the flag needs at least 1 CTF flag per team, and can also make use of\r
276 team spawnpoints.\r
277 \r
278 CTF Flags\r
279 ---------\r
280 classname  item_flag_team1 or item_flag_team2\r
281 angle      direction the flag will point\r
282 model      model of the flag (default: models/ctf/flag_red.md3 or\r
283            models/ctf/flag_blue.md3)\r
284 noise      sound played when flag is stolen (default: "ctf/take.wav")\r
285 noise1     sound played when flag is returned by a teammate (default:\r
286            "ctf/return.wav")\r
287 noise2     sound played when flag is captured (default: "ctf/capture.wav")\r
288 noise3     sound played when flag returns itself (default: "ctf/respawn.wav")\r
289 \r
290 Team Spawnpoints\r
291 ----------------\r
292 classname  info_player_team1 or info_player_team2\r
293 *note: These function just like info_player_deathmatch, but for one team only.\r
294 If you don't make team spawnpoints, info_player_deathmatch is used instead.\r
295 \r
296 If your map contains the required entities for CTF, the menu will automatically\r
297 detect it for supporting CTF. To force the map to get re-detected after you add\r
298 such entities, delete the data/data/mapname.mapinfo file - or simply edit it to\r
299 add the "gametype ctf" line.\r
300 \r
301 ==============\r
302 =V. Runematch=\r
303 ==============\r
304 \r
305 Runematch needs only one type of entity to work: rune spawn points. You will\r
306 need at least one for each rune (5 minimum at the time of this writing), though\r
307 you should probably have more than that in the map. Just give the points a\r
308 classname and origin.\r
309 \r
310 Rune Spawnpoints\r
311 ----------------\r
312 classname  runematch_spawn_point\r
313 \r
314 If your map contains the required entities for Runematch, the menu will automatically\r
315 detect it for supporting Runematch. To force the map to get re-detected after you add\r
316 such entities, delete the data/data/mapname.mapinfo file - or simply edit it to\r
317 add the "gametype rune" line.\r
318 \r
319 ==============\r
320 =VI. Race/CTS=\r
321 ==============\r
322 \r
323 Making a race map is not hard: you need some special spawnpoints, and some checkpoints.\r
324 \r
325 Spawnpoints\r
326 -----------\r
327 classname  info_player_race\r
328 target     targetname of the checkpoint\r
329 race_place for finish line checkpoints, the place of the point, or -1 to make it qualifying/CTS-only, or unset to let all the other players spawn\r
330 \r
331 Checkpoints\r
332 -----------\r
333 classname  trigger_race_checkpoint\r
334 targetname some name to target the checkpoint with\r
335 cnt        number of the checkpoint (or 0 for finish line)\r
336 \r
337 Note that checkpoints are brush entities, and they should be somewhat thick and\r
338 cover the full volume the player could use to get past them.\r
339 \r
340 Example of entity placement:\r
341 \r
342                          ###\r
343     ---------------------###---\r
344    /    9999  7  5  3  1>###   \\r
345   /     9999 8  6  4  2 >###    \\r
346  |     ------------------###     |\r
347 %%%%%%%%                 ###|    |\r
348 %%%%%%%%                 $$$|    |\r
349  | ^ ^ ------------------$$$     |\r
350  \                       $$$ <  /\r
351   \                      $$$ < /\r
352    ----------------------$$$---\r
353                          $$$\r
354 \r
355 ###:  classname = trigger_race_checkpoint, cnt = 0, targetname = finish\r
356 $$$:  classname = trigger_race_checkpoint, cnt = 1, targetname = cp1\r
357 %%%:  classname = trigger_race_checkpoint, cnt = 2, targetname = cp2\r
358 >:    classname = info_player_race,                 target = finish, angle = 0\r
359 1:    classname = info_player_race,                 target = finish, angle = 0, race_place = 1\r
360 2:    classname = info_player_race,                 target = finish, angle = 0, race_place = 2\r
361 ....\r
362 8:    classname = info_player_race,                 target = finish, angle = 0, race_place = 8\r
363 9:    classname = info_player_race,                 target = finish, angle = 0, race_place = 9\r
364 <:    classname = info_player_race,                 target = cp1,    angle = 180\r
365 ^:    classname = info_player_race,                 target = cp2,    angle = 90\r
366 \r
367 If your map contains the required entities for Race, the menu will automatically\r
368 detect it for supporting Race. To force the map to get re-detected after you add\r
369 such entities, delete the data/data/mapname.mapinfo file - or simply edit it to\r
370 add the "gametype rc" line.\r
371 \r
372 CTS maps do not use checkpoints with race_place set, so you can leave them out\r
373 for CTS maps.\r
374 \r
375 The skill parameter in the mapinfo entry for CTS shall be in the range from 0 (easy) to 10 (impossible).\r
376 \r
377 =============\r
378 =VI. Nexball=\r
379 =============\r
380 \r
381 There are three required entities: nexball_redgoal, nexball_bluegoal, and one of nexball_basketball\r
382 or nexball_football. There are also optional nexball_yellowgoal and nexball_pinkgoal entities (don't\r
383 add a pink goal when there is no yellow goal on the map, it will crash)\r
384 \r
385 Goals are made just like any other regular triggers. You can use multiple brushes for one trigger,\r
386 but avoid this if possible.\r
387 \r
388 There are also two other goal-like entities, nexball_fault and nexball_bound, the first taking a point\r
389 from the team that hits the trigger with the ball, the second simply returning it. You can spawn the\r
390 ball inside a goal-like trigger, this can be useful for basketball maps with separate teams and a\r
391 common ball spawn.\r
392 The different keys for the entities are documented in entities.def.\r
393 \r
394 The ball is affected by trigger_impulse, but not by trigger_push or teleporters.\r
395 \r
396 You should better avoid patches on the field, as collisions can sometimes get buggy on these.\r
397 \r
398 \r
399 ===============================\r
400 =Appendix A - Advanced mapinfo=\r
401 ===============================\r
402 \r
403 You now know how to make a basic, bare-bones mapinfo to set up a couple options\r
404 and load your map. However, there's much more you can do!  Consider these\r
405 senarios:\r
406 \r
407 1. The laser has too high of a force for laser jumps and ruins CTF\r
408 2. I don't want players to start out with the shotgun, but with the machinegun\r
409    instead\r
410 3. The map takes so much server CPU performance that the anti-wallhack can't be\r
411    made active\r
412 \r
413 Each of these situations can be resolved with ease with a little work in the\r
414 mapinfo file.\r
415 \r
416 To do this, I can add the following lines to my mapinfo file:\r
417 \r
418     settemp_for_type ctf g_balance_laser_primary_force 200\r
419     settemp_for_type all g_start_weapon_shotgun 0\r
420     settemp_for_type all g_start_weapon_uzi 1\r
421     settemp_for_type all sv_cullentities_trace 0\r
422 \r
423 These "settemp" settings are automatically removed when the map is left and\r
424 another is loaded. As you can see, it is possible to make per-mode temporary\r
425 settings, and global ones.\r
426 \r
427 Similar settings are also possible for the client:\r
428 \r
429     clientsettemp_for_type all r_shadow_glossexponent 96\r
430 \r
431 Another possibility is to specify fog settings in the mapinfo, for convenience\r
432 in case you set sv_foginterval by it too (to force the fog on the clients):\r
433 \r
434     fog 0.2 0.25 0.3 0.3 1 1500\r
435     settemp_for_type all sv_foginterval 5\r
436 \r
437 \r
438 =============================\r
439 =Appendix B - Helpful Extras=\r
440 =============================\r
441 \r
442 ----------------\r
443 -i. Team Colors-\r
444 ----------------\r
445 When you need to set an entity's color or team, use these values:\r
446 \r
447 Red\r
448 ---\r
449 Team:      5\r
450 Color:     4\r
451 \r
452 Blue\r
453 ----\r
454 Team:      14\r
455 Color:     13\r
456 \r
457 Yellow\r
458 ------\r
459 Team:      13\r
460 Color:     12\r
461 \r
462 Pink\r
463 -----\r
464 Team:      10\r
465 Color:     9\r
466 \r
467 \r
468 ----------------\r
469 -i. Text Colors-\r
470 ----------------\r
471 Occasionally you may want to print text in color, such as team names. Here are your options:\r
472 \r
473 1  Red\r
474 2  Green\r
475 3  Yellow\r
476 4  Blue\r
477 5  Cyan\r
478 6  Magenta\r
479 7  White\r
480 8  Grey (transparent)\r
481 9  Grey (solid)\r
482 0  Black\r
483 \r
484 ==========================================\r
485 =Appendix C - Advanced Darkplaces shaders=\r
486 ==========================================\r
487 \r
488 Shader parameters for DP's own features:\r
489 - dp_reflect <distort> <r> <g> <b> <a>\r
490   Makes surfaces of this shader reflective with r_water. The reflection is\r
491   alpha blended on the texture with the given alpha, and modulated by the given\r
492   color. distort is used in conjunction with the normalmap to simulate a\r
493   nonplanar water surface.\r
494 - dp_refract <distort> <r> <g> <b>\r
495   Makes surfaces of this shader refractive with r_water. The refraction\r
496   replaces the transparency of the texture. distort is used in conjunction with\r
497   the normalmap to simulate a nonplanar water surface.\r
498 - dp_water <reflectmin> <reflectmax> <refractdistort> <reflectdistort> <refractr> <refractg> <refractb> <reflectr> <reflectg> <reflectb> <alpha>\r
499   This combines the effects of dp_reflect and dp_refract to simulate a water\r
500   surface. However, the refraction and the reflection are mixed using a Fresnel\r
501   equation that makes the amount of reflection slide from reflectmin when\r
502   looking parallel to the water to reflectmax when looking directly into the\r
503   water. The result of this reflection/refraction mix is then layered BELOW the\r
504   texture of the shader, so basically, it "fills up" the alpha values of the\r
505   water. The alpha value is a multiplicator for the alpha value on the texture\r
506   - set this to a small value like 0.1 to emphasize the reflection and make\r
507   the water transparent; but if r_water is 0, alpha isn't used, so the water can\r
508   be very visible then too.\r
509 \r