AI Needs and Command
Hey Folks! After a short bug fix to restore ship damage, I started revisiting the AI needs system, and figuring out how to expand that. Also, how will that affect command?
All of the AI has a set of needs right now, a lot like those found in NEO Scavenger. Some are physiological, like hunger, and others are emotional, like a sense of security. As the AI putzes around, these needs change. Some gradually increase with time. Some change with certain events or actions.
When they cross a certain threshold, they get a "discomfort." In NS, this might have been "starvation" for too much hunger. Here, it might be "panic" if security need gets too high. These discomforts will imbue their own penalties, such as pain, lethargy, or irritability.
The AI also has some preferred level of each need, and if the need exceeds that, they will act upon it.
Part of what I was dealing with today was figuring out what these drawbacks look like. One of them might be a refusal to take a direct order (i.e. cannot draft). Another might be an increased reluctance to interact with others. Or maybe a higher chance of emotionally attacking someone. Or maybe laughing to redirect anxiety.
Another thing I was looking at was how chargen integrates with this. If we have a brave character, what does that mean in terms of their discomfort thresholds? And their preferential threshold? Surely a brave character would absorb more fear before feeling the need to act on it. And similarly, they would absorb more fear before showing stress response.
So what I arrived at was a few rules:
1 - An AI has some stat for a need. E.g. StatSecurity.
2 - An AI's preference threshold is a stat in itself. E.g. PrefStatSecurity.
3 - Taking traits like "Brave" or "Coward" can therefore increase the PrefStatSecurity through normal game mechanics.
4 - The AI won't act on a need until it exceeds PrefStatSecurity.
5 - The AI won't receive penalties until it exceeds a threshold of StatSecurity.
6 - The thresholds in 4 and 5 should probably always be the same, for simplicity.
So most likely, our "pref" stat has the same value as our stat threshold. There may be cases where a stat has multiple thresholds. Like "mildly nervous" vs. "gibbering terror." And in those cases, the "pref" should shift all thresholds up/down as necessary.
This is going to require a slight change to the code, but not too much. Currently, it does almost all of the above. #6 is the main one missing, and the implications of additional thresholds also shifting.
And since I'm in there, there's another change I've been meaning to make for a while. Instead of each condition having thresholds on it, and the game checking against those any time it changes, I want to add listeners to conditions on specific items.
E.g. instead of StatSolidTemp checking thresholds on everything from walls to humans, we add the necessary thresholds directly to the human, so wall doesn't have to waste time checking thresholds that don't apply.
I think this will also make it slightly easier for me to handle one of the trickier cases: changing a "pref" threshold mid-game, when a "discomfort" is already present. In cases like these, the new threshold could shift far enough away that the discomfort is no longer applicable. We'll need to do some checking whenever a pref changes to ensure we don't screw up our bookkeeping.
I've gotten started on this set of changes, and I'm thinking it won't be too bad to complete. And once that's done, it might finally be time to start adding the remaining needs and discomfort stats, plus hooking up character traits to pref changes. Basically, start integrating all of this formerly independent and empty data so that it starts making meaningful changes.
Could be an interesting week ahead! Until then, have a good one!