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!

Tags: Ostranauts


Josh_A_Culler's picture

Hey Dan, id like to suggest something, if you havent already done so - try playing a few games here and there of ‘rimworld’, which is a game with very similar parameters as ostranauts, albeit planetside rather than in-space transit... but it will show many of the most current trends of this kind of multiple AI characters interacting in a very post-sims type of way. I really think you would benefit from an understanding of the current developments in that sort of genre, so you can build and/or critique from there, as opposed to working in a vacuum - which is what it appears to be somewhat, and i do understand the potential advantages there but in this case i dont think they would be nearly as manifest as the developments built from a more thorough knowledge of these concepts in action - and most notably in a very fun and successful game which is being played by many many people right now as we speak.

dcfedor's picture

Hey Josh!

Rimworld is definitely on my radar. I've got about 60 hours logged in it so far, and I really enjoy it :)

I think it's one of the games that comes closest to what I'm picturing. And based on some of Tynan's early prototypes/blog posts, it sounds like he wanted to do something like Ostranauts at one point, too.

Even though Sims is older, there's a useful reference there because it tends to focus on relationships and mood a bit more closely than survival. And other games like Prison Architect do a good job of exploring security zoning, crew workflow, and logistics.

Dan Fedor - Founder, Blue Bottle Games

Josh_A_Culler's picture

Forgot about prison architect... also a great one because its non traditional society, gang warfare, etc..

Also you can play a mode as one of the prisoners, that may give another helpful perspective for how the AI would operate from a gut level

dcfedor's picture

That's one mode I haven't tried yet. I'll have to give that a look!

Dan Fedor - Founder, Blue Bottle Games