When the Rules Break You: Expert Systems

Moving on from Finite State Machines from last week, I’ll now be having a look at Rule Based (also known as Expert) systems. They are quite unlike FSM’s in many ways, most strikingly in their ease of implementation. This means that despite their potential to emulate much more complex behaviours than their counterparts it is not widely used in game development.

The core of an expert system is its database of rules. These can be made by taking the target behaviour and reducing it to its base components. These rules are then used as the systems “memory”. Then a set of if statements unusually called the Arbiter determines which rules will be called. If more than one rule suits then it’s up to the developer to use a way to determine which should happen with several different methods like every rule having a priority or even them being random.

The major advantage with the system is that if a situation occurs in game that was not predicted by the developers the existing rules, if comprehensive enough, would enable the NPC or system to react appropriately. The rules, if simple enough, can be used in a variety of cases making it into a modular friendly system.

However as mentioned previously they can be difficulty to implement compared to traditional state machines especially when the target behaviour is complex as the number of rules required to achieve good results grows accordingly. Different techniques might be able to handle that in an easier fashion.

What follows is a simple example of an expert system.


Alchemist (Health 0 (dying)) Mana 5)

Warrior (Health 20 (Armor 3)) (Mana 2)

Healer (Health 12 (Mana 12)

Known Rules:

Attack Enemy

Throw Firebomb

Heal Ally or Self

Rule based systems are one of the most sophisticated non-learning AI techniques and would be a great choice for strategy or turn based games however usually are replaced by FSM’s or other techniques as they are development cost heavy.


Champanard, A. J. (2004). AI Game Development: Synthetic Creatures with Learning and Reactive Behaviors

Available from: