CTP Perceive-Act

From Scalable Game Design wiki
Jump to navigation Jump to search

Description

This pattern uses information that an agent knows about itself and the agents around it to make a decision on what it should do. It looks at itself or agents around it, and depending on the state (depiction) or attribute values that it finds, the agent will change itself or stay the same. It may be useful to use a probability in the decision making process of whether or not a behavior should happen.

Keywords

You may need to use this pattern if you are using these words to describe the behavior:

Real-World Examples

"A tree may start on fire if the tree next to it is on fire" "A student may rush the football field if the student next to it is rushing the field"

AgentSheets Code

This example is taken from the Forest Fire simulation. A tree agent can follow two paths for this example. If a tree is green and is next one or more actively burning trees, it can change itself to be burning based on a probability (80% in the example). If the tree is already burning, then can change from actively burning to being burnt out based on a different probability (50% in the example).

Perceive-ActAS.png

AgentCubes Code

Check Your Understanding