Structures to control instance behavior
In the early days of computer games, the behavior of enemies and other non-player characters (NPCs) was rather simple. Based on only the game state or a few properties, like The player has eaten a large dot, I must stay away from them! (Pac-Man) or I saw the player, so I will attack them! (many first-person shooters), the computer counterparts were acting only with a small set of rules.
Later, control structures like “plain” state machines, hierarchical state machines, and behavior trees changed the artificial intelligence (AI) in games a lot, since it became easy to model complex tasks for enemies and NPCs. Now, it is possible to not only create more alternatives for behavior choices but also let computer-controlled world inhabitants act more like intelligent beings. Spotting the player may lead to a handful of different outcomes from NPCs, based on world factors, their own properties, and a bit of randomness.
A behavior...