Skip to main content
Version: 0.13.0

Example Scenes

CIVIL-AI-SYSTEM ships with working scenes covering the main features. They are the fastest reference for "how is this actually wired up".

If you just want to see the system run, Your First Scene is the quicker read. This page is the reference.

The Example Scenes window

BardTreeLtd/Civil AI/Examples/Create Example Scene

The window does two things: it lists the scenes already present in Assets/BardTreeLtd/CIVIL-AI-SYSTEM/Examples/Scenes with an Open button each, and it offers cards that generate feature scenes on demand.

warning

Create Scene replaces the scene of that name. Rename or move a generated scene before editing it if you want to keep your changes. The upside is that a broken experiment is one click from being reset.

Shipped scenes

These are present after import and opened from the Open Existing Scene list.

SceneWhat it is
Example SceneThe hand-authored demo town — houses, workplaces, items, lighting and a baked NavMesh. The best starting point, and the template the derived scenes are copied from.
Inventory SceneItem carrying, inventory POIs and handling.
Performance SceneA large population for testing render banding and LOD settings.

Generated scenes

Each card builds a scene around a single feature. Two are built from scratch with their own baked NavMesh; Bespoke Agents is copied from Example Scene because it needs a populated world to demonstrate anything.

Bespoke Agents

Work repository Demo0.3.0, need repository Basic.

A copy of the Example Scene with a hand-placed agent in every workplace position, each assigned a home, instead of the population region spawning them from the character pool.

The PopulationRegionService is disabled here on purpose. Use this scene as the reference when you want authored, named characters rather than a procedurally populated crowd — each agent is a BespokeAgent named after its job, with homes handed out in turn.

Route Usage

Work repository Patroller, need repository Basic.

A patrolling agent that follows a fixed route there and back over the workplace's waypoints.

The route lives on the workplace as a RouteAction with four corner points. The Patroller tree issues Follow Route and Follow Route Reverse, so the agent walks the circuit and then retraces it. This is the reference for any patrol, delivery round or repeating path.

Slot System

Work repository Slot Example, need repository Basic.

An agent that picks up items of different sizes into matching inventory slots.

The scene contains a workshop, a stocker agent, a Plank and a Wood, and a Storage item carrying two slots typed SMALL and MEDIUM. Watch which item ends up in which slot — that matching is what the scene exists to show. See Agent Inventory for the underlying model.

Per-scene behaviour repositories

Which behaviour trees load is normally a project-wide setting: the work and need repository fields in Module Settings. That is a problem for example scenes, because a patrol scene and an inventory scene need different trees and only one can be selected at a time.

Generated scenes solve this with two components on an ExampleBootstrap object:

  • ExampleSceneBootstrap — runs before other scene scripts, applies the override, then initialises the modules.
  • ExampleBehaviourRepositoryOverride — two fields, workRepository and needRepository, naming the folders that scene wants.

The override is cleared when the object is destroyed, so leaving one scene does not affect the next.

This is useful well beyond the examples. If your project has scenes with genuinely different behaviour needs — a combat test scene and a town scene, say — you can use the same components rather than editing Module Settings between them. The component has a custom inspector offering a dropdown of installed repositories.

Leave either field blank to fall back to the global Module Settings value for that one.

Behaviour repositories that ship

Under Assets/BardTreeLtd/Resources/CIVIL-AI-SYSTEM/BehaviourTree/:

RepositoryKindUsed by
Demo0.3.0WorkExample Scene, Bespoke Agents
DemoWorkOlder scenes
WeightingWorkBehaviour weighting demonstration
PatrollerWorkRoute Usage
Slot ExampleWorkSlot System
BasicNeedAll example scenes

Remember that these fields take a folder name, not an asset path.

Example item prefabs

Assets/BardTreeLtd/CIVIL-AI-SYSTEM/Examples/Prefab/Item/ contains Plank, Saw, Tree and Wood.

These are worth studying before authoring your own: each carries the Item component plus the Action and Inventory POIs, handle points and animation groups that behaviour trees actually drive. A primitive cube with an Item component on it will not behave the same way, and the difference is usually the missing POIs.

If you have older scenes containing hand-built items, BardTreeLtd/Civil AI/Examples/Upgrade Example Items To Prefabs swaps them for these prefabs, matching on item name key and preserving the workplace's item ordering.

Dialogue examples

DIALOGUE-SYSTEM ships its own numbered tutorial scenes, from 1 - Hello World through 8 - NPC to NPC, generated from BardTreeLtd/Dialogue/Examples/Create Example Scene. See the Dialogue guides if you have that product.

Next step

Continue to Common Issues if a scene is not behaving, or Introduction to Behaviours to start authoring your own.