Diving in – Introducing the concept of Entities and Tags


One of the core concepts that will power the game is the creation of entities and tags.

This is actually the second iteration of the game. Initially I was adding classes for each ‘entity’ I.e I was making a class for ‘Infantry’ in the code. This is great and all assuming that you know what your game will be but I have currently no idea – ‘Infantry’ in fact is just a placeholder. As mentioned in my first post I have decided to go with the concept of more of an engine than a finished game per-say. Therefore I have scrapped that hard coded concept of each entity and came up with essentially a configuration file which defines how each Entity behaves.

To clear up any confusion, I will give a quick definition of an entity in relations to this game:

Entity: Every single gameplay item that a player will interact with during the core game loop will be an entity. Each map/stage will be filled with such entities where their look and behaviour are defined by the given configuration. Entities can be directly player intractable e.g units, buildings; or can be more passive or cosmetic e.g terrain, signs etc.

The configuration which will define all properties of an entity will be defined in a json (text with structure) file. I have also considered the concept of having default values for the configuration. For example, if you wanted to define a tank and an infantry unit, there may be common configuration between the two I.e can move, cant fly, cant produce other units etc. Intruducing therefore the concept of the Tag:

Tag: A tag defines certain entity properties without being an entity itself. Each entity can be given one or more tags which when the game initialises, will pull the tag values into each tagged entity as its defaults, being overwritten by any values given on the entity itself.

For example, imagine having the following tags with properties:

  • Units: Can move and attack, Can be attacked
  • IndirectUnit: Cannot move and attack

With the following defined entities:

  • Infantry: Tags: <Units>, Range 1
  • Artillery: Tags: <Units, IndirectUnit>, Range 2

Results in:

  • Infantry: Can move and attack, Can be attacked, Range 1
  • Artillery: Cannot move and attack, Can be attacked, Range 2

As you can see, each final entity can have much less configuration as it can be built up from tags of similarly grouped sub-configuration

Of course with a very well documented configuration, hopefully this will lead to a usable system where one can define any iteration of the game that you can imagine.


Leave a Reply

Your email address will not be published. Required fields are marked *