I’m pretty sure that smartening NPCs has been a difficult matter since Cataclysm’s beginnings, but I still want to see this happen someday; Mostly because I like to start with an NPC, but they don’t know how to survive. I’ve had one that I was able to keep safe, but a couple days later I found her corpse without any signs of struggle; I assume that she starved to death.
I think the best way to make smarter NPCs would be to use different variables to simulate mental states, and adding behaviors to reflect them.
Note: I put Characters in parentheses in the subject because a couple variables would affect player characters too.
Possible variables to add/change:
-Morale: like player morale, increases or decreases based on several factors. For NPCs, morale would directly affect behavior. Factors should be similar to player morale: pain, cold, hot, wet, and guilt. In my opinion, this should also include fear, which is gained by seeing large numbers of monsters, or dangerous ones, namely robots, zeds and nethers.
-Competence: based on stats/skills, as well as inherent personality (RNG), Competence is a measure of a character’s confidence and mental fortitude. It would lessen some morale penalties (similar to how a player killing a bunch of zombie children eventually becomes used to it and feels less guilty), and would react with morale to decide behavior. As an example, a low morale, low competence NPC would turn tail and run at the first sign of danger, while a low morale, high competence NPC might be willing to take greater risks.
-Attitude: I’m pretty sure there’s already a variable for this with NPCs, especially ones that start the game with you. This would be similar to the current attitude, where mutations/traits, quests, and persuasion makes an NPC more or less likely to listen to you. However, this could also be used alongside morale and competence when trying to get an NPC to do something in stressful times. For example, a low competence NPC whose morale is low because there’s a horde right in front of them might still listen to you to stick close if their attitude of you is high. If not, they might just abandon you and run directly away from the horde… say, down the street towards the OTHER horde.
Note: players don’t have attitudes for themselves. I think there’s a better word than attitude for this context, and when I remember it I’ll edit it into this post.
-etc: other variables could be included to create more subtle differences between NPCs. I don’t have any real ideas in mind; a potential candidate(s) could be ones to fine tune variables above, for example a variable for pain tolerance (or lack thereof) on top of one for general competence. For an example to this example, someone competent but with low pain tolerance would be less scared of a hulk, but would be more afraid when they’re knocked through a wall and suffering a lot of pain.
Possible behaviors to add (note that each item below is moreso a category of behaviors than an individual one):
-Following orders: these would be similar to how NPC orders are now, but potentially with more persuasion involved. These can be overridden by a check caused by lowered morale, lowered attitude, etc. See the example under Attitude, above.
-Hungry or Thirsty: If it is currently safe (safe, being fairly subjective, would probably rely on a few variables, such as how many zeds are nearby), the NPC should endeavor to not be hungry or thirsty. They will eat or drink anything they have on their person. If they don’t have anything, they will go get something edible nearby and eat/drink it. If there’s nothing nearby, they might complain, ask the player to go find supplies, or possibly find something on their own. This behavior would start off low priority, overriding only idle behaviors, but may override more behaviors as they become hungrier or more thirsty.
-Scared: If there’s something really scary nearby, like a hulk or a horde, or if an NPC is injured, they will act accordingly. This might involve just generally keeping their distance from anything dangerous (or unmanageably dangerous), putting the player between them and the threat, running away(to a known safe spot, or just away), or using higher firepower (like using a grenade, even if told not to). This would override or be overridden by orders given by the player, depending on the persuade check. However, keeping distance from some things, such as chicken walkers, would be considered the sane choice for most ordinary survivors, so this particular type of fear would be very difficult to override.
-Crusading: Driven by any number of possible reasons, an NPC might decide to just start killing things. It’s possible for this to be against any faction, every faction with exception(s), or every faction, no exception. They might continue until there’s nothing left to kill within a certain area, until they run out of ammo, or until some other reason overrides their bloodlust. Examples might include a psychopath who wants to kill the humans, a starved NPC who wants to eat every last furry thing in the forest, someone who’s desire for revenge against the zeds gets the better of them, or as an exception to this example, a Marloss Man who wants to do Marloss things.
-idle/bored: if an NPC is idle, they should find things to do. This would be extra because it can reach Dwarf Fortress levels of complication and/or micromanaging, but could include making clean water, cooking food (either unspoilable food or spoilable food in moderation), using any of their other skills (ex. repairing clothing), scouting the immediate area or keeping watch, butchering corpses, or possibly solo scavenging. If that would be too much, then at the very least NPCs could have minor flavor added to their loitering with finding a place to sleep, or minor wandering (within a given safe area).
-rain: maybe the NPC just doesn’t want to be rained on. He or she might elect to stay under cover when the rain starts coming down too hard, but might be willing to run across a street right into another building. If you’ve been loitering in the middle of the street too long under a drizzle, they might also consider leaving you dancing alone in the rain. You might need to Persuade them to dance with you… Unless, of course, there’s a large horde right on your tails, in which case they would probably forget about their fear of melting long enough to avoid becoming zombie chow. This might result from morale penalty from being wet, competence, or possibly just a trait or variable.
-Different speech: different people talk different. This might be the most time consuming thing to add, so would probably be considered optional alongside idle.
-Outside the reality bubble: This one is a bit more complicated. I would personally say that if the NPC is outside of the reality bubble for so long (several days or weeks +), it would be assumed they fended for his or her self. Favorably, the game could check things like how many dangers are nearby (zeds/unbutchered corpses, special zeds, bots and turrets), how much lootable terrain is nearby (unlooted houses or forests with season taken into account), and how capable the NPC would be at surviving (looking at competence, but possibly other things including equipment, stats, etc.), and throw a little RNG in to decide if the NPC survived, or if not, a little more RNG to determine where the corpse (or turned zombie) resides.
For shorter durations, the NPC might just stick around a safe spot, or where they were left. If you left them alone in a non-safe area, then maybe throw more RNG around to see where they fled to (or if they survived, see the previous paragraph). If they left the reality bubble of their own volition, then they’re fending for their self, similarly to the previous paragraph. In which case, they might come back to the player or a given safe spot after a few minutes, or a few hours.
-Recognizing a safe spot
I think a lot of players make a fort of some sort, temporarily or otherwise, where they bunker down and feel safe. It would a large boon if NPCs recognized the player’s safe spot, or a safe spot of their own and have their behavior reflect on that. I’m not sure if this one would be possible though…
Even if nothing comes from this immediately, I at least want an abstract for more dynamic NPCs to exist. I’m sorta inactive, what with the next semester approaching and such, but I’ll try to check on this in case anyone has ideas, constructive criticisms, etc.