The Behaviour Foundation

⌘K
  1. Home
  2. Docs
  3. The Behaviour Foundation
  4. Decision

Decision

VisAI splits AI functionality into 3 core pieces. BehaviourDecision, and Action

Behaviours are the Structure of an AI, giving you a comprehensive way to plan dynamic AI behaviour. 

Decisions are the Thought of the AI, giving you complete control over the way your AI plans its next move.

Actions are the Instructions for the AI, giving you a straightforward way to bring life to your AI. 

On this page, we’ll be focusing on Decision, the Thought. Let’s get started!

Decisions are the thought of the AI. They give you the ability to determine what the AI should be doing in a very straightforward and powerful way.

Though there are different ways to design decisions, you’ll likely be using Priority Score’s and Influence.

When creating Decisions, you’ll create a function that returns a Priority Score, which determines how important a Behaviour, Goal, or Plan is to the AI. This gives the AI an idea of what’s most important to it at any given time. 

Influence is how you’ll determine a Priority Score. You’ll check data available to the AI, and based on your findings, will Influence the Priority Score to a high or low score. 

Example 1: 

Say you wanted to build an AI that would run away and look for health when it was damaged to a certain degree. The Decision would check the AI’s health, and if low, would Influence the Decision to have a higher Priority Score. If not, it would Influence the Decision to have a lower Priority Score.

Example 2:

Say you wanted an AI to follow a schedule. The Decision to do something would be as simple as checking the time, and determining if it was within a set range. If it was within the desired range, the decision would Influence the Priority Score to be higher. If not, it would Influence the Decision to have a lower Priority Score.

Modern Decision Making

The key to decision making with VisAI is using your imagination, and the data available to you. How would you make a decision for the Behaviour/Goal/Plan you’re making? Your AI decision will likely think similarly. Be sure to optimize your code by using local and/or static variables in decisions. 

Creating Decisions is as easy as creating a decision function, and referencing it with your AI. Reference back to the Designing AI page if you need help designing your decisions.

Let’s get started!

Decision Function

Decision functions have a few pieces to them. 

Score Input – The Score Input allows you to custom define a score for the decision. Most commonly, this is used as the score when the decision wants to score high.

Score Output – The Score Output is what will be processed by your AI to determine what Behaviour, Goal, and Plan should be running. The highest score of all B/G/P’s will be chosen. 

  1. Navigate to the desired AI controller. You’ll also want to open up the parent AI controller for the subsystem, where you’ll find template decisions for a Behaviour, Goal, and Plan. 
  2. Use the template to create your own decision in the Parent or Child AI Controller. 
  3. (optional) Use the input to allow you to change what score is returned when the decision has high probability
  4. Provide the Score Output, which includes a score and the name of the B/G/P for the Decision.
  5. That’s it!

Remember you can change the score of a decision in runtime by checking outside factors, aka Influence as mentioned in the Designing AI page. 

Decision Reference

When you’ve created all your decision functions, you’ll need to make sure your AI is using them by adding them to the “Retrieve Behaviour/Goal/Plan Decisions” function in your child AI controller. It’s as simple as making an array of all Behaviour, Goal, or Plan decisions, then providing it to the function return. 

When you’re done, each “Retrieve” function will look similar to this, containing all the B/G/P decisions for your AI. Use the Score input to determine 

Once you’ve placed your functions, make sure to assign a “Score” value to each of the decisions. Decisions that are higher priority should score higher 

Now that you’ve created your decisions, the last step is to create the Action for your AI!

Next Steps

Once you’ve completed your Decisions, the last step is implementing Actions. You can learn more about Action on the Action page here

Check out the Designing AI page to get more information on how Behaviour, Decision, and Action work as a whole. 

Articles

How can we help?