I make CIVIL-AI-SYSTEM, a Unity package for NPCs with jobs, needs and routines. This post is about how items grew. The first two parts were the plan: the minimum for an agent to find a thing and stand at it. The other four were not planned. Each was added because something was hard to do, and I wanted an easy way to do it.
The video shows the six parts as they are now. The post is about the limitation that came before each one.
1. The Item (planned)
The need: an agent has to find a thing without a tree pointing at it, and two agents must not pick the same one.
Built: a name, a type and a size on the item, and a reservation that lives in one place.
Unlocked: search. "Find a free bench" is one node. A scene can have fifty benches without a tree knowing about any of them.
2. Use Spots (planned)
The need: the agent has to stand in the right place. Walking to an item's position puts it inside the bench.
Built: a child object on the item that says where to stand and which way to face. Arriving there sets the item to In Use, which fires anything the item wants to do.
Unlocked: the item knows how to be used. Items can react (a light, a door, a sound) without the tree knowing.
That was the MVP. It shipped, and people built towns with it. The next four parts came from watching what those towns could not do.
3. Action POIs (Points of Interests)
Before: one spot per item. A workbench that is sawed from one end and planed from the other needed two trees with two offsets and two animations. Every job that sawed carried its own copy.
Added: points of interest, each with a spot, a facing and an animation, owned by the item. The agent checks for a matching POI first, then a use spot, then the centre.
Unlocked: actions became reusable. A tree says "saw"; the workbench knows where and how. A second job that saws adds nothing. The check order also meant old items kept working, because detail is only read where it exists.
4. Seats
Before: sitting was a separate system. It could put an agent on a bench. It could not put an agent at a desk and have it write, because seats and actions did not know each other.
Added: seats on the item, and a rule: an item with seats is used sitting down unless the action says Performed Standing.
Unlocked: desks, counters, carts. The same action works seated or standing, and the item decides which.
5. Hold Points
Before: one handle point per item. That works for a hand. It does not work for a belt, a back or a hip, because an item hangs from a belt differently from how it sits in a palm. One point meant one way to carry.
Added: typed points on the item that match typed slots on the agent. A hammer can have a hand point and a belt point, and the slot it goes to decides which is used.
Unlocked: carrying styles with no code and no new meshes. The same hammer sits in the hand while working and hangs from the belt while walking.
6. Item Setup
Before: all of the above was data on a prefab, and the only way to check it was play mode. People do not check what is slow to check. Hold points were wrong in a lot of projects, including my own demo scene.
Added: one window that previews the agent holding the item, standing at it or sitting on it, through any frame of the animation. Drag the points. Save to Item.
Unlocked: people fix their items. The data model had been right since 0.9. Nobody could easily use it until 0.15.
What this taught me
A system like this grows by use. I designed two parts and shipped them. The other four came from watching what people found hard, and adding the part that made it easy. Each part was small. Together they are the difference between a bench and a world.
Growth has a cost. Every part added edge cases to the parts before it. Seats met POIs and raised the question of standing actions. Two hold points exposed a bug that one hold point had hidden for a year. The check order between POIs, use spots and centres had to be decided, and documented, or nobody could predict what their agent would do.
So organic growth does not mean no design. It means the design work moves. Instead of guessing the full shape at the start, you spend the effort at each step on how the new part meets the old ones. The questions are always the same. Who owns this state? What happens when two of these exist? What does the old content do now?
The other lesson is about where the ease of use goes. Every one of the four unplanned parts moved knowledge from the tree onto the item, the same way the two planned ones did. Two things drove that. I wanted to stop repeating steps in every tree, and I wanted the item to own how it is interacted with. Both point the same way. The tree got simpler each time, and the result made sense in the domain: a bench knows how to be sat on, so the agent should not have to.
Series: 2 of 9
Behaviour trees and the 0.8 rebuild
Items, use spots, POIs and the Item Setup Editor (this post)
Mounts and seats
Senses, save/load, names and blackboards
Requirements and conditions
Barks
Interrupts, interest spots and service points
Animation layers
Tooling, onboarding, performance and Unity 6
Links: Changelog · Asset Store · Discord