heyheythere - NPC Behavior & Daily Life System

NPCs that live a day in your world, in one C++ plugin with its whole surface in Blueprint: they work, eat, talk to each other, sleep, keep watch and fight by the score each behaviour earns. The score panel shows why each one does what it does; the behaviours a town and its fights need ship ready, and your own animations play by tag.

The guide: heyheythere.com/docs/npc-daily-life, a fifteen-minute quickstart into the Third Person template, and every node and setting. Read it before you buy.

Try it first: the playable Windows demo is free, about 290 MB; unzip it and run the exe.

Utility AI

  • Each NPC scores its behaviours and does the best: considerations multiplied, times a weight
  • Considerations are data: a need on a curve, the hour, the day plan, a distance, health, alarm, a memory, a tag
  • Momentum keeps an NPC from dithering; urgent and combat behaviours interrupt the rest
  • One scheduler thinks every brain in a time budget a frame; far NPCs think less often. In the demo, 200 NPCs think in 0.1 to 0.9 ms a frame
  • Your own considerations and steps as Blueprint children

Ready behaviours

  • Town: work, eat, sleep, talk, sit down, wander, stroll, take cover, call for help
  • Watch and fight: patrol, investigate, chase, attack through your own damage, flee when hurt
  • Companions: follow, wait here, help out, bar the way
  • Visitors: shop, browse the stalls, look round
  • Five ready roles: villager, guard, bandit, companion, visitor; a role is a data asset to copy and change
  • A behaviour is a short list of steps: go to a spot, use it, wait, say a bark, remember, run your Blueprint event

Conversations

  • Two NPCs at a talk spot hold a conversation, a line each in turn in speech bubbles over their heads
  • Conversations are data assets: lines with the listener's name filled in, chosen by considerations as behaviours are
  • Gossip: a conversation can pass on what the opener remembers, and the listener knows it from then on
  • Begin Talk for your dialogue system: the NPC stops and faces the player until End Talk, then goes back to its day

Crowds

  • NL Spawner keeps a crowd in an area by the hour: they arrive and leave out of view, and come back as they left
  • Detail by distance: NPCs far away or out of view animate and move less often, and drop their shadows

A day on your clock

  • A day plan per role: sleep, work, eat and socialise by the hour
  • The plugin's own clock, or your game's through an interface; how-tos for Ultra Dynamic Sky and the engine's SunSky
  • Days of the week and seasons as tags a consideration reads
  • Speed time up, or jump to an hour and every NPC turns to what that hour asks

Spots in your level

  • Work, sit, sleep, eat, talk and patrol spots, placed as actors: claimed, used and released
  • Seats for several: a table, two talkers face to face at the well, two beds in a house
  • Paths drawn as splines, a lane or a street, walked end to end
  • Kept for a role, or for anyone; a home for each NPC to sleep in
  • Epic's Smart Objects used as spots when your project has them

Needs, memory and senses

  • Needs that run down and fill at the spot that meets them: food, energy, company, any you add
  • Facts an NPC remembers and forgets in time, which your dialogue and quests can read
  • Sight and hearing, with a suspicion that rises before an alarm
  • Factions and their attitudes: who is a friend, who a foe

The score panel and debugging

  • A panel over any NPC: each behaviour's score and the considerations behind it, needs, plan, senses and memory
  • Bubbles with each NPC's activity and lines, fading with distance and kept clear of each other
  • A glint on what the player can talk to or use, fading in as the player walks up to it: a component on any NPC or prop, on in the demo, off for one or for the whole game
  • Npc.Debug, Npc.Why, Npc.Score, Npc.Time, Npc.Speed, Npc.Need, Npc.Spots, Npc.Detail and more console commands
  • A Gameplay Debugger category; Data Validation names a behaviour or role set up wrong

Your characters and animations

  • An NL Brain component on your own character, or the ready NL Character
  • Each activity sets an animation tag, which plays your montage or loop on your skeleton
  • Poses from code for sitting, sleeping and working on the UE5 mannequin's bones, before you have animations
  • Life over any animation: idle stances, a head that turns to whoever comes near, a lean into turns, each NPC on its own pace
  • NL Movement Component: the body comes round eased to where it walks and slows for sharp turns, so NPCs never walk sideways
  • A State Tree task runs a behaviour, and a behaviour can run a State Tree

Multiplayer and save

  • The brains run on the server; each NPC's activity, bark, alarm and pose reach every client
  • Tested with two players on a listen server
  • Save World and Load World give every NPC's needs, memory and doings for your own save game

The demo

  • The town in the video: a farmer and his farmhand in the field, a baker at her stall and a grocer at his, villagers talking at the well, a crier on the lane, a market crowd, a guard and his companion, a thief from the hills
  • Walk it in Play: Tab opens the score panel over whoever is nearest and E over the one ahead, T moves the day on an hour, F makes a noise for the guards, F5 and F9 save and load the town, G opens a guide to what to try
  • It ships in the plugin's Content/Demo folder (turn on Show Engine Content and Show Plugin Content)
  • Epic's mannequins in a project made from the Third Person template, plain stand-ins otherwise

Engines and platforms

  • Unreal Engine 5.6, 5.7 and 5.8
  • Windows, Mac and Linux
  • The full C++ source, in a Blueprint-only or a C++ project
  • Needs only the engine's own State Tree, Gameplay State Tree, Smart Objects and Enhanced Input plugins

Support through this page's comments or by email.