Advertisement Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

WFG for teh win!

Sign in to follow this  


Right so, the powers that be gave me permission to do some theory stuff regarding what I'm working on over at Wildfire Games. The project is called 0 AD, and is a RTS game based on civilizations from 500 BC to 500 AD. You can check it out at teh website, or check out some very awesome screenies at teh screenie viewor!!1.

Moving on, our entity system, ground up.

Our base system consists of an extremely stripped down engine (known as Pyrogenesis) that brings in all the game data through .xml and our javascript code. This is done to make the game heavily data driven, so everyone and their dog can build on top of it without modifying base code. The javascript portion is handled through Mozilla's SpiderMonkey (an excellent library I might add), and the XML is parsed through what I believe to be a proprietary parsing system. I could be wrong on that one.

Anyway, we handle game entities as such. First, there are three master entity types - Gaia, Structure, and Unit. Gaia is just that...earthy things. Flora and fauna if you will. Structures are your building entities and their defensive values - this includes walls, towers, civic centers, etc. Buildings can be destroyed (or rebuilt), and hence, have defensive (and in garrisoning buildings, a =+ effect on offensive abilities) properties. Unit entities are basically anything that belongs to a player that is not a building. Ships, special units, basic infantry and calvary, etc.

The XML system works under a heirarchical tree structure. Because the unit entity type is the largest, I'll use it for example.

It starts with template_unit.xml. This is the base XML file that all units, fat skinny big and small, inheret their properties from. This is an extremely general 'guess' of what the 'base' unit would be, just for redundancy sake. Then, the tree moves into seven branches, _calvary, _special, _fauna, _mechanical, _super, _support, and _infantry. The not-so-obvious ones are _support, _super, and _fauna. Support are healer units, workers, etc. Supers are certain 'special' units (known as heroes), that have some insane fighting abilities and stats. Fauna are things like sheep and deer and stuff. Sometimes gaia's fauna can get a little shaky shaky, and hence can have attack and definsive capabilites (those sheep are nasty).

Anyway, these seven categories break off into about a million different ones, based on ranged or sword/spear attacks, the type of mech unit (seige units, ships, etc), and various other properties. These are template units, so they all are just base values that really mean little in the game - the individual civs will have their own heirarchy of XML files that are loaded in. The whole data-driven thing.

Because of this parent-child style system, no entity in the game will have no properties, and hence, won't just appear and then die or something similar. Entities are only creatable in the map/scenario editor if they are a valid XML file, so no tricky funky-magic-entity nonsense would be going on.

While not too technical, that's a general overview of how the entity system is based. It's pretty straightforward (like most RTS games) - nothing too hard, and therefore easy for click-click users to get used to and handle (in the case of modmaking). In a later post I think I'm gonna get some more programmer-oriented stuff up, possibly something about SpiderMonkey and it's ensuing..uh..stuff.

Adeiu, and apologies if that was a winded waste of time.
Sign in to follow this  


Recommended Comments

Thats a pretty cool system, thanks for sharing! It's always interesting to see how other people code their stuff.

Share this comment

Link to comment
Guest Anonymous Poster


Cool, thanks for the info. Sounds like a solid and tunable system.

Really looking forward to the next section if you bring up javascript specifics!

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!