top of page

Game AI

No doubt the biggest challenge for World's Bane is realistically simulating NPC Factions and Characters. The game generates random fantasy worlds which we then populate with different factions filled with characters of different races and classes. We want each faction to have its own distinct agenda and behavior that governs how their citizens would behave. At the same time, individual characters also have their own personal relationships and traits that may contrast with their faction's 'flavor'. We also have to consider that the actions that we allow our characters to do will also be the basis of how the player can meddle in their affairs. There has to be enough verbs in there to allow the player fun ways to interfere and cause chaos.

Balancing all of these and executing it properly given our limited time, manpower and budget is a colossal challenge for us. Although still a work in progress, I feel that we've finally found a setup that works well for us.

We have two different layers of AI in the game. The first one is the Faction Manager which instructs its citizens some tasks that it needs for the faction's overall agenda. The second one is the Character AI which handles what an individual character will do if the Faction Manager hasn't ordered him to do something.


We want different factions to behave differently. While I want some grey area in the game, I feel that World's Bane's premise needs clear-cut good and evil factions as it fits better with the game flavor that we want to achieve. We also want to differentiate between a major faction that may expand all over the region and a minor one which is already happy with its own single territory. So in our game, factions may spawn as either Good, Evil or Neutral in alignment and either Major or Minor in size. These attributes have major effects on a faction's behavior.

We have a Faction Manager for each of the faction in the generated world. Each Manager triggers only once per month and the day that it triggers is randomized. We implemented this to stagger the AI processing between different ticks. Once a Faction Manager is triggered, it will determine what it wants using a Weight System. There are several categories of 'needs' that a Faction Manager can choose from. These are:

  • Recruitment - obtain more citizens

  • Supply - produce or search for more Supply

  • Diplomacy - improve relationship with other factions

  • Inventory - produce or search for more Items

  • Subterfuge - underhanded tactics against disliked factions

  • Offense - send a party to attack an enemy's territory

  • Defense - prepare defensive actions

  • Expansion - occupy a new location

Once it has selected the category, it will then look for residents that are capable of performing actions towards achieving that goal. This is where a faction's alignment matters. An evil faction may be ok with instructing a citizen to reanimate a corpse for Recruitment but a good faction won't, even if it has a resident capable of doing so.

The Faction Manager will loop through this process several times per location that it owns. The instructed characters will then be forced to perform those actions within the month.

Canralk was instructed to steal someone's junk


Characters that did not receive any instructions from the Faction during the month will decide what to do based on their needs and relationships. This process also utilizes a Weight System. The main difference is that the categories of 'needs' of a character is more personal. These are:

  • Fullness Recovery - consume food

  • Tiredness Recovery - take rest

  • Social - meet up with other characters he has a relationship with

  • Save - help someone in danger

  • Offense - deal direct physical harm

  • Subterfuge - secretly weaken a personal enemy

  • Sabotage - undermine someone's planned action

  • Assistance - help with someone's planned action

  • Personal Empowerment - improve stats or level

There are additional actions that are added into the Character AI aside from fulfilling these needs. This includes actions related to item usage, travel, change of residence and other miscellaneous things.


Now that I'm fairly satisfied with the foundations of our game AI, it's time to take a look at how the player can manipulate these factions and characters. The first player intervention that we've implemented is the Share Intel action. This is a Diplomat's action which allows him to share information with any character. This is a two step process. First, obtain an Intel. Second, choose an NPC to share the Intel with.

An Intel is a piece of information about an event or activity that has recently occurred or is about to happen soon. Each event that takes place in the world is logged in the history of the characters and locations involved. The player can look through these logs and convert any of them into an Intel that stores all relevant data about the logged event. Furthermore, there are ways for the player to obtain knowledge about a character's upcoming plans and convert this into Intel as well.

Intel about the Abduction of Finarasi will be relevant to his friends and family

You can only obtain and use each Intel once so the player must be mindful of how best to use it. How does sharing Intel to a character affect him? It mostly depends on his relationship with the characters involved in the event. Let's say you have an Intel about an elf named Legolas who abducted a faery named Tinkerbell. If you share this Intel to Tinkerbell's friend Peter Pan, he will probably attempt to release Tinkerbell from captivity if he is capable of it. If not, he might ask someone capable to help him do it instead. Let's say you have an Intel about a goblin named Gollum who wants to steal a Ring from Peter Pan's town. If you share this Intel with Gollum's enemy Bilbo, he may decide to get there ahead of Gollum to sabotage his plans.

Perhaps the most exciting feature that we are about to implement soon is the Blackmail action of Instigators. This will also consume an Intel but the usage is starkly different from Share Intel. In Blackmail, you use salacious information you discovered about a character against him. By informing him of his own dirty deed, you can blackmail him into doing something for you! I look forward to sharing more about this feature once we have all of its details plotted out.



bottom of page