BaseSteeringSystem
BaseSteeringSystem is a base class inheriting from SystemBase, which can be inherited to create a steering system. It is configurable by SteeringSystemAsset, which can be edited through the editor. The asset contains definition of which jobs, using which queries, to run. The base class is responsible for scheduling these jobs and queries and passing data between them.
Usage
To create a new steering system, inherit from BaseSteeringSystem and override the getAssetReferenceName() method to return the addressable path to the SteeringSystemAsset to use.
using SteeringAI.Core;
using Unity.Entities;
[UpdateInGroup(typeof(SteeringSystemsGroup))]
public partial class SampleSteeringSystem : BaseSteeringSystem
{
protected override string getAssetReferenceName()
{
return "Path/To/SteeringSystemAsset.asset";
}
}
What It Does
The image below illustrates what BaseSteeringSystem does internally.
-
First entities with the same Main Tag are queried with an Entity Query. Information from these entities is extracted into
BaseBehaviorParams. -
This is passed to all Simple-, Neighbor-, Raycast Behaviors. All Simple Behaviors are simply ran in parallel and their results passed into the Merger. For Neighbor Behaviors and Raycast Behaviors there are additional Queries done first. These behaviors are grouped by the additional queries.
-
After the Merger receives results from all behaviors, it merges them into a single result for each entity, which can later be used by any Move System.
In the defaults library, all behaviors return VelocityResult and a merger turns it into a DesiredVelocityComponent. It is however possible to create your own workflows. This is defined through the implementation of merger.
Diagram illustrating how the jobs and queries are scheduled, synchronized and how data is passed between them.