Getting Started
Entities
Levels
Drive
What is a Drive?
A Drive is the motivation for an Agent. Only Agents can have Drives. The level of a Drive ranges from 0 to 100 with 100 meaning the Agent has maxed out the Drive. Drives are designed to be used by the Decider to retrieve plans that reduce the Drive levels for the Drives that currently have the highest utility levels. Drive Levels are passed through a Utility Curve to determine the Drive's utility level.
Drive Type
Inspector Reference
Script Reference
The Drive Type defines how the Drive's level changes and also how the drive level equates to utility through its default
Utility Curve. The curve translates the 0-100 level to a 0-1
utility value which can be compared to other drives' utility values. The default Utility Curve can be overriden
by the Agent Type.
How a Drive Type's level changes is critical to the kind of Drive it is. TAI provides three main ways to
have Drive levels change: hourly rate, hourly rate based on time of day, and equation based. A DriveType
can also be set to be synced to a Min Max Attribute Type. Any change to the drive will change the
Attribute Type Level and vice versa.
Hourly Rate Change
This is the simpliest level change type. The default change can be set in the Drive Type and then each Agent Type can override this default hourly rate.
Hourly Rate Change By Time of Day
The time of day curve defines the rate of change based on the time of day. The x value on the curve is the normalized time of day, so Noon would be 0.5. The y is between 0-1 which is then transformed into the min/max range. Sleep Drive Type is a good example of this. As it gets later and later at night the rate of sleep Drive will keep increasing and then will not increase during the day.
Attribute Synced
TAI allows you to mark a Drive Type as synced between an Attribute Type. You can specify if the levels go in the same direction or opposite directions. The Attribute Type must be of or derive from MinMaxFloatAT as the attribute has to be able to move between a min and a max.
Equation Based
Equation based Drive Types allow you to attach the Level to the state of the World. For example you could create a Drive Type that's level is based on the amount of food stored. The equation would need a max amount of food at which point the level would be 0. A min is also set at which point the Drive level is 100. The Equation's logic is coded in a subclass of the DriveTypeEquation class, which follows the Scriptable Object customizable logic pattern.
Drive Type Equation
public abstract float GetEquationMax(Agent agent)
public abstract float GetEquationRawLevel(Agent agent)
public abstract float ChangeInOutputChange(
Agent agent, DriveType driveType, OutputChange outputChange, Mapping mapping)
public virtual float GetEquationMin(Agent agent)
public virtual float GetEquationLevel(Agent agent)
public virtual float CalculateEquationDriveLevelChange(
Agent agent, DriveType driveType, Mapping mapping, OutputChange outputChange)
Only the first three methods need to be defined as the last three have default implementations in the DriveTypeEquation base class.