Table of Contents:
Getting Started
Lets jump right into it!.map files are XML, they have a top level container element map which has 6 container elements inside of it:
<?xml version="1.0" ?> <map> <description> </description> <credits> </credits> <turrets> </turrets> <waves> </waves> <paths> </paths> <restricted_areas> </restricted_areas> </map>This should be the skeleton for all new maps.
Now lets take a look at the first container element:
description
This is an element common to all of the XML description files found in Network Defense.<description> <name> AppleOrchard </name> <background> data/maps/AppleOrchard/AppleOrchard.png </background> <music> data/maps/AppleOrchard/AppleOrchard.ogg </music> <starting_money value=" (integer: 0 - 65,536) " /> <interest value=" (decimal) " /> <path_width value=" (decimal) " /> <loss_threshold value=" (integer) " /> <max_players value=" (integer 0 - 256 ) " /> </description>
- name: The name of the map that will be displayed in game
- background: The file path to the background image for the map. (should be reletive to the ND executable, no leading slash)
- Path should be reletive to the ND executable, no leading slash
- Image size should be 1024x640 (note that the top 20 pixels will be hidden)
- music: The file path to the music file to play during the map (ogg vorbis or wav) (should be reletive to the ND executable, no leading slash)
- starting_money: The ammount of money that the players will start with. This money will be distributed evenly among every player that is present at the start of the game.
- interest: The interest rate at which all players money will be compounded at the end of each creep wave.
- path_width: The width in pixels of the creep paths. This is to prevent players from building on the paths.
- loss_threshold: How many creeps are allowed to excape before the game is lost.
- max_players: The maximum number of players allowed to connect at one time.
credits
This is very simply to give your self credit for your creation!<credits> <author> Adam Brown </author> <version> v1.0 </version> <created> 18 APR 2009 </created> </credits>
- author: Your name
- version: What version of the map this is
- created: When you created the map
waves
The waves element MUST contain one or more wave element:<waves> <wave> <creep> data/common/creeps/Tank/Tank.creep </creep> <size> 10 </size> <interval> 2.0 </interval> </wave> <wave> <creep> data/common/creeps/CrashBot/CrashBot.creep </creep> <size> 20 </size> <interval> 1.0 </interval> </wave> </waves>Here you see two waves declared. Waves are always spawned in the order they are declared from top to bottom.
So lets take a look at the wave container and it's contents:
- creep: The file path to the .creep file which describes the creep to be used for this wave.
- size: How many of the specified creep to spawn during this wave
- interval: How often a new creep spawns during this wave (measured in seconds, thus 0.5 is half a second, 2.0 is 2 seconds)
paths
<paths> <path> <waypoint x="10.0" y="0.0" /> <waypoint x="10.0" y="640.0" /> </path> <path> <waypoint x="0.0" y="0.0" /> <waypoint x="512.0" y="640.0" /> <waypoint x="1024.0" y="0.0" /> </path> </paths>Here two paths are defined, a seperate copy of each creep wave will spawn on each path that is defined.
To attain these coordinates, you can go into your data/config.xml and enable:
<show_waypoints value="1" /> <show_cursor_coordinates value="1" />
restricted_areas
Restricted Areas defined areas on a map where players are not allowed to palce buildings. This can be for many reasons. Maybe to constrict an area of the map to make it more difficult, or simply because building on a certain feature of a game would look silly.Notice the display attribute in each restricted_area container element. This dictates whether or not the restricted are will draw as a red area when players go to build turrets. Generally this is a good idea to have it draw so it is clear to the players why they can not build there. But if it is graphically apparent anyway, such as a sky, then it's ok to not display it.
<restricted_areas> <restricted_area display="1" > <vertex x="0.0" y="0.0" /> <vertex x="0.0" y="64.0" /> <vertex x="64.0" y="64.0" /> <vertex x="64.0" y="0.0" /> </restricted_area> <restricted_area display="0" > <vertex x="64.0" y="0.0" /> <vertex x="64.0" y="64.0" /> <vertex x="128.0" y="64.0" /> <vertex x="128.0" y="0.0" /> </restricted_area> </restricted_areas>Here two boxes are defined. Note the order of the verticies, they are listed top to bottom in a counter clock wise order. THIS IS IMPORTAINT! Listing the points in any other order will result in the area not functioning correctly!
It's also importaint to note that the polygons *should* be convex. All though concave polygons will still restrict building properly, they will not draw properly, and will look all silly.
To get a better idea of how your restricted areas are represented in-game, you can go into your data/config.xml and enable:
<show_restricted_areas value="1" />
Well thats it for Map Creation! Now you should move onto Creep Creation.