A step-by-step learning repository for building a 3D AI combat demo in Unity 6 — progressing from traditional game AI (FSM, NavMesh, perception) through to modern ML inference (ML-Agents, Sentis/ONNX).
- Overview
- Current Status
- Milestones
- Quick Start
- Project Structure
- Remote Development
- Engineering Foundations
- Documentation
- Contributing
- License
This repository builds a complete AI combat demo in phases — one player versus multiple enemies. Each phase introduces a new AI technique, progressing from simple finite state machines to trained neural network inference at runtime.
Every milestone produces runnable, verifiable, and documented output. The project is AI-assisted via Claude Code + DeepSeek and remotely controllable via Feishu + OpenClaw.
| Phase | Technology | What You'll See |
|---|---|---|
| M1 Traditional AI | FSM, NavMesh, Perception | Enemies patrol, detect, chase, and attack |
| M2 Behavior & Swarm | Unity Behavior, Group Behavior | Coordinated squad tactics, dynamic decision trees |
| M3 ML-Agents | PPO, TensorBoard | Self-trained agents with observable reward curves |
| M4 Sentis Inference | ONNX, Burst CPU | Real-time neural network inference in-game |
| M5 Integration & Delivery | CI, Demo Video | Reproducible full demo from scratch |
Detailed roadmap: docs/planning/learning-roadmap.md
M0, M1, and M2 are complete. M3 (ML-Agents Reinforcement Learning) is ready to begin.
| Item | Status |
|---|---|
| Unity 6 URP Project | ✅ |
| Package Installation | ✅ 5 core packages |
| Base Scene + Smoke Test | ✅ |
| Git LFS + CI + Docs | ✅ |
| Feature | Status |
|---|---|
| Patrol / Chase / Attack / Death | ✅ |
| Raycast occlusion | ✅ |
| Scene | Demo1_FSM.unity |
| Feature | Status |
|---|---|
| C# Behavior Tree (Selector/Sequence) | ✅ |
| Swarm separation (Boids 3 rules) | ✅ |
| Unity Behavior evaluated → C# BT chosen | ✅ |
| Scenes | Demo2_Behavior.unity / Demo2_Swarm.unity |
Full status: PROGRESS.md | TODO.md
| Milestone | Status | Deliverables |
|---|---|---|
| M0 Project Foundation | ✅ Complete | Unity 6 skeleton, packages, CI, docs system |
| M1 Traditional Game AI | ✅ Complete | FSM + NavMesh patrol/chase/attack, Demo1_FSM scene |
| M2 Behavior Tree & Swarm | ✅ Complete | C# BT + Boids separation, Demo2 scenes |
| M3 ML-Agents Training | 🟡 In Progress | PPO training, TensorBoard, ONNX model |
| M4 Sentis Inference | ⏳ Pending | ONNX import, Burst CPU runtime inference |
| M5 Final Delivery | ⏳ Pending | Full demo, CI green, video walkthrough |
Build a training environment where an agent learns combat behavior through PPO (Proximal Policy Optimization).
| Task | Description |
|---|---|
| Python Setup | Install mlagents Python package for training |
| Training Scene | Create TrainEnv.unity with Agent + environment |
| Custom Agent | Define observations (player position, distance), actions (move, attack), rewards (hit=+1, miss=-0.1) |
| PPO Training | Write YAML config, run mlagents-learn, monitor TensorBoard |
| ONNX Export | Export trained model, verify inference in Unity |
Prerequisite: Python 3.10+ with
mlagentspackage installed.
Detailed plan: M0 Task Plan | Architecture Decisions
| Tool | Version | Purpose |
|---|---|---|
| Unity Hub + Unity 6 | 6000.4.5f1+ | Editor & runtime |
| Git | 2.40+ | Version control |
| Git LFS | 3.x | Large binary storage |
GitHub CLI (gh) |
2.x | PR, Issue, CI management |
| PowerShell | 5.1+ | Automation scripts |
git clone https://github.com/YIMO691/Unity-AI-LearningDemo.git
cd Unity_AI
git lfs install- Launch Unity Hub
- Click Open → select
Unity_AI/UnityProject/ - Wait for package restoration and script compilation
- Open
Assets/_Project/Scenes/Main.unity - Press Play — should see gray ground with lighting, no Console errors
Window → General → Test Runner → EditMode → Run All
Should show SmokeTest.Project_CanRunEditModeTest ✅ 1/1 passing.
powershell -ExecutionPolicy Bypass -File ".\tools\mobile-status.ps1"$env:DEEPSEEK_API_KEY="sk-your-key"
.\scripts\start-claude-deepseek.cmd
⚠️ Never commit API keys. See.env.examplefor configuration reference.
F:\Unity6_AI
├─ .claude/ # Claude Code skills, rules, commands
├─ .github/ # CI workflows, PR/Issue templates, CODEOWNERS
├─ .openclaw/ # OpenClaw Gateway state & agent config
├─ docs/ # All project documentation
│ ├─ planning/ # Plans, milestones, ADR, package manifest
│ ├─ status/ # PROGRESS.md, TODO.md, AI_DEV_LOG.md
│ ├─ reference/ # Manuals, conventions, skills manifest
│ ├─ workflows/ # Setup guides (CI, GitHub, Feishu, Claude Code)
│ ├─ environment/ # Environment reports
│ └─ templates/ # Reusable file templates
├─ LearningBlog/ # Structured learning notes
├─ Logs/ # Runtime logs (not committed)
├─ prompts/ # AI session starter prompts
├─ scripts/ # Claude Code + DeepSeek startup scripts
├─ tools/ # Automation PowerShell scripts
│ ├─ claude-code-relay.ps1 # Relay: Feishu → Claude Code
│ ├─ mobile-status.ps1 # Phone-friendly project status
│ └─ cc-*.ps1 # /cc, /cc-run, /cc-status, /cc-session commands
├─ UnityProject/ # Unity 6 project root
│ └─ Assets/_Project/ # Project source code & assets
│ ├─ Art/ # Materials, models, textures
│ ├─ Prefabs/ # Reusable prefabs
│ ├─ Scenes/ # Main.unity and future scenes
│ ├─ Scripts/ # C# scripts (Core/AI/Player/Training)
│ └─ Tests/ # EditMode + PlayMode tests
├─ LICENSE # MIT license
├─ CLAUDE.md # Claude Code project instructions
├─ AGENTS.md # AI agent handoff notes
├─ CONTRIBUTING.md # Contribution guide
├─ SECURITY.md # Security policy
└─ README.md # This file
Control this project from your phone via Feishu + OpenClaw. Check progress, dispatch coding tasks, and monitor CI — all through chat. The relay architecture enforces safety boundaries: read-only commands never modify files, write commands require explicit authorization.
Feishu Mobile → OpenClaw Gateway → unity6ai Agent → Claude Code Relay → Claude Code + DeepSeek → Result → Feishu
| Command | Mode | Function |
|---|---|---|
/cc |
Read-only | Project status, TODO check, log analysis |
/cc-run <task> |
Edit (restricted) | Execute task via relay with safety rules |
/cc-run-big <task> |
Edit (unrestricted) | Direct Claude Code execution for large tasks |
/cc-status |
Read-only | Current Claude Code task state |
/cc-last |
Read-only | Last execution summary |
/progress |
Read-only | Mobile-optimized project progress |
Setup guide: Feishu + OpenClaw Deployment Relay guide: Claude Code Relay
| Foundation | File | Purpose |
|---|---|---|
| Architecture Decisions | ADR | 8 technical decisions with rationale |
| File Organization | Convention | Where every file type belongs |
| Skills Manifest | Manifest | 20 active skills with decision flow |
| Coding Rules | C# Rules | Unity C# conventions, Inspector, validation |
| Git LFS | .gitattributes | Binary file tracking (ONNX, FBX, textures, audio) |
| CI Pipeline | unity-ci.yml | GitHub Actions: compile + EditMode tests |
| Package Versions | Manifest | Locked versions for reproducibility |
| Security Policy | SECURITY.md | Vulnerability reporting & scope |
| Document | Purpose |
|---|---|
| CLAUDE.md | Claude Code project instructions |
| AGENTS.md | AI agent handoff notes |
| CONTRIBUTING.md | Contribution guide & PR checklist |
| SECURITY.md | Security policy & reporting |
| LICENSE | MIT license |
| Document | Purpose |
|---|---|
| project-brief.md | Project requirements & milestone summary |
| learning-roadmap.md | Phased learning path |
| milestone-m0-plan.md | M0 detailed task breakdown |
| architecture-decisions.md | Architecture Decision Records (8 ADRs) |
| package-manifest.md | Locked Unity package versions |
| Document | Purpose |
|---|---|
| PROGRESS.md | Current progress & completed items |
| TODO.md | Task backlog & acceptance criteria |
| AI_DEV_LOG.md | AI collaboration log |
| Document | Purpose |
|---|---|
| manual.md | Original learning manual (read-only archive) |
| file-organization-convention.md | File placement rules & root whitelist |
| skills-manifest.md | 20 skills inventory with decision flow |
| Document | Purpose |
|---|---|
| claude-deepseek-workflow.md | Claude Code + DeepSeek setup |
| github-setup.md | GitHub repository creation |
| feishu-openclaw-deployment.md | Remote development setup |
| claude-code-relay.md | Claude Code relay script guide |
| skills-strategy.md | Skills/agents/hooks adoption strategy |
| docs/README.md | Documentation index & audit |
| Document | Topic |
|---|---|
| LearningBlog/README.md | Blog index by date & tag |
| Toolchain Setup | SSH Key, Git LFS, GitHub CLI deep-dive |
| Remote Dev Chain | OpenClaw + Feishu + Claude Code relay |
This is a personal learning project. Suggestions and discussions are welcome via GitHub Issues. Code contributions should follow the conventions in CONTRIBUTING.md, CLAUDE.md, and .claude/rules/unity-csharp.md.
milestone/m{N}-{slug}
# Examples: milestone/m1-fsm, milestone/m2-behavior
- Communication in Chinese, identifiers in English
[SerializeField] privateoverpublicfields- AI parameters exposed in Inspector
- After writing code, always explain: which GameObject, which components, how to verify
- Never commit: API keys, Unity Library, Temp, training artifacts, user settings
MIT — see LICENSE for details.
Built with Unity 6 | AI-assisted by Claude Code + DeepSeek | Remote-controlled via Feishu + OpenClaw