The Behavior module allows to easily create and manage all your game's intelligent agents using a wide variety of industry-standard tools:
Choosing one or another is a matter of preference and what makes more sense. It's a the right tool for the job kind-of situation where there's not one definitive answer.
This documentation goes over them in detail from the most basic to the most complex systems.
The Behavior module is an extension of Game Creator 2 and won't work without it
The Processor component is responsible for executing the logic of any of the aforementioned AI systems and can be added to any game object in the scene, not just characters.
This component has a Graph field which accepts a State Machine, Behavior Tree, Action Plan or Utility Board graph asset.
The Loop option determines whether the graph should be ran once or start over when it finishes executing.
The Update option determines whether the graph is executed every frame, manually via a script or at a custom interval, which can be specified using a dynamic property.
Whenever a graph is added it collects all the Blackboard parameters and displays them as fields, which can be dragged and dropped or set via visual scripting.
Display using a Parameter
If we create a parameter called
my-target on a Blackboard and assign this graph onto a Processor component, it will display like in the screenshot below so its value can be assigned.
Parameters can be changed at runtime but a Processor's graph cannot be changed when in play-mode.
All AI systems included in the Behavior module use a similar graph window with some common elements.
The top toolbar's left side contains a button that allows to focus on the currently selected element(s) on the view as well as toggle the grid-mode. On the right side there's a collection of toggles that allow to show and hide other sections of the window.
The bottom toolbar tracks which graphs have been opened so you can quickly go back to editing a parent graph.
The breadcrumb toolbar will automatically be displayed whenever you edit a sub-graph asset from a parent graph asset.
It's a collection of parameters with a name and a type that allow to interface between the agent running the AI system and the graph itself.
Let's say we have an AI system that requires guards to patrol an area, each having their own route. We can create a Blackboard entry called
patrol-route and change its type to Game Object. By doing so, every guard that uses this AI system will have a Patrol Route field that can be used to define its individual route.
To create a new entry simply type in the name and press Enter or click the
By default a parameter doesn't have any type and thus won't appear in the Processor component. To change its type click on the icon and select it from the dropdown.
After creating or editing a parameter of a Blackboard you'll need to refresh the Processors using this graph so the parameters are re-sync.
The Inspector panel allows to edit any nodes created inside the graph.
To edit a node simply select it and open the Inspector panel if it isn't already. Each node type will have its own configuration options.
After assigning an AI system to a Processor component it will display all available parameters from the Blackboard at the bottom of the component.
These values can be set by dragging and dropping values from the scene or the project panel or using Game Creator's Visual Scripting.
For example, let's say there's a parameter called
energy and we can to subtract 1 unit from it every second. We can create a Trigger component with an Interval value of 1 second, and use the Subtract Numbers instruction.
We assume it's the Player who has the Processor component, so we use it as the targeted game object and as the name of the parameter we use
Each Property dropdown will have a
Behavior/ section with the corresponding parameter value.