In this research log, we’ll explain to you how the Artificial Intelligence system of Bio Colonies is going to work. It’s not anything too intriguing – no machine learning or anything like that! I mean, it’s for a game, right?
Artificial Intelligence in Bio Colonies
Our Artificial Intelligence system is basically a State Machine: Several observable and scripted factors result in the current outcome.
The AI has several pre-defined action-strains. It decides which one to take based on a scripted Priority and an Importance based on the environment.
These strains range from finding resources over building a microbe-production to attacking the opponent(s). What all of those have in common, is that they can, and have to, be broken down into much smaller steps:
Building a cell then leads to:
- check for empty space
- place the blueprint
- send resources and work to build it
As you might have already realized, there’s going to be a lot of steps and a lot of them are the same. Therefore, we came up with a hierarchy that can manage it:
Brains and Actions
This system will allow for all of that. Above all, the Master Brain is the head of the execution and tracks which of its children is currently active.
Similar to the Master Brain, each Decision Brain chooses the most fitting one of its children.
This goes down all the way until we arrive at the Action Brains. It’s their sole responsibility is to return the next entry in its scripted list of Actions.
As a result, any Action is the smallest-possible step a large strain can be broken into. In the case of the check for empty space, this could be a loop over a number of (probably random) positions and check whether the entity can be spawned there.
The decision which brain is the most important one at the time executes every few seconds. It’ll go thru all Brains using a reversed breadth-first algorithm. (It basically start at the smallest children and go up, remembering only the most fitting child). Once all Actions have finished, it just starts the next fitting one. If an Action is still in progress, but another brain got priority (like when the base is being attacked), this Action will be interrupted and continued when the interrupt has finished!
Currently, both the framework and logic have been implemented. However, we’ll start with the implementation into the Scenario of the Demo Version once the Scenario itself is completed.
Join back next week and follow us on Twitter for more details!