Categories
Dev Log Programming

AI Behavior

By Yash Chamria

In Kick Some Bass, the player has to fight his way through a number of sea creatures. These fish need to have distinct behaviors for a unique experience with each fight. To achieve distinct opponents, these opponents have vastly different models, abilities and brains. This article will be focusing on the latter and involves the process of testing different AI methods to make our opponents intelligent. 

Different AI Techniques

Let’s talk about the popular and effective options to implement an AI. Behavior tree, State machine, Machine learning and Utility AI. 

We quickly opted behavior tree out as it would be really hard to come up with all the situations in a fight. Also, to have different 9*/8 behavior for different AI we will need a different tree, so this *option involved a lot of design work and careful thinking. 

Next was the state machine and it suffered from the same issues as the behavior tree. 

The third option is to use machine learning, though that involves extensive playtesting to collect player data, and all the abilities need to be implemented for testing. Since AI development was supposed to go in parallel, it started way before the concept of ability existed, which rolled out machine learning as an option.

Lastly, we had the UtilityAI which seemed like a perfect fit for the job. It lets you tweak the values and graphs and can easily produce vastly different behaviour with some value changes.

Implementing Utility AI

Utility AI implementation went through three major overhauls.

First implementation (graph heavy) – This version allowed the designer to create various graphs for different situations. For example if the player’s health is low it will allow the AI to choose from this specific behavior pool based on graph scores. Or if the player is doing a certain action it asks the AI to select from a series of actions based on the situation. After a while, we realized this approach involved a lot of designing and tweaking – the same problem we had with the behavior tree.

Second implementation (distance layers)

The second approach is to use distance and specify a limited series of actions within a range to limit the unnecessary parameters at play. For instance, no point in punching if the player is 50 meters away, but perhaps a stamina gain might be beneficial. This however created some gray areas when AI crossed the distance layers with contradicting actions(move back and then move ahead).

Third implementation (Brute force) – The current way goes over all the present and future possibilities(at least 5 steps ahead) and gives them a score based on a graph, this results in much more thoughtful prediction and less design work. The future implementation will involve optimizing the current approach.

Leave a Reply

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