Let's revisit the normal logic flow in the timer of most C3 critters - which typically follows this pattern:
- increase age
- decrease energy
- if old enough, increase sex drive
- drown in water - lose energy rapidly
- if low on energy (sometimes also OR if too old) flag for death
- if hungry flag to get food
- if sex drive high, flag to mate
- obstacle checking - sometimes also water-shyness
- if flagged for death go to die subroutine
- if flagged to get food, get food
- if flagged to mate, mate
- if flagged to roam, roam
The logic flow in the timer script being arranged around two phases - first flagging, then checking the flags - is an example of a behaviour tree. This has the benefits of avoiding conflicts in behaviour, creating a predictable flow, allowing for lifelike complexity (flagging for multiple behaviours allows the system to choose between them with DOIF logic), while being performance friendly.
This is just the beginning. Potentially, richer, more lifelike behaviours could be layered in that fit the same flag → check → act model:
1. Sleep
-
Trigger (Flag): Circadian rhythm, night-time.
-
Effect: Critter becomes inactive for a while if they have no other urgent needs. (Before obstacle checking in the normal flow.) Could lower stress or reset certain behaviours.
-
Note: Should not rely on "energy"; just time-based. There is the possibility for nocturnal critters as well. See C2toDS for several examples where critters pay attention to the time of day.
2. Environmental-related behaviour
-
Trigger: Environmental variable (e.g., cold weather, or absence of heat, or seeking/avoiding water bodies).
-
Effect: Move toward heat sources or huddle with others. Should be a high priority if temperature is out of survival range (with drowning behaviour). Avoiding or seeking water bodies while walking around might be treated as part of the obstacle checking.
3. Nesting / Territory Marking
-
Trigger: Reproductive phase or roaming with high comfort stat. This might be when ready to lay an egg or mating recently completed.
-
Effect: Stay in one area, mark it, or modify it if possible, for example with a nest. Ants and woodpigeons create nests.
4. Social Bonding / Seeking Company
-
Trigger: "Loneliness" stat increases and creature is not hungry.
-
Effect: Move toward friendly creatures or group zones and stay for a time (perhaps until hunger or mating drives override)
-
Why it fits: Allows a secondary social layer that may encourage interaction with or imprinting on creatures. The Kyutai Whale engages in this kind of behaviour.
5. Play / Curiosity
-
Trigger: Boredom or low-stimulation stat.
-
Effect: Interact with random objects.
-
Note: Helps when no high-priority flag is set. Tails and the playful interactive land critter script covers this.
6. Altruism
-
Trigger: Being played with or a drive that builds up over time.
-
Effect: Create a gift that creatures can interact with.
-
Note: Rewards creatures for playing with critters. The interactive land critter with a drive script covers this.
Wrapping up
The default behaviour tree works for basic life-cycle simulation—but Creatures has always been about emergent complexity. The beauty of the timer script's structure is that it invites expansion and variation - if you explore the C3 agents in depth you can see a host of variations between fish and birds and land critters that I haven't even begun to touch on here.
By thinking in terms of clear triggers, thoughtful flag-setting, and responsive actions, you can add whole layers of depth without breaking the base flow. The result? Smarter, livelier, more unique agents that feel like part of a real ecosystem.
Now that you know about "eat, mate, die", you can also go beyond it. Your critters deserve richer lives—and your worlds will be more fun for it.
No comments:
Post a Comment