Friday, December 7, 2007

Its all about the content

Up to now, I have been running my little test games with just one type of star ship and one type of weapon to make sure that the game engine is working the way I want it to. But now I am ready to start creating an assortment of ships and weapons and defensive systems, etc. This is what I think of as the "content" of the game. The engine that processes the turns (ships moving, weapons firing, things exploding) doesn't care at all about what the objects are that it is working with. It simply reads xml files that define what weapons and engines a given ship type has, and from that it can figure out how fast it can move and when it can fire its weapons, etc.

So I am writing a bunch of little xml files like this to define a ship:

<ShipType>
<TypeID>1000</TypeID>
<Name>Columbia class Destroyer</Name>
<Abbreviation>CCD</Abbreviation>
<Mass>110000</Mass> <!--mass in kg-->
<Length>42</Length> <!--length in meters-->
<HitPoints>250</HitPoints> <!--hitpoints of hull-->
<SubSystems>
<Reactor ReactorTypeID="1000"/>
<Engine EngineTypeID="1000"/>
<Weapon WeaponTypeID="1000"/><Weapon WeaponTypeID="1001"/>
<Sensors SensorTypeID="1000"/><LifeSupport LifeSupportID="1000"/>
</SubSystems>

<!--drawing instructions: MoveTo(x,y):LineTo(x,y)-->
<Geometry>M,0,-10:L,5,5:L,0,0:L,-5,5:L,0,-10</Geometry>
</ShipType>

You can see that this small ship has one engine and two weapons. The specifications of the engines and weapons are defined in other XML files. This way, it should be easy to make new ship types or tweak existing ones for balance.

The "geometry" section is drawing instructions for the client. This is so each ship class will look a little different so you can tell them apart visually. Right now, I am just going to use simple line drawing graphics, but maybe in the future I will add some actual artwork. (I am no artist!)

No comments: