Skip to content

Commit 68da351

Browse files
committed
release: stabilize CoreAI 5.2.0
1 parent b300efb commit 68da351

82 files changed

Lines changed: 3406 additions & 316 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Assets/CoreAI.Demos/DirectorAi.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Director AI recipe (Ambient Agent, No Chat Box)
2+
3+
> This folder is a reusable controller recipe, not a standalone `.unity` scene. Add it to one of
4+
> your existing CoreAI scenes using the setup steps below.
5+
6+
A **configured LLM backend** is required in `CoreAISettings` (LLMUnity model or HTTP API:
7+
LM Studio, OpenAI, etc.).
8+
9+
## What It Shows
10+
11+
Most CoreAI demos are chat-driven: a player types, an NPC answers. This demo shows the **other
12+
audience** for game agents - the **director / ambient pattern**, where there is no chat box at all:
13+
14+
- On a timer (default **every 20 seconds**) the controller gathers a **compact world snapshot**:
15+
player position (if a `Player`-tagged object exists), the active scene's root object count, and
16+
optional per-tag object counts.
17+
- The snapshot is sent as a single `[Observation] ...` line to a **game-director agent** built with
18+
`AgentBuilder` (`ToolsAndChat` mode).
19+
- The director may **act through tools** - it gets the standard `world_command` tool (spawn / move /
20+
recolor / destroy objects through the same audited world-command pipeline the chat demos use) - or
21+
reply with a **short directive** line. Replying `PASS` means "nothing needed right now".
22+
- Directives are written to the Console (`[DirectorAiDemo] ...`) and shown as one cached OnGUI line.
23+
24+
Safety rails built in:
25+
26+
- A new observation is **never issued while the previous request is in flight**.
27+
- A **max actions per minute** cap (rolling 60s window, default 3) bounds token spend and world churn.
28+
- An **enabled toggle** lets you pause the director without removing the component.
29+
30+
## Setup
31+
32+
1. Create a CoreAI scene: menu **CoreAI → Setup → Create Bare Scene (advanced)** (or use any scene
33+
that already has a `CoreAILifetimeScope`).
34+
2. Make sure `Resources/CoreAISettings` has a working LLM backend selected.
35+
3. Add **`DirectorAiDemoController`** to any GameObject in that scene.
36+
4. (Optional) Tag your player object `Player`, and list gameplay tags (e.g. `Enemy`, `Pickup`) in
37+
**Tracked Tags** so their counts appear in observations.
38+
5. Press **Play**.
39+
40+
## What to Expect
41+
42+
- On start: `[DirectorAiDemo] Director 'Director' registered. Observing every 20s.`
43+
- Every interval the director receives an observation like:
44+
45+
```
46+
[Observation] t=40s; player=(1.5, 0.0, -3.2); sceneRootObjects=7; Enemy=2. Act via your tools if the moment needs direction; otherwise reply PASS.
47+
```
48+
49+
- The model either calls `world_command` (you will see objects spawn / move / recolor in the scene)
50+
and replies with a one-line directive, or replies `PASS` when the world needs nothing. The last
51+
directive is shown in the top-left OnGUI line and logged to the Console.
52+
53+
Inspector fields: observation interval, director role id (`Director`), max output tokens, enabled
54+
toggle, max actions per minute, tracked tags.
55+
56+
## Pointing the Snapshot at Your Own Game State
57+
58+
The snapshot lives in one method: `DirectorAiDemoController.BuildObservationPrompt()`. Replace or
59+
extend it with whatever your game already knows - wave number, player health, score, quest flags,
60+
difficulty, time since last reward - keeping the same shape:
61+
62+
```
63+
[Observation] <compact key=value facts>. Act via your tools if the moment needs direction; otherwise reply PASS.
64+
```
65+
66+
Keep it to one short line: the director runs forever, so per-observation token cost is what you are
67+
budgeting. Give the agent more levers by adding tools in `Start()` (`.WithTool(...)` on the
68+
`AgentBuilder`), and tune the persona in the system prompt (pacing rules, "never touch X", theme).
69+
70+
Details: `Assets/CoreAI/Docs/AGENT_BUILDER.md`, `Assets/CoreAiUnity/Docs/WORLD_COMMANDS.md`.

Assets/CoreAI.Demos/DirectorAi/README.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/CoreAI.Demos/DirectorAi/Scripts.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)