This week I worked on NPCs (non-playable characters). They are basically the other survivors in the city.
NPC AI is based on zombie AI. It runs in a modular behavioral hierarchy. Right now NPCs can perform many different actions. They can wander, give the player attention, attack the player, attack zombies, flee, talk, etc.
If they’re near the player, they can shout phrases in small, floating speech bubbles. These phrases can be greetings, cries for help, taunts, etc.
You can initiate a full chat with an NPC, by walking close to it and pressing the chat icon that pops up in the top right of the screen. In these full chats you can respond to what the NPC says and essentially have a little conversation with them. Certain responses you give will trigger a positive reaction in the NPC, other responses will trigger a negative one. You can also ask the NPC to follow you, or trade with you. If you anger the NPC too much while talking to him, he will attack you.
NPCs will also attack you if you purposely attack them, and if nearby NPCs see this altercation, they will gang up attack you as well.
The full NPC chat system is based on a dialog tree editor that I wrote, which uses Helium for its schematic view. Here is a scaled-down image of a complex dialog tree created for generic NPCs found outside of the sewers:
The blue boxes are branch nodes that are seed-locked to each NPC, so NPCs will “respond” to a player’s dialog choice predictable at that point in the tree. The rest of the branches are chosen at random to keep conversations unique. Green lines represent conversational choices that trigger a positive reaction in the NPC. Red lines represent negative reactions. If you insult/threaten an NPC too much during a conversation, he will attack you.