Skip to content

Fighting Units

Today the game got to the point where units actually are fighting against each other. But since there no visual effects for the attacks (animation, particles etc.) or even sound, I added simple health status bars so I can see what happens.

Further more all types of units can now be defined through XML files, which allows for very flexible management of all the different unit types and of course easy adjustments. For example, the tank that can be seen on the screenshot is defined as follows:

<?xml version="1.0" encoding="utf-8"?>
<UnitType xmlns:xsi="" xmlns:xsd="">
<Description>Ein futuristischer Panzer mit zwei Kanonen</Description>
<Behavior xsi:type="AggressorUnitBehavior" />

Thanks to the Serialization API of C# loading and storing unit types that way is as easy as pie.
The ModelName simply refers to an asset of the standard content project. The armor and attack types are simply to enums. Only the behavior can refer to a whole new class, which defines the behavior of the unit. Basically it’s the AI implementation which thinks for the unit and makes it move, attack and so on.
The game does also already support abilities, even though right now there is only one ability defined, which is the spawn ability to spawn new units. The building which spawns the tanks, for example, is defined as follows:
<?xml version="1.0" encoding="utf-8"?>
<UnitType xmlns:xsi="" xmlns:xsd="">
  <Description>Fabrik zur Herstellung von Panzern</Description>
    <Ability xsi:type="SpawnAbility">
  <Behavior xsi:type="SpawnBuildingBehavior" />

There in the abilities collection is the only ability of type SpawnAbility defined with a cooldown of 15 seconds. The name is purely for in-game info later on. The spawn unit name refers to any unit that was defined through XML.

With these capabilities I can easily extend the game with more units and buildings at any point without touching any code, which makes it a lot more comfortable.

I’m positive that within the next weeks the first playable version, even though very limited, will be done.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: