Think cycle

From AI Product Manuals
Jump to navigationJump to search
This page is part of the IAUS Manual.BrainBehaviorBehavior TypeDecisionAI Entity

This page is part of the Brain


The Think Cycle is what the Brain uses to start processing potential decisions and, if necessary select a new Behavior (and possibly target) to execute. It is what is called by the game engine on a regular basis. The game engine, however, doesn't need to pace the ticking of the think cycle since that timing is already built into and modified as appropriate.


First, the game checks if the Brain can think. For example, this might be set to false if the agent is incapacitated, unconscious, etc. If the agent can think, it then checks to see if it is time to think. If so, the actual Think routine is started.


The Think Cycle has a pair of tasks that it processes when it is time to be executed.

Processing Histories

First, it process the behavior histories that it is keeping. This discard any of them that are stale and need to be removed. This is important to do prior to behavior selection because many of the considerations reference data in these histories.

Selecting a Decision

It then goes through the process of selecting a decision. In short, this involves rebuilding the list of neighbors it might want to interact with, rebuilding the Decision List— a list of Decisions that are a combination of a Behavior and a Target (if necessary), scoring those decisions, and setting a new decision if we are changing what we are doing.

It then sets the new time that the next Think Cycle will be executed.

This entire decision selection process is covered fully in Select Decision.


The code for the think cycle is contained in the Brain class.

There relevant higher level functions are:

  • Brain::WantsToThink
  • Brain::Think
  • Brain::SelectDecision