NPC SOCIETY
- An architecture which allows NPC’s to “live” their daily lives based on daily schedules
- But they can break out of their schedules to react dynamically to the player / environment
The current video doesn’t show any workflow, just the end result. All of the eating / resting on benches is dynamic behavior, the “going to work”, “going home” is according to daily schedule. I’m still working on the editor / inspectors (I’m new to Unity). Also because this thread was deleted after I originally posted, the video is a bit dated - some really apparent bugs were already fixed - including the occasional “walking in place” and “jumping up” when stopping at waypoints (which results in ie. the saw appearing above the log instead of inside and other fun stuff).
Planned features for 1.0 (aka “Daily Routines” release)
DRAG PREFABS & POPULATE: There will be demo allowing you placing around random area prefabs (houses, places to work etc.), and see Society Populator auto-populate with NPC’s living their daily schedules no matter how you lay things out. The populator assigns free houses to people, finds them near jobs, places to rest, eat etc.
DAILY SCHEDULES: Configurable from the inspector - you just set up intent slots for each hour (0-23). These are the intents the NPC’s try to fullfill (there are actually multiple intent layers with their own priorities, Daily Schedule layer is just one of them).
DYNAMIC INTENTS: Those mix in with the daily schedule intents, and are based on NPC core stats - hunger, fear, tiredness etc. When the NPC’s get tired / hungry etc. they interrupt their daily schedules to fullfill those dynamic intents, which can be higher priority than their daily schedule.
AREAS & WAYPOINTS: You can define what happens when an NPC enters, exits or updates in an area / waypoint. At a waypoint, you can set mecanim bool(to play Animation), equip a tool, stay on a waypoint for X world minutes and more. Just by placing bunch of waypoints around, you can have NPCs appear to be working, resting, sleeping etc. 90% of the video is built on top of the waypoint system.
CUSTOM BEHAVIORS: Those can be tied to waypoints or areas. Once an NPC arrives to Area to fullfil their intent, you can launch a custom behavior. A sample pub waiter / customer is included for now. They are state machines, including states such as “waiting to eat”, “waiting to pay”, “eating” etc.
DAY / NIGHT & TIME: Simple support for day / night cycle based on world time. Waypoints or areas might be open / closed based on time. One of the default core stats is “sleepiness” which makes the NPC’s raise sleep intent priority at night, which makes them go to sleep (they seek known areas with sleep waypoints, which is usually home, but might not be).
FREE: The initial release will be free.
SCREENSHOTS - DAY
SCREENSHOTS - NIGHT
SCREENSHOTS - EDITOR
The future
The goal is to create a basic, reliable NPC system which can be used to quickly populated any game world with “living” NPC’s. There are numerous things I need to work at to achieve this, most notably stability, flexibility for various use case scenarios and optimization & scalability.
For the first release, I’ll also need to create a really light low poly demo consisting of free assets(UMA is kind of heavy…). I have some other NPC modules planned which might become their own thing and/or might connect into this. But before nailing down the basics it would be probably premature to advertise. Those include some basic Psychology, Factions, Talk / Interaction animation system etc.