Beetmash
Docs > Beet > Overview > Concepts

Concepts

Behaviors

A behavior is an entity that responds to an OnRun observer, and will at some point trigger OnRunResult.

Behaviors can be organized into a hierarchy using the same Parent/Children mechanism as transforms.

Control Flow

Control flow is directed using observers and can be triggered in one of a handful of scopes.

Common Observers
NameScopeDescription
OnRunLocalIndicate this behavior should start running
OnRunResultLocalIndicate this behavior has finished
OnChildRunResultParentA ‘bubble up’ mechanism that is triggered on parents of children who triggered OnRunResult
OnAppReadyGlobalAll assets are loaded, used for delaying initial execution
The Running Component

Often behaviors are designed to continue running for some period of time. This is handled by the Running component which is added OnRun and removed OnRunResult.

Request / Response

Sometimes actions need to request information in order to determine where to direct control flow, see the Utility AI Guide for an example.

Actions

Actions are components with associated functionality. Their roles vary from directing control flow to making changes to an agent like updating its Transform.

For the purpose of modularity actions are usually very simple, for example Translate and TriggerInDuration<RunResult> could be added to a single entity to create a Translate For Duration behavior.

Common Actions
NameInputsOutputsDescription
EndOnRunOnRunOnRunResultListens for OnRun and immediately triggers OnRunResult
RunOnAppReadyOnAppReadyOnRunListen for OnAppReady and immediately triggers OnRun
RunTimerRunningRunTimerTicks a timer during a continued run
TriggerInDuration<T>RunTimerTTriggers T after a Duration