Skip to end of metadata
Go to start of metadata



The SmartObject system is used to create general and level specific behaviors. The term SmartObject describes an object that is set up to interact with one or more other objects in the game.

Specific rules can be created that define which object will interact with which other object. These rules are based on the class and state of an object and apply to all objects in the game completely independent from the object model or the level the object is placed in.

The SmartObject system can be used for:

  • Creating puzzles.
  • Creating automatic doors, traps, and other devices.
  • Creating background behaviors for a level such as moving things, machines, etc.
  • Controlling AI behavior.
  • Adding 'scripted' AI moments to the level.
  • Setting up special navigational spots in the level.
  • SmartObject rules are not stored within the .cry file of the level, but in a separate XML file.

The Smart Objects Editor

The Smart Objects Editor is integrated into Sandbox and can be opened from the "View/Open View Pane" menu. This is the tool that is used to create and edit all rules.

The UI of the Editor is split into four parts:

1. Rules Tree

This window provides an overview about all existing SmartObject rules. The explorer-like display helps organizing your rule sets.

2. Rule Details

The details of a SmartObject rule can be viewed in this window. While the lower part of the window shows a description of the selected rule, the upper window part provides an overview over all rules in the currently selected folder.

Rules can be moved between the different folders by dragging and dropping them to the desired place. Greyed out rules are currently deactivated.

Rules can be sorted by clicking on the buttons on the top of each column. To hide or add columns, right-click on the buttons and select the desired column.

3. Rule Properties

The Properties window contains all settings that can be made for a rule. The settings made in this window determine which action will be executed and whether the rule is valid or not.

NameThe name of the SmartObject rule can be entered here.
DescriptionThe description of the SmartObject rule can be entered here. This description will be shown in lower part of the rule overview window. Make sure all the rules you create have a thorough description.
LocationThe location is the name of the folder the rule is placed in. Subfolders can be created using '\'. Entering 'Test' for example will place the rule in a folder named 'Test', entering 'Test/MoreTest' will place the rule in the folder 'MoreTest' in the 'Test' folder. The location of a rule can always be changed later if reorganization should become necessary. There are two ways to move a rule from one folder to another. The first is changing the location string, and the second is to drag and drop the rule from the rule details window to the desired folder in the rule overview window.
EnabledIf this check box is unset, the according rule will not be applied. As a default new rules are not enabled.
TemplateTemplate used on this Smart Object Rule.
Navigation RuleA rule can be marked as a navigational rule by selecting this option. A navigational rule is a special type of rule which can be used to create doors and connections between navigation modifiers.
EventEvent on which this rule will be triggered.
UserThe settings in this category define the user of a rule.
ClassSmartObject class of the user. Only users of this class will be considered.
State PatternState pattern to match on the user class. Only users whose state matches the state pattern will be considered.
HelperThe selected helper will be used, instead of the position and orientation of the user SmartObject class.
Max. AlertnessCan be 0,1 or 2. The alertness set here defines how alarmed a user is allowed to be. If the alertness is set to 0 for example the rule will not be valid if the user is in any alerted state.
ObjectContains all settings that define the object of a SmartObject rule.
ClassSmartObject class of the object. Only objects of this class will be considered.
State PatternState pattern to match on the object class. Only objects whose state matches the pattern will be considered.
HelperThe selected helper will be used, instead of the position and orientation of the object SmartObject class.
Cost MultiplierThe distance between helpers multiplied with this value gives the cost of passing through.
NavigationIf the rule is a navigational rule, the according helpers can be defined in this category.
EntranceThe entrance helper of the navigational rule is selected here.
ExitThe exit helper of the navigational rule is selected here.
LimitsThe options in this category determine the distance and orientation between the user and the object of the rule.
Distance fromThe minimum distance which has to be between user and object.
Distance toUser and object must not be further away from each other than the distance entered here.
OrientationThe angle entered here describes the orientation of the user to the object. A angle of 360 means the rule will always be valid, no matter if the user looks at the object or not.
User's TargetObject's orientation limit towards the users attention target.
DelayThe settings made in this category determine how long it will take for an action to start.
MinimumThe minimum amount of time it will take for the action to be executed.
MaximumThe maximum amount of time it will take for the action to be executed.
MemoryThis value tells the user how long to remember the connection to the object.
RandomnessThis value sets how much randomness will be added between the minimum and maximum delay.
MultipliersThe additional settings in this category are used to further define the rule and emphasize certain aspects.
ProximityThis value sets the importance of the proximity of the object to the user. This value can be used for the most far away objects being the first to be used by the user.
OrientationThis value sets the importance of the orientation of the user towards the object.
VisibilityThis value determines how important the visibility is between the user and object.
RandomnessThis value determines how much randomness will be added between the values.

ActionNot only the action itself can be selected in this category, but also the pre and post action states. The pre action states are set before the action is started and prevents it being started multiple times.
The post action states are set automatically after the action has ended. Although it is possible, it is not necessary to set the post action state manually inside the action itself.
LookAt OnThe value entered here describes when the user will turn to look at the object in relation to the total duration before the action is being executed. The value is entered as a percentage, that means a value of 50% will make the user look at the object after 2 seconds for a duration of 4 seconds. This LookAt behavior is only applied if the user is a character. If the user is a box for example it will not turn in direction of the object.
User: Pre-Action StateThe user will be set to the state pattern selected here before the action starts.
Object: Pre-Action StateThe object will be set to the state pattern selected here before the action starts.
Action TypeThe action type that has to be executed can be selected here.
Action NameThe action that has to be executed can be selected here when the edit field is clicked the action selection window opens. If an action that is needed does not exist, it can be created in this window.
Early Path RegenerationDecides when the path gets regenerated, at the animation start (true) or after the end (false).
User: Post-Action StateThe state pattern selected here will be applied to the user after the action has ended.
Object: Post-Action StateThe state pattern selected here will be applied to the object after the action has ended.
Exact PositioningMakes the AI agent move to the exact start position of the Smart Object before performing the action, so the animation perfectly matches the Smart Object shape.
SpeedMovement speed while approaching the helper point.
StanceBody stance while approaching the helper point.
Animation HelperObject's helper point at which the animation will be played. Default is the entrance helper point.
Approach HelperObject's helper point to approach before the animation plays. If empty, the animation's helper is used.
Start RadiusDistance from the Smart Object start point required for starting the animation.
Direction ToleranceMaximum difference between the AI and smart object start point orientation - if the AI is not oriented like that, it's rotated before starting.
Target RadiusTarget radius (tolerance) for playing animation.

4. Tasks

The Tasks window contains all controls to create, edit and delete new rules and helpers.


A SmartObject rule describes the relation between two SmartObject classes. Whenever the conditions of a rule are matched, a specific AIAction will be executed.

A SmartObject rule consists of:

  • A 'User' and 'Object' SmartObject class
  • A state pattern for the 'User' and 'Object' class, which has to be matched
  • Various additional parameters to further define the rule (Distance, Orientation, etc)
  • An AIAction to be executed if all conditions are matched


SmartObject helpers store position offsets within a SmartObject class. These helpers can be accessed from within an action graph using the 'SmartObjectHelper' node which outputs all necessary information. Can also be accessed for example from the Exact Positioning Parameter group Animation and Approach Helper.

A helper is always attached to the SmartObject class and is in no way related to the entity model. Every AIAction can automatically access all helpers, no matter what class they are attached to.

Smart Objects Helper Editor UI

Smart object helpers are oriented points attached to smart objects. They are used to define some specific points or directions relative to the current smart object position and orientation. Their position and orientation can be obtained using a Flow Graph node. In some specific cases their position and orientation will be also used internally within the Smart objects subsystem, and this happens only in the case when smart objects are used for navigation. Each smart object class has its own set of helpers. All helpers are uniquely named within a smart object class. All smart objects of a particular smart object class have their own copy of helpers attached.

Helpers are defined using the Smart Objects Editor window. Its Task bar contains the group Helpers where initially only the command Edit is available. Since helper definitions belong to smart object classes, pressing the Edit command brings up a dialog window showing a list of all known smart object classes. By choosing one of them, helper editor mode gets activated. The command Edit will change its caption to Editing showing the chosen smart object class. Only the helpers belonging to the chosen smart object class will be available for editing.

In helper editor mode the following operations are available:

  • The command New in group Helpers allows new helpers to be created
  • Selecting any object belonging to the smart object class chosen for editing shows all helpers as small wire-frame boxes connected to selected object with lines
  • Boxes shown to represent the helpers are can be selected in the Editor or from the list by helper name using the command Editing
  • Selected helpers can be moved and rotated in the Editor
  • Selected helpers can be deleted using the command Delete of commands group Helpers
  • The command Done terminates helper editor mode

Note: Smart object helper definitions are stored in the file: Game/Libs/SmartObjects.xml


To add a new helper to a SmartObject:

  1. Select the entity and assign the correct SmartObjectClass.
  2. Click Edit in the Smart Objects Editor window. A dialog window now appears. If no SO class is selected it means that the entity is not yet registered as a smart object and if so, start AI/Physics and exit it to refresh the system. Deselect and select the entity once again and repeat this step.
  3. Choose the smart object class for which you want to edit the helpers (if some other is already chosen) and click OK.
  4. Click the New button in the Helpers section. A new dialog window appears.
  5. Type the name of the helper you want to create and click OK. The helper will be created and (if the entity is still selected) appears in the editor's main view as a small yellow wire box and by default, is already selected. When the mouse is pointed over the box, its name will be shown next to it.
  6. Use the Move and Rotate tools to adjust the position and orientation. Note that if it becomes deselected or another object is selected the helper will disappear. Select the entity again and the helper will appear again.
  7. Finally, click Done in the Helpers section to exit the "edit helpers" mode.

Accessing Smart Object Data Outside the Smart Object Editor

SmartObject Classes

Almost all entities in the game can have a Smart Objects class. Setting a Smart Objects class for an entity does not change anything on the entity itself, it is only additional information for the Smart Objects system.

Whether an entity can be assigned a Smart Objects class or not can be seen in the properties window of the entity.

SmartObject class property

The SmartObject class of an entity can be set by clicking in the edit field of the 'SmartObjectClass' property. An entity can have any number of SmartObject classes.

If an entity has more than one SmartObject class, every rule which is assigned to this class will be applied to this entity.

SmartObject class selection window


An AIAction is a special type of Flow Graph that is being executed by a SmartObject rule if its conditions are matched. AIActions can be executed from within any Flow Graph using the AIExcute node as well, but normally they are called by a SmartObject rule.

The main difference between a normal Flow Graph and an AIAction is that an AIAction is limited to use only the user and the object of a SmartObject rule as target entities within the graph.


Whenever a new AIAction is created, two nodes will be added to the graph automatically:

ActionStart and ActionEnd. These nodes are used to start and end the AIAction.

Default AIAction graph

The only entities that can be used are the user and the object entity of a SmartObject rule. Although every other entity can be added to the action graph, only user and object entity ID's are valid.

Whenever an AIAction is started, the ActionStart node outputs the ID's of the user and the object on the according ports. This pulse can be used to trigger all necessary nodes, just like in a normal graph.

User and Object IDs

There are two ways of selecting the target entity for a node in an action graph: Connecting the ActionStart output ports to the according ID input port, or selecting the target entity from the context menu of the entity.

Using the context menu to select the target entity.

Assigning the target entity externally.

Organizing AIActions

Like normal Flow Graphs, AIActions can be categorized in different folders.

To place an AIAction into a folder, open the context menu on the action in the 'Flow Graph' window and select the 'Change Folder' option. A new folder will be created when a name is entered.


For both the user and the object entity of a SmartObject rule a state pattern can be selected. If this pattern is matched, the according AIAction of the rule is being executed.

A SmartObject class is not limited to have only one state. You can create as many states for a class as you want.

A state pattern consists of a set of sub patterns which each contain two sets of states, an 'Include' and 'Exclude' set. The 'Include' set determines which states have to be set.

If the 'Include' set contains three different states, all these states have to be set for the pattern match to be successful. All states that are added to the 'Exclude' set must not be be set for a positive pattern match.

A state pattern consists of an 'Include' and an 'Exclude' set

Modifying States

To modify a state, a state pattern has to be set for a SmartObject class. All states in the Include set of this pattern will be added to the class and all states from the Exclude set will be removed. This pattern for example would remove the states 'Observing' and 'PrepareCombat' from the according entity and add the states 'Alerted' and 'Combat'

Example pattern

The states of an object can be changed in different ways:

Using the Pre- and Post-Action Settings

The pre- and post action settings in the rule properties can be used to set the states. This is the fastest way of setting states.

Using the AIModifyStates Node

The AIModifyStates node can be used in action graphs or normal graphs to modify the states of an entity.

Setting the State in the Scripts

You can also modify the SmartObject states using a LUA script at any time. You have to provide both the entity ID and the state pattern string as parameters.

Just call:

AI.ModifySmartObjectStates( _EntityID_ , _StatePattern_ )


!AI.ModifySmartObjectStates(, "-Idle" );

  • No labels