Skip to main content

Module agents

Module agents 

Source
Expand description

The citizens’ CharacterComponent and CitizenAIComponent run together each simulation iteration. See docs/CITIZEN-AI.md.

Order per iteration: each citizen’s model advances its clip (and draws for its sound events), then its character runs its actions and moves; “sequence finished” messages run the AI again with zero time, then the AI updates.

One iteration runs in the entity manager’s order (docs/ITERATION-ORDER.md): the every- iteration phase (bit 0x04: the citizens’ characters, then the sites’ state machines, nomads, boats and tornadoes; Agents::every_iteration), then bucket 1’s citizens (Agents::visit_citizens: the character’s notify, CitizenComponent, CitizenAIComponent), then bucket 3’s sites and piles (Agents::visit_sites), with the seeder’s buckets 2 and 4 between and after them, then the deletions (Agents::finish).

Deviation: the every-iteration phase runs one kind at a time (the animals, then the models, then the citizens, then the sites); the original runs it entity by entity, in its set’s order. Animals and sites are also deleted at other points than citizens. See docs/ITERATION-ORDER.md, steps 3 and 4, and issue #22.

This file holds the agents’ state and set-up; the rest is split by topic: update (the iteration), thinking (the AI), lives, commands, paths and views.

Original: AnimationManager::Update; the entity manager’s bit-0x04 components; FUN_140114810 (sequence finished); FUN_1400c9560 (the buckets).

Structs§

Agents
The citizens’ agents: each citizen’s AI and character, and the state the iteration needs.
CitizenRulesAi
The CitizenDescription values the AI reads.
CitizenState
Citizen fields read/written by equipment activities and Citizen messages 1/6/7.

Functions§

entity_views
The parts of each placed entity the activities read.