AS = Animation Script, the main goal of which is to provide the ability to create animated "states" and transitions between them. In general, the AS is an animation state graph.
The main structural elements of the AS are blocks and transitions. The former implement animation logic, the latter implement transition logic.
One of the main advantages of the AS is its flexibility and the ability to configure animation logic of arbitrarily complexity. You could play a motion targeted at specified bones or bone parts, add a shift delta to an already finished animation, blend several animations with specified weight ratios, and make conditional animation transitions. All of these abilities are easily provided by the AS while being practically impossible to achieve with the VS.
Linking the AS and logic
In addition, AS provides communication with logic and can act as a synchronizer of sorts. This is handled by an "event" and "signal". The events can only be found within motions and are sent out when the motion reaches the frame which the event is associated with. The signals only appear within some blocks (signal blender, signal motion) while transitions can be used to synchronize states between motions and logic (VS, code).
Blocks
Logically, all AS blocks perform the following tasks:
- Data provision (empty/delta, empty/not_delta, the entirety of the source folder).
- Data processing and filtering (blender, filter, etc.).
- Transitions between states (transition, etc.).
- Creating structure and hierarchy (state, etc.).
Requests
The main "call action" in the AS is the request. It can be sent from a VS ("request" or "npc state") or from a code. The request finds a transition with the specified request (the first one it finds, ignoring the rest, except for those that are in detached states) and requests a corresponding transition from the AS. To make this happen, the AS plots a path from the current state to the desired transition. If there is no path available, then the request execution stops (conditionally). If several paths are found, the lowest weight path is used (all transitions have the "weight" field).
States
The entire AS is contained within state blocks or simple states. They encapsulate logic, allowing for the logical separation of the AS, creating transitions between states with several potential internal states.
There are several types of states, regular and detached. They differ in how they work with requests – the AS stops searching for a target for the request, if it encounters a transition in a regular state (assuming that this is the main AS branch). If the AS encounters the request in a detached state, it is executed but the search does not stop (assuming that this is a side AS branch).