When making NPC behavior, most developers reach for state machines or behavior trees. These produce rather inflexible, scripted behaviors unless you put a lot of effort in making a large number of states (or behavior nodes).
An alternate approach known as drive reduction produces “smart” behavior without so much prescripting. You give a character a number of concerns, which could be internal (food, thirst, bathroom, rest) or external (need to guard certain rooms/persons/objects, need to take something somewhere, etc.). You define rules for how those concerns are increased or decreased by actions available to the character. And that’s pretty much it — the character starts behaving.
Example 1: suppose you have a museum guard. His concerns would be the various rooms of the museum; whenever he’s not in (or otherwise seeing) a room, his concern about that room increases. But you can also give him a need for rest, a need for coffee, and a need to go to the bathroom. Then just drop him in the game — he will rest at his desk a while, sip coffee, and patrol the museum in whatever path seems most efficient to him. When the need to go to the bathroom gets too great, he’ll do that, but check on some rooms on the way; or maybe do his patrol first, and then hit the bathroom on the way back when he’s sure everything is OK.
When something unusual happens — say, he hears a sound or sees something out of place — you would set his concern for that room to go up substantially (with maybe a bit of spill-over into neighboring rooms). This can cause him to put down his coffee immediately, and go check the room, or rearrange his patrol route to hit that room more often.
Suppose he finds a door locked that shouldn’t be. This would substantially increase his concern for rooms on both sides of the door, but he’s already on one side, so he knows that room’s OK. So he would immediately make his way (by some other route) to the room on the other side to see what’s going on.
Example 2: Enough with the museum guard, what about RPG NPCs? In this case their concerns could be things like food, shelter, rest, maybe companionship, and of course safety. Some of these would be set to change at different rates at different times of day, so for example the character would be more likely to go home and sleep at night. This will result in a daily routine that makes sense for each character. But if a greater concern occurs — like a monster in town — then the NPC would defer sleep and seek the nearest safety (duck inside, cower behind the player character, whatever).
I really think this approach is both easier for the game designer, and results in more flexible, interesting behavior. The drawback, of course, is that the designer no longer has detailed control over what the character does. But in most cases I think the easier development and smarter behavior is worth it.
Does anybody else think this make an interesting asset? What features would you expect to see? How much would this need to be usable without coding (through custom Unity editors), vs. simply an API you talk to with code?