Making Games Article 04/2014
Making Games Article 04/2014 (PDF)
Book version (Amazon)
“Decision-Making in a Group of Artificial Intelligences in Different Simulated Environments” is the title of my bachelor’s thesis. It has been done at Chasing Carrots and its practical part is used in the game Cosmonautica.
Natural behavior of a single artificial intelligence or even entire groups is a great challenge but also necessary for the immersion in video games. The object of this bachelor thesis is to find and implement the best technique for natural artificial intelligence behavior in “Cosmonautica”, Chasing Carrots’ next game.
The well-known finite state machines and the more sophisticated hierarchical finite state machines are simple but can hardly be re-used. Goal-oriented behavior (GOB) shines when used for planning a sequence of actions in the goal-oriented action planning technique. The utility functions used in GOB are relatively simple and useful for comparing many options. Another considered technique is fuzzy logic, which uses so-called degrees of memberships to represent the states of game objects. These memberships are well suited for perceptions like feeling cold or endangered. Rule-based systems can become complicated but support fine-grained behaviors. Behavior trees work with a tree structure and several node types to decide which actions are triggered. They are very flexible and can be modified very fast to be used in completely different situations.
The comparison of the different decision-making techniques shows that behavior trees combined with utility functions are the best choice for “Cosmonautica” due to their overall composition of power, performance, complexity, re-usability, and maintainability.
Now, behavior trees are used in “Cosmonautica” to control the behavior of crewmembers in the player’s space ship as well as the enemy ships in space fights. They determine e.g. in which situations the crew members work or when a need has to be satisfied. Utility functions are used to compare all possible actions to decide which work task or activity needs to be done.
This combination of behavior trees and utility functions has proved to be an easy and powerful way to control the behavior of artificial intelligences. Because of its qualities, it can and should replace many state machines in object-oriented programs.