Our game is based around the concept of modifying the normally
static game components in real-time. This gives us a natural in-game
editor during any of the various gameplay modes. The most customization
for the worlds can be done through the XML files for maps. The xml file
contains various properties that the player can modify. The general layout
is as follows:
<level name="Default"> <terrain scale="8" heightmap="GameObjects/HeightMaps/Wind Level" textureLow="_textures/Wind Level Texture" textureMid="_textures/firetexture" textureHigh="_textures/BoulderTexture" textureSlope="_textures/Granite" textureBump="_textures/Wind Level Texture_bump" /> <sky texture="_textures/skyTex"/> <players> <player id="0" startx="100" startz="50"/> <player id="1" startx="300" startz="50"/> <player id="2" startx="50" startz="100"/> <player id="3" startx="50" startz="300"/> </players> <props> <prop type="axe" scale="0.1" x="400" y="1000" z="400"/> <prop type="tree" locationMap="_textures/treeMap"> <tree red ="255" green="0" blue="0" model="_models/tree1Earth" texture="_models/tree1EarthTex" maxScale="50" mass="1000"/> <tree red ="0" green="255" blue="0" model="_models/tree2Earth" texture="_models/tree2EarthTex" maxScale="50" mass="1000"/> <tree red ="0" green="0" blue="255" model="_models/tree3Earth" texture="_models/tree3EarthTex" maxScale="50" mass="1000"/> <tree red ="255" green="255" blue="255" model="_models/tree" texture="_models/file1" maxScale="10" mass="1000"/> </prop> <prop type="rock" locationMap="_textures/rockMap"> <rock red ="255" green="0" blue="0" model="_models/boulder1Earth" texture="_models/boulder1EarthTX" maxScale="500" mass="20"/> <rock red ="0" green="255" blue="0" model="_models/boulder2Earth" texture="_models/boulder2EarthTX" maxScale="500" mass="20"/> <rock red ="0" green="0" blue="255" model="_models/boulder3Earth" texture="_models/boulder3EarthTX" maxScale="500" mass="20"/> </prop> </props> <physics gravity="-480" friction="0.003"/> </level>
This format allows us to modify an existing level without even touching the code. Creating new levels however is not so easy. Since are not searching the directory for new levels, an existing xml file must be replaced with a new one. It will work even if the level name does not match the xml filename. Eventually in a later cycle, we would like to add the ability to save the heightmap after a match is finished. This will allow for in-game terrain editing.