1. Home
  2. Docs
  3. Getting Started
  4. Designing AI

Designing AI

VisAI uses a unique design theory inspired by popular theories such as GOAP, Behaviour Tree, and State Machines. Designing your AI is straightforward. Your AI will think similar to how a person would in a specific situation (like the one they are experiencing in your game)

AI built with the framework can be broken down into three core pieces: 

  • Behaviour
  • Decision
  • 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 thinks.

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

While creating your AI, you’ll have access to an AI Toolkit that provides you with different AI systems, tools, and features designed to enhance your development experience. You can use these systems while creating decisions, actions, and more. Be sure to take a quick look before you begin!

You can learn more about each system individually by visiting the AI System page. To learn about extending or modifying an AI system, check out the Modifying the Framework page.

VisAI uses a structure that’s designed to work with virtually any AI type. It provides a straightforward and comprehensible way to design your AI. Entire AI designs can be built easily, even by those without any AI experience. You’ll use a structure of BehavioursGoals, and Plans to design your AI. 

Behaviours are what the AI is, or does. As an example, an AI Behaviour could be “Cook”, “Ranged Enemy”, or something else that fits your game better. When creating Behaviours, ask yourself “What defines the AI as a whole?”

Behaviour allows you to change large parts of how your AI functions at runtime with minimal overhead. It also allows you to organize AI functionality into comprehensive “boxes”

Goals define what the AI wants. As an example, an AI might want to Find Enemies, Purchase a house when it has enough money, Cook a Meal, or anything else you can conceptualize. When creating Goals, ask yourself “What does this AI want or need?” 

Goals allow you to give your AI a scope within the game environment. Something to put their focus on. 

Plans define how the AI could get what it wants, general requirements of the goal, or just different ways to achieve a goal. As an example, a Ranged AI might have plans such as “Tactical Attack” or “Simple Attack”, where a Cook AI might have the plans “Gather Ingredients” or “Cook Ingredients”. 

Plans can be used in any way that makes sense for your AI and it’s Behaviours/Goals. You’ll find more and better ways to use plans as you create with the framework. 

Regardless of the type of AI you’re building, the structure ends up looking something like this:

You can use a tool such as SimpleMind to create entire AI designs with this structure. Once you’ve decided on your Behaviour structure, you can move onto Decisions. 

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 similar. Be sure to optimize your code by using local and/or static variables in decisions. 

With VisAI, Behaviour defines what’s possible for the AI, and Decisions are handling what the AI should be doing. All that’s left, is actually doing it; that’s where Actions come in. 

Actions are essentially just Behaviour Tree Tasks, designed to be straightforward. They are run in order from left to right, and are encapsulated within a Plan. Some Plans may have many Actions, some may only have one. It’s up to the designer! 

As an Example:

For an advanced Plan such as “Tactical Attack”, you might have the Actions “Find Nearby Vantage Point”, “Fire Weapon”, “Throw Grenade”, “Use Ability”, or something else more fitting. 

Actions provide you an easy way to define how an AI can complete a plan. Use them in cohesion with Decisions. For example, “Find Nearby Vantage Point” needs to be successful, so you would want to incorporate a check for nearby vantage points in the decision to ensure the Action is successful. 

Next Steps

Understanding an entirely new system is hard, especially when there is a lot to offer. Don’t fret! The initial curve is the hardest, and most learn the key features of the framework after their first or second attempt creating AI.

If you’ve got your design ready, or are just ready to look at the next steps, visit the Creating AI Page here. 

Articles

How can we help?