A real-time strategy game in a child's room: toy soldiers, Unity 6 (URP, 3D), two players over Photon Fusion 2 (host mode). Each player has an AI Commander: an LLM agent that reads a fog-filtered snapshot through nine MCP tools, answers rules questions with hybrid RAG (BM25 + embeddings), and proposes a schema-validated action plan that the player approves or rejects. Laya, a small fast decision layer (ai/laya), answers routine situations from a taught move book and hands the harder ones to the LLM.
| Path | Content |
|---|---|
Assets/_Project/ |
Game code, scenes (map_childroom), GameData, EditMode tests |
ai/ |
Python AI layer: gateway/ (FastAPI), agent/, mcp_server/, rag/, laya/, contracts/ |
evaluation/ |
Prompt set, runners, metrics and results |
scripts/ |
setup-ai.ps1, run-gateway.ps1 |
docs/ |
Demo rehearsal and evidence |
TASKS.md |
Task board and status |
- Unity 6000.6.2f1
- Python 3.12 (for
ai/) - Ollama with
llama3.1:8b(optional; local fallback) - Groq API key (optional; the default provider is groq-first, falling back to Ollama)
scripts\setup-ai.ps1
It creates ai/.venv, installs the dependencies, installs PyTorch (CPU build, about 200 MB; without it Laya returns
503 and the rest still works), pulls llama3.1:8b if Ollama is installed, creates ai/.env with a random
GATEWAY_TOKEN (never printed), and runs the tests. Flags: -DryRun, -SkipOllama, -SkipTests.
Put GROQ_API_KEY in ai/.env yourself if you want Groq. Never commit ai/.env.
- Open the project in Unity and load
Assets/_Project/Scenes/map_childroom.unity. - Start the gateway in a terminal:
scripts\run-gateway.ps1(http://127.0.0.1:8765). - Press Play. K toggles the AI Commander panel; T opens the Laya teach panel.
- Build to a folder outside the repo (for example
C:\Builds\Emberfront). - Host in the Editor or from the exe, join from the other instance. Command-line form:
Emberfront.exe -screen-fullscreen 0 -screen-width 1024 -screen-height 600 -host RoomNameand the same with-join RoomName(-screen-fullscreen 0keeps it windowed). - The Photon region is pinned to
eu. Both sides must use the same region; override with-region <code>.
The Editor reads the token from ai/.env. A build does not, so give it the gateway token either way:
- a
gateway_token.txtnext toEmberfront.exe, or - the environment variable
EMBERFRONT_GATEWAY_TOKEN.
Copy it from ai/.env into the file without printing it (PowerShell, from the repo root; adjust the target folder):
$t = (Select-String -Path ai\.env -Pattern '^GATEWAY_TOKEN=(.+)$').Matches[0].Groups[1].Value
[IO.File]::WriteAllText('C:\Builds\Emberfront\gateway_token.txt', $t)
The gateway URL can be changed with EMBERFRONT_GATEWAY_URL (default http://127.0.0.1:8765).
- Unity EditMode: Window > General > Test Runner > EditMode (
Assets/_Project/Tests/EditMode). - Python:
cd aithen.venv\Scripts\python -m pytest -q - Evaluation:
evaluation/README.md(ai\.venv\Scripts\python evaluation\run_eval.py, thenevaluation\metrics.py)
ai/README.md: AI layer overview, env varsai/laya/README.md: Laya design and teachingevaluation/results/laya.md: Laya evaluation (2026-11-24)evaluation/results/summary.md: model and agent comparisonTASKS.md: task status