See also: MakeNewCreature

Overview

Because there are so many ways for creatures to interact, there are many different boards that could demonstrate those interactions.

While you can make a developer test board by tweaking the CreateTest() method in "Tank\Tank.Test\Tank.Core\Level.cs", release versions will need the boards in an Xml file format. Ultimately I hope to create an online board editor so that anyone can easily make new boards, but for now, there's only the xml files.

Xml Files

Each Xml file has a name of the form "<masterIndex>.xml", where masterIndex is a unique integer that indexes that level. Each file contains:
  • The header:
    • index - masterIndex - the user never sees this.
    • subLevel - a user-friendly level, like "1.2"
    • allowedTimeMinutes - how many minutes to complete the level?
    • title - the title for the level
  • Message - an opening message to describe the level
  • Board - a 16x10 CSV list of integers. Each int corresponds to a block ID. Currently there are only a few blocks, listed in method "GetBlockImageName()" of "Tank\Tank.Test\Tank.Core\Board.cs"
  • Creatures - a list of creatures. Each Creature node has:
    • type - the .Net type
    • boardPosition - the position on the board (usually x=0-15 and y=0-9). Decimals values are allowed. So, (5.5,7.2) is ok.
    • team - the team that this belongs to (Hero, Neutral, or Enemy1). Most neutral objects are implied.
    • value - an additional attribute to define etxra info for that creature. For example, the message in a signpost. This gets set via CreatureBase.LoadFromXmlValue()
    • treasure - a 'treasure' that this leaves behind when destroyed - such as a powerup

A simple xml file looks like so:
<?xml version="1.0" encoding="utf-8" ?>
<Level>
  <Header index="2" subLevel="1.2" allowedTimeMinutes="15" title="Tutorial: Attacking Units"></Header>
  <Message>Some opening message to describe the level</Message>
  <Board>
    1,1,1,1,1,1,1,1,1,1,3,3,1,1,1,1,
    0,0,0,0,0,0,0,0,1,1,3,3,1,1,0,0,
    0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,
    0,0,0,0,0,1,1,1,1,1,3,3,1,2,0,0,
    0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,
    0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,
    0,0,0,0,0,1,1,1,1,1,3,3,1,2,2,2,
    0,0,0,0,0,0,0,0,3,3,3,3,2,2,2,2,
    0,0,0,0,0,0,0,0,3,3,3,3,2,2,2,2
  </Board>
  <Creatures>
    <Creature type="TankUnit" boardPosition="1.5, 3" team="Hero" />
    <Creature type="Sign" boardPosition=".2, 4.5" team="Neutral" value="Here is a special message." />
    <Creature type="PushButtonStayDown" boardPosition="14, 8" team="Neutral" />
    <Creature type="SpecialEffect" boardPosition="14, 8" />
    <Creature type="TankUnitEnemy" boardPosition="13, 5.5" team="Enemy1" treasure="PowerUpThrust" />
  </Creatures>
</Level>


Loading that xml file into the engine

The easiest way is to just override an existing xml file.

However, you can add new levels:

Once you've created an xml file, you can load it into the engine with a few steps:
  1. Ensure that it has a unique masterIndex (both fileName, and header.index property in the xml)
  2. Put the file in the directory: "Tank\Tank.Gui\Levels"
  3. Modify "Tank\Tank.Gui\Levels\LevelNames.cs". This is used to specify the SelectLevel dropdown.
  4. Modify "Tank\Tank.Test\Tank.Core\Level.cs", set MaxLevelCount to the new value.

Last edited Nov 17, 2007 at 12:49 PM by timstall, version 3

Comments

No comments yet.