Creating a needs framework for NPCs (And maybe even PCs)

This is the initial issue I made: Maslow's Heirchial Finite State Machine · Issue #28681 · CleverRaven/Cataclysm-DDA · GitHub

An initial draft implementation is merged already. You can even check the output of the system by reconfiguring the sidebar to output the current goal.

Where I stalled on this was the difficulty in representing varying degrees of needs mostly within a single level.
So if you are just about to starve to death but you were a little bit thirsty you need to prioritize food over water even though normally in a behavior tree you would strictly prioritize a thirst need over a hunger need.

I have two ideas for what to do about it. One is add a simple “largest value” selector to the behavior tree implementation, and have the potentially lethal needs return a, “time until death if need is unmet” value, and the second is to add a utility curve selector and have the needs return a simple level value.

After that there’s probably some more tuning that needs to happen to get the lowest level needs acting as expected, then the whole system can be wired into the npc AI proper.

1 Like