Skip to content

🎓 AI Agent for Master Game Design

Khóa học thực chiến: Xây dựng hệ thống Multi-AI-Agent để phát triển game RTS từ ý tưởng đến production

Case Study: Polymer Wars — Game RTS 8 người chơi, phát triển 100% bởi AI Agents

Thời lượng: 12 tuần (60 giờ học + 40 giờ thực hành)


Mục lục


Tổng quan khóa học

Bạn sẽ học được gì?

Khóa học này dạy bạn cách thiết kế, xây dựng và vận hành hệ thống Multi-AI-Agent để phát triển game hoàn chỉnh — từ ý tưởng ban đầu đến sản phẩm production. Thay vì chỉ dùng AI như công cụ hỗ trợ, bạn sẽ tạo ra một "công ty phần mềm ảo" nơi mỗi AI Agent đóng một vai trò chuyên biệt (Project Manager, Game Designer, Backend Dev, Frontend Dev, Tester, DevOps...) và phối hợp tự động với nhau.

Tại sao khóa học này độc đáo?

Khóa học thông thườngKhóa học này
Dùng AI để generate codeThiết kế hệ thống AI Agent tự vận hành
1 AI assistant đa năng12+ agent chuyên biệt với vai trò rõ ràng
Prompt engineering cơ bảnAgent governance, memory, event-driven coordination
Không có quy trìnhPhase-gated pipeline với quality gates
Output: code snippetsOutput: game hoàn chỉnh có thể deploy

Case Study xuyên suốt: Polymer Wars

Toàn bộ khóa học xoay quanh dự án thực tế Polymer Wars — một game RTS multiplayer 8 người chơi được phát triển hoàn toàn bởi AI Agents:

Ngày 1 (commit: 91ada6d) — IDEA: Ý tưởng game RTS nhựa post-apocalyptic
     ↓ 2 giờ sau
Ngày 1 (commit: aadbe0f) — Agent definitions + README game design document
     ↓ 30 phút
Ngày 1 (commit: e684ff6) — Core game systems: 20+ server systems, client scenes
     ↓ 13 phút
Ngày 1 (commit: 94482f6) — Interpolation, minimap, building upgrades
     ↓ 83 phút
Ngày 1 (commit: 9223e63) — Diplomacy system with alliances & betrayal
     ↓ ...
Ngày 2 (commit: feea17b) — HUD visuals, resource display, gameplay guide

Từ ý tưởng đến game chạy được trong ~24 giờ, với hệ thống 12 AI Agents phối hợp tự động.


Đối tượng học viên

  • Game Designers muốn leverage AI để prototype nhanh và iterate game design
  • Software Engineers muốn master kỹ thuật Multi-Agent orchestration
  • Technical Directors / Leads muốn hiểu cách tổ chức AI-driven development
  • AI Enthusiasts muốn đi sâu hơn prompt engineering — vào agent architecture
  • Indie Game Developers muốn "nhân bản" năng lực team bằng AI

Yêu cầu đầu vào

Bắt buộcKhuyến khích
Biết TypeScript hoặc JavaScript cơ bảnKinh nghiệm với game engine (Phaser, Unity, Godot)
Có tài khoản GitHub CopilotHiểu Docker cơ bản
VS Code đã cài đặtBiết về WebSocket, REST API
Máy tính chạy DockerĐã từng dùng AI code assistants

Lộ trình học 12 tuần

Tuần    Module                                          Focus
────────────────────────────────────────────────────────────────────────
 1-2    Module 1: Nền tảng AI Agent                     Concept, Prompt Design
 3-4    Module 2: Kiến trúc Multi-Agent System          Agent Hierarchy, SSoT
 5-6    Module 3: Agent Communication & Memory          RabbitMQ, ChromaDB
 7-8    Module 4: Game Design với AI Agent Pipeline     Phase Execution
 9-10   Module 5: Quality Governance & Autonomous Loop  SuperAgent, Gates
11-12   Module 6: Production & Capstone Project         Deploy, Scale, Ship

────────────────────────────────────────────────────────────────────────
        ┌─────────────────────────────────────────────────────────────┐
        │                    PROGRESSION MAP                          │
        │                                                             │
        │  Beginner          Intermediate         Advanced            │
        │  ┌────────┐       ┌──────────────┐     ┌───────────────┐   │
        │  │Module 1 │──────▶│ Module 2 & 3 │────▶│ Module 4 & 5  │  │
        │  │Concepts │       │Architecture  │     │ Execution     │  │
        │  └────────┘       └──────────────┘     └──────┬────────┘  │
        │                                               │            │
        │                                        ┌──────▼────────┐   │
        │                                        │   Module 6    │   │
        │                                        │   Mastery     │   │
        │                                        └───────────────┘   │
        └─────────────────────────────────────────────────────────────┘

Module 1: Nền tảng AI Agent (Tuần 1-2)

Mục tiêu: Hiểu AI Agent là gì, tại sao cần multi-agent, và cách viết agent prompt chuyên nghiệp

Tuần 1 — Tư duy Agent-First

Bài 1.1: AI Agent vs AI Assistant — Sự khác biệt cốt lõi

Lý thuyết (2h):

  • AI Assistant: Reactive, trả lời khi được hỏi, không có state
  • AI Agent: Proactive, có vai trò, có memory, có workflow
  • Agent = Identity + Context + Tools + Rules + Memory
  • Demo: So sánh ChatGPT trả lời câu hỏi vs Agent tự động implement feature

Thực hành (2h):

  • Tạo agent prompt đầu tiên trong VS Code (file .md với YAML frontmatter)
  • Cấu trúc: name, description, tools, agents, handoffs
  • Test với GitHub Copilot Chat: @YourAgent implement a hello world

Bài đọc: .github/agents/README.md (mục Overview + Agents table)

Bài 1.2: Anatomy of a VS Code Chat Agent

Lý thuyết (2h):

  • YAML frontmatter format: name, description, argument-hint, tools, agents, handoffs
  • Sections: Identity, Context Source, Responsibilities, Workflow, Rules
  • Tools available: search, read, edit, create, execute/runInTerminal, vscode/*, chroma/*, rabbitmq/*
  • Handoff mechanism: Agent-to-agent delegation

Thực hành (2h):

  • Phân tích cấu trúc agent prompt thực tế: backend-dev.md
    • Identity: "You are the Backend Developer..."
    • Context Source: "ALWAYS read README.md..."
    • Tech Stack table
    • Project Structure tree
    • Phase-by-Phase Deliverables with checkboxes
    • Coding Standards
    • Rules (numbered list)
  • Viết agent prompt cho vai trò "Code Reviewer"

Git reference: Commit aadbe0f"Add Tester Agent documentation and enhance README with game design details"

Bài 1.3: Single Source of Truth (SSoT) Pattern

Lý thuyết (1h):

  • Vấn đề: Nhiều agent = risk thông tin không nhất quán
  • Giải pháp: Một document duy nhất là "luật" — tất cả agent đều đọc nó
  • SSoT trong Polymer Wars: README.md chứa game design, architecture, balance, phases
  • Rule: "If it's not in README.md, it's not in the game"

Thực hành (1h):

  • Đọc Polymer Wars README.md — nhận diện các section: Game Design, Architecture, Balance Constants, Development Phases
  • Viết SSoT document cho một game đơn giản (ví dụ: Tower Defense)

Tuần 2 — Agent Prompt Engineering nâng cao

Bài 1.4: Thiết kế Role-Based Agents

Lý thuyết (2h):

  • Nguyên tắc Single Responsibility: Mỗi agent một vai trò
  • Agent roles trong software team:
AgentTrách nhiệmScope
Project ManagerLên kế hoạch, giao task, viết reportToàn dự án
Business AnalystRequirements, specs, acceptance criteriadocs/specs/
Game DesignerThiết kế game, cân bằng, sở hữu READMEREADME.md
Frontend DevPhaser 3 client, rendering, UIclient/
Backend DevBun server, game logic, networkingserver/
TesterTesting, QA, performanceTests
DevOpsCI/CD, Docker, deploymentInfrastructure
Asset CreatorSprites, audio, visual assetsAssets
  • Anti-pattern: Agent "biết tuốt" — dẫn đến output kém chất lượng
  • Best practice: Scope rõ ràng + rules nghiêm ngặt

Thực hành (2h):

  • Thiết kế bộ 4 agents cho game Tower Defense: Designer, Builder (backend), Renderer (frontend), Tester
  • Mỗi agent có: Identity, Context, Responsibilities, Rules
  • Test cross-agent delegation: Designer → Builder → Renderer → Tester

Git reference: Commits 91ada6daadbe0f — Từ IDEA đến full agent system trong 30 phút

Bài 1.5: Context Injection — Cho agent đúng thông tin

Lý thuyết (2h):

  • Context Source section: Agent cần đọc gì trước khi làm việc
  • Priority ordering: SSoT (README) > Phase Reports > Conversation Logs > Codebase
  • Phase-by-Phase Deliverables: Checklist per phase để agent biết phải làm gì
  • Tech Stack / Project Structure: Cho agent "bản đồ" của dự án
  • Coding Standards: Rules cụ thể về code style

Thực hành (2h):

  • So sánh output của agent vs không có context injection
  • Thử nghiệm: Cùng một task, thay đổi context → quan sát chất lượng output
  • Tối ưu context cho Backend Dev agent: thêm/bớt sections, đo impact

Bài 1.6: Rules — Kỷ luật cho Agent

Lý thuyết (1h):

  • Rules = constraints cứng mà agent PHẢI tuân theo
  • Dạng rules:
    • ALWAYS DO: "ALWAYS run bun run check after changes"
    • NEVER DO: "NEVER calculate damage on client"
    • CONDITIONAL: "IF build fails → fix immediately"
  • Anti-patterns list: Các lỗi mà agent hay mắc
  • Rule enforcement: Tại sao cần bold, uppercase, cụ thể

Thực hành (1h):

  • Phân tích 15 rules của Frontend Dev agent — hiểu lý do từng rule
  • Phân tích 18 Anti-Patterns của Autonomous agent
  • Viết 10 rules cho "Database Admin" agent
  • Test: Thử xóa rules → quan sát agent "phá rules" như thế nào

Deliverable Module 1: Bộ 4 agent prompts hoàn chỉnh cho mini game project


Module 2: Kiến trúc Multi-Agent System (Tuần 3-4)

Mục tiêu: Thiết kế hierarchy, authority model, và orchestration pattern cho hệ thống nhiều agent

Tuần 3 — Agent Hierarchy & Authority

Bài 2.1: Authority Hierarchy — Ai chỉ huy ai?

Lý thuyết (2h):

                    ┌─────────────────┐
                    │   SUPER AGENT   │ ← Quyền tối cao
                    │  Quality Guard  │ ← Duy nhất được sửa agent prompts
                    └────────┬────────┘

                    ┌────────▼────────┐
                    │ README.md (SSoT)│ ← Luật game design
                    └────────┬────────┘

                    ┌────────▼────────┐
                    │ Project Manager │ ← Điều phối vận hành
                    └────────┬────────┘

        ┌──────┬──────┬──────┼──────┬──────┬──────┐
        ▼      ▼      ▼      ▼      ▼      ▼      ▼
       BA   Designer  FE    BE   Tester  DevOps  Asset
  • Super Agent: Quyền tối cao — duy nhất được sửa .github/agents/
  • SSoT (README.md): "Luật" — không ai implement feature không có trong README
  • Project Manager: Điều phối — giao task, theo dõi tiến độ
  • Specialist Agents: Thực thi — mỗi agent một domain

Decision authority matrix:

Quyết địnhAi quyết?
Sửa agent promptSuper Agent (duy nhất)
Thay đổi game designGame Designer → cập nhật README
Giao task, lên kế hoạchProject Manager
Technical decisions (server)Backend Dev
Phase gate approvalPM đề xuất + Super Agent phê duyệt

Thực hành (2h):

  • Vẽ authority hierarchy cho dự án của bạn
  • Xác định: Ai được sửa gì? Ai phê duyệt gì?
  • Test conflict scenario: 2 agents muốn approach khác nhau → hierarchy giải quyết

Git reference: Commit 2ff5ccd"establish inter-agent communication protocol and update agent guidelines"

Bài 2.2: Autonomous Orchestrator — Master Loop

Lý thuyết (3h):

┌──────────────────────────────────────────────────────────────────┐
│                     MASTER CREATION LOOP                         │
│                                                                  │
│  ┌──────────┐    ┌──────────┐    ┌──────────┐    ┌───────────┐  │
│  │ 1. ASSESS │───▶│ 2. PLAN  │───▶│2b.CREATE │───▶│ 3. EXECUTE│  │
│  │   State   │    │   Tasks  │    │  Ideate  │    │   Tasks   │  │
│  └──────────┘    └──────────┘    └──────────┘    └─────┬─────┘  │
│       ▲                                                │        │
│       │          ┌──────────┐    ┌──────────┐    ┌─────▼─────┐  │
│       └──────────│ 5. GATE  │◀───│ 4. VERIFY │◀──│3b.POLISH │  │
│                  │  Approve │    │   Quality │    │  Refine   │  │
│                  └─────┬────┘    └───────────┘    └──────────┘  │
│                        │                                        │
│                  ┌─────▼────┐                                   │
│                  │ 6. NEXT  │                                   │
│                  │  Phase   │                                   │
│                  └──────────┘                                   │
└──────────────────────────────────────────────────────────────────┘

6 bước của Master Loop:

  1. ASSESS: Đọc SSoT, xác định phase hiện tại, scan codebase
  2. PLAN: Chia task, xác định dependencies, giao cho agents
  3. 2b — CREATIVE IDEATION: Brainstorm ý tưởng sáng tạo trước khi code
  4. EXECUTE: Thực thi task theo thứ tự dependency
  5. 3b — POLISH: Quality pass cho visual, UX, performance
  6. VERIFY → GATE → ADVANCE: Kiểm tra → Phê duyệt → Phase tiếp theo

Thực hành (1h):

  • Đọc autonomous.md — hiểu từng step của Master Loop
  • Map loop vào dự án thực tế: bạn sẽ ASSESS, PLAN, EXECUTE gì?
  • Identify: Step nào cần delegation? Step nào agent tự làm?

Bài 2.3: Phase-Gated Development

Lý thuyết (2h):

PhaseFocusQuality Gate
Phase 1: FoundationServer + Client skeleton, basic gameplayServer boots, client connects, HQ renders
Phase 2: Combat & BuildingsFull units, combat, buildings, HUDAll units trainable, combat resolves
Phase 3: Advanced MechanicsDiplomacy, pollution, events, super weaponsAlliances work, events trigger
Phase 4: Polish & ModesGame modes, spectator, audio, VFXAll modes playable, 60 FPS
Phase 5: ProductionAuth, ranking, deploy, load testCI green, 8-player stress test
  • Mỗi phase có explicit pass/fail criteria
  • PM đề xuất → Super Agent phê duyệt
  • Fail → remediation → re-review (không skip)
  • Phase reports: docs/reports/phase-N-report.md

Thực hành (2h):

  • Đọc phase reports thực tế: docs/reports/phase-2-report.mdphase-5-report.md
  • Thiết kế 3 phases cho game Tower Defense với quality gates cụ thể
  • Viết một phase report template

Git reference: Quan sát tốc độ development qua lịch sử Git:

  • e684ff6ba204c1: 5 commits trong 3 giờ = Phases 1-4 core features

Tuần 4 — Orchestration Patterns & Delegation

Bài 2.4: Handoff Pattern — Agent giao việc cho Agent

Lý thuyết (2h):

  • YAML handoff config:
    yaml
    handoffs:
      - label: Assign to Backend Dev
        agent: BackendDev
        prompt: 'Implement the following server-side task'
        send: true
  • Khi nào delegate vs tự làm?
    • Simple/shared types → Autonomous tự implement
    • Complex systems (Combat, Diplomacy) → Delegate to specialist
    • Testing → Always delegate to Tester
    • Specs → Always delegate to BA
  • Delegation chain: PM → BA → BackendDev → FrontendDev → Tester

Thực hành (2h):

  • Configure handoffs cho 4 agents
  • Test delegation flow: Agent A → Agent B → Agent C
  • Debug: khi Agent B có output kém → Agent A phải verify

Bài 2.5: Dependency Graph — Thứ tự thực thi

Lý thuyết (2h):

Execution Priority Order (Within Each Phase):

1. shared/ types, constants, protocol  ← Nền tảng, mọi thứ phụ thuộc
2. server/ systems and game logic      ← Server-authoritative
3. server/ Room.ts integration         ← Wire systems vào game loop
4. client/ networking (StateReceiver)   ← Handle server messages
5. client/ scenes and UI               ← User-facing features
6. Build verification (all 3 packages) ← Quality checkpoint
7. Audit against README requirements   ← Completeness check
8. Fix any gaps found in audit         ← Close remaining issues
  • Integration Pattern (adding a new system): 12-step process from types → server → client → verify
  • Cross-agent dependencies: BA specs → Dev implements → Tester validates
  • Parallel execution: BE + FE can work simultaneously after shared/ types done

Thực hành (2h):

  • Vẽ dependency DAG cho Phase 2 (Combat & Buildings)
  • Identify: tasks nào chạy parallel? tasks nào sequential?
  • Optimize: giảm thời gian phase bằng cách maximize parallelism

Bài 2.6: Error Recovery & Decision Framework

Lý thuyết (1h):

  • Build fails → Fix immediately → Re-verify
  • Audit finds gaps → P0 task → Implement → Re-verify
  • Phase gate rejected → Remediation → Re-submit
  • Stuck → Search patterns → Read SSoT → Simpler implementation → Ask user

Decision Framework:

1. README.md specify? → Follow exactly
2. Existing pattern? → Follow pattern
3. Simpler option? → Choose simpler
4. Affects other systems? → shared/ changes first
5. Need creativity? → Brainstorming Coach
6. Hard trade-off? → Creative Problem Solver
7. Unsure? → Ask user

Thực hành (1h):

  • Simulate 3 error scenarios → practice recovery
  • Apply decision framework to 5 technical decisions

Deliverable Module 2: Architecture diagram + phase plan cho game project


Module 3: Agent Communication & Memory (Tuần 5-6)

Mục tiêu: Xây dựng hệ thống giao tiếp real-time và bộ nhớ dài hạn cho agents

Tuần 5 — Event-Driven Communication (RabbitMQ)

Bài 3.1: Kiến trúc Event Bus

Lý thuyết (3h):

                    ┌──────────────────────┐
                    │  polymer_wars        │  Topic Exchange
                    │  (topic, durable)    │
                    └──────────┬───────────┘
                               │ Routes by routing key
           ┌───────────┬──────┴───────┬──────────┬────────────┐
           ▼           ▼              ▼          ▼            ▼
    agent.super-agent  agent.pm  agent.backend   agent.tester  ...
    binding: #         binding:  binding:         binding:
                       task.*    task.backend.*   task.test.*
  • Topic Exchange: Route messages bằng routing key pattern
  • Routing Key Convention: domain.event.detail (ví dụ: task.backend.combat-system)
  • Queue per Agent: Mỗi agent có queue riêng, binding theo role
  • Dead Letter Queue: Messages fail → DLQ để debug
  • Super Agent subscribes # (ALL events) — giám sát toàn diện

Routing Key Patterns:

PatternÝ nghĩaVí dụ
task.<domain>.<detail>Giao việctask.backend.combat-system
bug.<domain>.<type>Báo bugbug.frontend.render
test.<result>Kết quả testtest.all-pass
backend.<event>Server eventbackend.api-ready
phase.<event>Phase lifecyclephase.started
gate.<event>Phase gategate.approved
escalation.<event>Leo thangescalation.conflict

Thực hành (1h):

  • Docker: docker compose up -d rabbitmq
  • Truy cập RabbitMQ UI: http://localhost:15672
  • Dùng MCP tool: rabbitmq_setup_agent_infra → tạo exchanges, queues, bindings
  • Gửi/nhận message giữa 2 agents

Git reference: Commits f9fe84c4fcdd7eRabbitMQ MCP server + agent communication integration

Bài 3.2: Agent Queue Bindings & Event Flow

Lý thuyết (2h):

AgentQueueListens To
Super Agentagent.super-agent# (everything)
Project Manageragent.project-managertask.completed, bug.critical, phase.*
Backend Devagent.backend-devtask.backend.*, bug.backend.*, frontend.api-request
Frontend Devagent.frontend-devtask.frontend.*, backend.api-ready, asset.delivered
Testeragent.testertask.test.*, backend.ready, frontend.ready

Event Flow Example — Adding Combat System:

PM sends:        task.backend.combat-system → BackendDev
BackendDev does: implement → test → sends backend.ready
Tester receives: backend.ready → runs tests → sends test.report
PM receives:     test.report → checks phase gate → sends phase.gate-check
SuperAgent:      monitors ALL events via # subscription

Thực hành (2h):

  • Implement full event flow cho 1 feature
  • Monitor qua RabbitMQ UI: quan sát messages flow
  • rabbitmq_agent_workflow_status — detect bottlenecks

Bài 3.3: Conversation Protocol — Giao tiếp chi tiết

Lý thuyết (2h):

3 channels giao tiếp, theo urgency:

ChannelSpeedUse Case
RabbitMQReal-timeTask handoffs, status changes
Conversation LogsAsyncDetailed discussions, rationale
GitHub IssuesPersistentTask tracking, long-lived items

Conversation message format:

markdown
### [2026-02-20 10:00] @BackendDev → @FrontendDev | API-Change
**Subject**: New protocol messages for Combat System
Added `ServerMessageType.UNIT_DAMAGED` and `UNIT_DIED` to shared/protocol.ts.
**Action Required**: Please implement client-side handlers in StateReceiver.ts
---

Tags: API-Change, Bug-Report, Bug-Fix, Spec-Ready, Implementation-Done, Design-Change, Blocker, Question, Answer

Thực hành (2h):

  • Đọc docs/conversations/PROTOCOL.md — hiểu format
  • Đọc docs/conversations/phase-5.md — xem giao tiếp thực tế
  • Viết 5 conversation messages mô phỏng cross-agent coordination

Tuần 6 — Long-Term Memory (ChromaDB)

Bài 3.4: Agent Memory System — Tại sao agent cần "nhớ"?

Lý thuyết (2h):

  • Vấn đề: AI agent stateless — mỗi session bắt đầu từ zero
  • Giải pháp: ChromaDB vector database cho long-term memory
  • Isolation Rule: Mỗi agent chỉ truy cập collection riêng
┌──────────────────────────────────────────────────┐
│              AGENT MEMORY LIFECYCLE               │
│                                                   │
│  START TASK                                       │
│  ├─ 1. Query own memory ("Tôi biết gì về task?") │
│  │                                                │
│  DURING TASK                                      │
│  ├─ 2. Work normally                              │
│  │                                                │
│  END TASK                                         │
│  ├─ 3. Store learnings in own memory              │
│  │     - Decisions + rationale                    │
│  │     - Lessons learned                          │
│  │     - Patterns discovered                      │
│  │                                                │
│  CROSS-AGENT                                      │
│  └─ 4. Write to docs/conversations/ (NOT memory)  │
│        Memory = PRIVATE. Conversations = PUBLIC    │
└──────────────────────────────────────────────────┘

Memory Document Format:

json
{
  "content": "Always run shared/ check BEFORE server/ — cascading type errors waste time",
  "metadata": {
    "agent": "Autonomous",
    "phase": "1",
    "type": "lesson",
    "date": "2026-02-20",
    "tags": ["build-order", "integration"]
  }
}

Thực hành (2h):

  • Docker: docker compose up -d chromadb
  • Dùng Chroma MCP tools: chroma_create_collection, chroma_add_documents, chroma_query_documents
  • Tạo memory collection cho 1 agent → store → query → verify recall

Git reference: Xem docs/AUTONOMUS-AGENTS.md — kiến trúc RabbitMQ + ChromaDB

Bài 3.5: Memory Types & Access Control

Lý thuyết (2h):

Memory TypeContentVí dụ
decisionQuyết định + lý do"Grunt DPS = 12 vì kills Scavenger in 5s"
lessonBài học từ sai lầm"Phaser particle emitter phải destroy manually"
contextTrạng thái dự án"Phase 2 end: 47 files, 8200 LOC"
progressMilestone tracking"Phase 3 gate: PASS — all 6 req met"
patternPatterns tái sử dụng"Explosion VFX: 20 particles, 800ms life"

Access Control Matrix:

Agent           Own Collection    Other Collections
──────────────  ──────────────    ─────────────────
SuperAgent      READ/WRITE ✅     BLOCKED ❌
BackendDev      READ/WRITE ✅     BLOCKED ❌
FrontendDev     READ/WRITE ✅     BLOCKED ❌
...             ...               BLOCKED ❌
  • PRIVATE: Memory collections (mỗi agent chỉ thấy của mình)
  • PUBLIC: docs/conversations/ (tất cả agent đọc được)

Thực hành (2h):

  • Implement memory lifecycle cho 2 agents
  • Test isolation: Agent A cố đọc memory Agent B → verify bị chặn
  • Simulate multi-phase scenario: store → new phase → query → verify context retention

Bài 3.6: Memory-Enhanced Workflow

Lý thuyết (1h):

Step 1 (ASSESS):
  → Query memory: "Bài học từ phases trước?"
  → Query memory: "Creative ideas chưa dùng?"

Step 2b (CREATIVE):
  → Query: "Brainstorm ideas chưa implement?"

Step 5 (GATE):
  → Store: phase report summary, quality metrics
  → Store: lessons learned, unused creative ideas

Thực hành (1h):

  • Full end-to-end: Start phase → query memory → work → store learnings → next phase → query → verify improvement

Deliverable Module 3: Working RabbitMQ + ChromaDB setup + demo agent communication


Module 4: Game Design với AI Agent Pipeline (Tuần 7-8)

Mục tiêu: Áp dụng multi-agent system vào game development thực tế, đi qua Phase 1 và Phase 2

Tuần 7 — Phase 1: Foundation (Hands-on)

Bài 4.1: Game Design Document as Code

Lý thuyết (2h):

  • README.md structure cho RTS game:

    • §1-2: Theme, Lore
    • §3: Resources (Plastic, Electric)
    • §4: Buildings (HQ, Processor, Barracks, Vehicle Factory, Turrets)
    • §5: Units (Worker, Grunt, Sharpshooter, Bomber, Bulldozer, Sprayer, Drone)
    • §6: Map (200×200 tiles, fog of war, terrain types)
    • §7: Diplomacy (alliances, betrayal)
    • §8: Events, Pollution, Super Weapons
    • §9: Game Modes (FFA, 4v4, 2v2v2v2, King of the Hill)
    • §10: Meta Strategies
    • §11: Architecture (client-server, protocol, state sync)
    • §12: Development Phases
    • §13: Balance Constants
  • Balance Constants as Codeshared/constants.ts:

    typescript
    export const BALANCE = {
      GRUNT: { hp: 100, dps: 12, speed: 2, cost: { plastic: 30 } },
      SHARPSHOOTER: { hp: 60, dps: 20, speed: 1.5, range: 6 },
      // ...
    }

Thực hành (2h):

  • Viết GDD cho mini game trong format SSoT
  • Define balance constants → tạo shared/constants.ts
  • Tạo type definitions → shared/types.ts

Git reference: Commit 91ada6d "IDEA"aadbe0f "Add Tester Agent + enhance README"

Bài 4.2: Executing Phase 1 — Foundation MVP

Lý thuyết (1h):

  • Phase 1 execution strategy: shared/ typesserver/ skeletonclient/ bootstrapnetworking
  • Agent workflow: BA specs → BackendDev implements → FrontendDev renders → Tester validates

Thực hành (3h) — Live Coding with Agents:

Step 1: @BusinessAnalyst "Write specs for room system, resource collection"
Step 2: @BackendDev "Implement Bun WebSocket server with room system"
Step 3: @FrontendDev "Bootstrap Phaser 3 client with Vite + basic tilemap"
Step 4: @Tester "Validate server boots, client connects, HQ renders"
Step 5: Write phase report → @SuperAgent review

Mỗi bước:

  1. Gọi agent qua Copilot Chat
  2. Quan sát output
  3. Verify build: bun run check
  4. Review code quality
  5. Log to docs/conversations/

Git reference: Commit e684ff6"Implement core game systems for Polymer Wars" (Phase 1 core trong 1 commit)

Bài 4.3: Game Designer Agent — Deep Dive

Lý thuyết (2h):

  • Game Designer = Guardian of README.md

  • Balance tuning workflow:

    • Define → Test → Analyze → Adjust → Document
    • "Balance changes must be data-driven"
    • "All mechanics must have counterplay"
    • "Simplicity first"
    • "Fun over realism"
  • Unit Effectiveness Matrix:

Attacker \ DefenderGruntSharpshooterBomberBulldozer
GruntNeutralStrongWeakWeak
SharpshooterWeakNeutralStrongWeak
Suicide BomberStrongStrongNeutral
BulldozerStrongStrongNeutralNeutral
  • Faction Design (8 factions): Recyclers, Molders, Scrappers, Chemists, Drifters, Cult, Engineers, Survivors

Thực hành (2h):

  • Dùng @GameDesigner agent để design 1 faction hoàn chỉnh
  • Tune balance: thay đổi Grunt DPS → kiểm tra impact lên meta
  • Viết design change conversation message → notify all agents

Git reference: Commits 98a3fcf5ebd1fc"Implement faction system with bonuses and fixed-point math"

Tuần 8 — Phase 2-3: Combat & Advanced Mechanics

Bài 4.4: Backend Systems — Server-Authoritative Architecture

Lý thuyết (2h):

  • Server-authoritative model: Server = SOLE authority on game state
  • Client chỉ gửi command + render — KHÔNG tính toán gameplay
  • Game Loop (20 ticks/s):
    1. Process client commands (validate!)
    2. MovementSystem → CombatSystem → ResourceSystem → BuildingSystem
       → TrainingSystem → PollutionSystem → EventSystem → DiplomacySystem
    3. Check win/lose conditions
    4. Build state deltas
    5. Filter by Fog of War per player → send
  • Systems as pure functions: tickCombatSystem(state) → events[]
  • Anti-cheat: validate EVERY client command server-side

Thực hành (2h):

  • Đọc server/src/systems/ — hiểu 10+ game systems
  • Dùng @BackendDev implement CombatSystem
  • Test: 2 units attack nhau → verify damage, death, events

Git reference: Commits e684ff69223e63 — Core systems → Diplomacy trong 2 giờ

Bài 4.5: Frontend Rendering & Networking

Lý thuyết (2h):

  • Phaser 3 scene lifecycle: Boot → Menu → Game + HUD
  • Entity interpolation: Smooth movement giữa server ticks
  • State synchronization: StateReceiver handles all server events
  • CommandSender: Mọi client action đi qua đây (NEVER raw ws.send)
  • Glow Pipeline: WebGL shaders cho visual signature

Thực hành (2h):

  • Đọc client/src/networking/ — Socket, StateReceiver, CommandSender, Interpolation
  • Dùng @FrontendDev implement HUD scene
  • Test: unit di chuyển smooth giữa server ticks (interpolation)

Git reference: Commit 94482f6"Implement interpolation, minimap, building upgrades"

Bài 4.6: Cross-Agent Coordination — Real Example

Lý thuyết (1h):

  • Diplomacy System case study:
    1. @GameDesigner designs alliance/betrayal mechanics in README §7
    2. @BusinessAnalyst writes detailed spec
    3. @BackendDev implements DiplomacySystem.ts
    4. @BackendDev writes conversation: "API-Change: new message types ALLIANCE_REQUEST, ALLIANCE_ACCEPT, BETRAY"
    5. @FrontendDev reads conversation → implements DiplomacyPanel UI
    6. @Tester validates: alliances work, betrayal triggers combat penalty

Thực hành (1h):

  • Trace Diplomacy System through Git history
  • Identify: mỗi agent contribute gì?
  • Đo: bao lâu từ design → implementation → test?

Git reference: Commit 9223e63"Implement Diplomacy System with alliances and betrayal mechanics"

Deliverable Module 4: Working Phase 1 + Phase 2 game features built by agent pipeline


Module 5: Quality Governance & Autonomous Loop (Tuần 9-10)

Mục tiêu: Master Super Agent governance, quality gates, continuous improvement, và creative agents

Tuần 9 — Super Agent & Quality Gates

Bài 5.1: Super Agent — Quyền lực tối cao

Lý thuyết (3h):

Super Agent = Duy nhất được:

  • Sửa/viết lại agent prompts (.github/agents/)
  • Tạo agents mới
  • Vô hiệu hóa agents
  • Override quyết định của bất kỳ agent nào

Review Cycle:

PM writes Phase Report


Super Agent reads:
  - docs/reports/phase-N-report.md
  - docs/logs/*/phase-N.md (ALL agents)
  - docs/issues/ (open items)
  - Test results + CI status
  - docs/conversations/phase-N.md


Decision:
  ✅ APPROVE → Phase advances
  ❌ REJECT  → Specific remediation items

Agent Performance Metrics:

MetricĐánh giá choSignal
Deliverables completed vs plannedAll agentsExecution reliability
Bugs per featureDev agentsCode quality
Test coverageTesterTesting thoroughness
Spec accuracyBARequirement clarity
Conversation participationAll agentsCollaboration quality
Unanswered messagesAll agentsCommunication responsiveness

Prompt Adjustment Examples:

Quan sátAgentĐiều chỉnh
FE dev gửi raw WebSocketFrontend DevThêm rule: "NEVER raw ws.send()"
Tester miss edge casesTesterThêm specific test scenarios vào prompt
BA specs thiếu error handlingBAThêm: "Mọi spec phải có error paths"
BE dev tạo memory leaksBackend DevThêm: "Clean up listeners on room destroy"

Thực hành (1h):

  • Đóng vai Super Agent: review một phase report thực tế
  • Identify 3 quality risks → viết prompt adjustments
  • Practice: reject a phase gate → viết remediation items cụ thể

Bài 5.2: Quality Gates — No Shortcuts

Lý thuyết (2h):

Phase GateCriteria (PASS/FAIL)
1 → 2Server starts, client connects, HQ renders, worker moves, resources tick
2 → 3All units trainable, combat resolves, buildings constructable, minimap works
3 → 4Alliances work, pollution spawns mutants, events trigger, super weapons fire
4 → 5All modes playable, spectator works, reconnect works, 60 FPS, <2ms tick
5 → LaunchCI green, 8-player stress test, accounts work, deployed to cloud

Phase Report Structure:

  1. Deliverables table (task, owner, status)
  2. Quality metrics (test coverage, bugs, CI, performance)
  3. Agent performance assessment
  4. Conversation log analysis
  5. Issues and blockers
  6. Risks for next phase
  7. Recommendation: READY / NOT READY

Thực hành (2h):

  • Đọc docs/reports/phase-4-report.md — phân tích structure
  • Viết phase report cho Phase 1 project của bạn
  • Thực hiện quality gate checklist — pass hay fail?

Bài 5.3: Continuous Improvement — Agent cải thiện qua mỗi phase

Lý thuyết (2h):

Phase 1: Agents mới → prompt sơ khai → nhiều lỗi
Phase 2: Super Agent adjust prompts → ít lỗi hơn
Phase 3: Mature prompts → agents hoạt động trơn tru
Phase 4: Fine-tuned → agents biết pattern → ít supervision
Phase 5: Self-governing → agents tự coordinate → production-ready

Improvement Cycle:

  1. Sau mỗi phase: identify top 3 quality risks cho phase tiếp
  2. Preemptively adjust agent prompts
  3. Thêm rules nếu phát hiện patterns lỗi
  4. Bớt rules không còn relevant
  5. Log changes vào docs/logs/super-agent/phase-N-review.md

Thực hành (2h):

  • Compare agent prompt version 1 vs final version — identify improvements
  • Viết 5 prompt improvements dựa trên simulated issues
  • Practice: observe agent output → identify weak points → tighten prompt

Tuần 10 — Creative Agents & Advanced Patterns

Bài 5.4: Brainstorming Coach — Sáng tạo có hệ thống

Lý thuyết (2h):

  • B3K Brainstorming Coach: 20+ techniques cho ideation
  • Techniques: SCAMPER, What-If Scenarios, Sensory Exploration, Cross-Pollination, Reverse Brainstorming
  • Per-phase creative focus:
    • Phase 1: Map visual identity, fog atmosphere
    • Phase 2: Combat juice (screen shake, particles, death animations)
    • Phase 3: Event spectacle (acid rain VFX, earthquake)
    • Phase 4: Sound design, micro-interactions, polish
    • Phase 5: FTUE, ranking celebrations

Thực hành (2h):

  • Dùng @B3K Brainstorming Coach: brainstorm visual effects cho game
  • Evaluate ideas: player delight × implementation cost × aesthetic alignment
  • Select top 3 creative enhancements → tag [CREATIVE] trong task list

Bài 5.5: Creative Problem Solver — Giải quyết vấn đề khó

Lý thuyết (2h):

  • B3K Creative Problem Solver: 30 methods, 6 categories, 9-step workflow
  • Methods: TRIZ, Five Whys, Systems Thinking, Force Field Analysis, Decision Matrix
  • Use cases:
    • Performance vs visual quality trade-off → TRIZ
    • UX friction → Five Whys
    • Balance contradiction → Constraint Identification + Lateral Thinking
    • Architecture decision → Decision Matrix

Thực hành (2h):

  • Dùng @B3K Creative Problem Solver: giải quyết "60 FPS với 400 units on screen"
  • 9-step workflow: Define → Diagnose → Generate → Evaluate → Implement
  • Document: root cause, solution, rationale, monitoring plan

Bài 5.6: Scaling — Từ 10 agents đến N agents

Lý thuyết (2h):

  • Khi nào cần thêm agent mới?
  • Process tạo agent: Identify gap → Design prompt → Create file → Update README → Notify PM
  • Agent merging: Khi 2 agents overlap → merge into 1
  • Agent specialization: Khi 1 agent quá tải → split into 2
  • Growth path: Phase 6 roadmap → 8 factions × competitive × production scale

Thực hành (2h):

  • Dựa vào Phase 6 roadmap, thiết kế 2 agents mới (ví dụ: "Matchmaking Specialist", "Season Manager")
  • Integrate vào existing hierarchy
  • Test: handoffs, event bus bindings, memory collections

Deliverable Module 5: Super Agent review document + prompt improvements + creative enhancement plan


Module 6: Production & Capstone Project (Tuần 11-12)

Mục tiêu: Deploy game, scale infrastructure, và hoàn thành capstone project

Tuần 11 — Production Pipeline

Bài 6.1: DevOps Agent & CI/CD

Lý thuyết (2h):

  • DevOps Agent responsibilities: Docker, CI/CD, Git management
  • Docker deployment: client/Dockerfile, server/Dockerfile, docker-compose.yml
  • CI/CD pipeline: .github/workflows/ci.yml
  • Database layer: PostgreSQL (accounts, match history) + Redis (sessions, matchmaking)

Thực hành (2h):

  • Dùng @DevOps agent: setup Docker containers
  • Configure CI pipeline: build → test → deploy
  • Health check: GET /health endpoint

Git reference: Commits 871d57d (DB layer) → e9013c3 (Dockerfile updates)

Bài 6.2: Auth, Ranking & Anti-Cheat

Lý thuyết (2h):

  • Authentication: Player accounts, JWT tokens
  • ELO system: Ranked seasons, placement matches
  • Match history: Record + query previous games
  • Anti-cheat: Server-authoritative + rate limiting + command validation
  • Replay system: Deterministic simulation + command log recording

Thực hành (2h):

  • Đọc server/src/auth/ — AuthSystem, AntiCheat, EloSystem, MatchHistory
  • Dùng @BackendDev implement auth flow
  • Test: register → login → play → match history → ranking update

Bài 6.3: Load Testing & Performance

Lý thuyết (1h):

  • Performance targets: 60 FPS client, <2ms server tick, <100ms latency
  • Load testing: 8 concurrent players × 400 units
  • Spatial hash, object pooling, sprite batching

Thực hành (1h):

  • Đọc tests/load-test.ts — hiểu test strategy
  • Run load test → analyze bottlenecks
  • Performance optimization cycle: measure → profile → optimize → verify

Tuần 12 — Capstone Project

Bài 6.4: Capstone — Xây dựng game mới từ zero

Yêu cầu (20h thực hành):

Chọn 1 trong các đề tài:

  1. Tower Defense — Waves of enemies, tower placement, upgrade paths
  2. Auto Battler — Draft units, auto-combat, economy management
  3. Colony Sim — Resource management, citizen AI, building placement
  4. Battle Royale (2D) — Shrinking zone, loot, combat

Deliverables:

#DeliverableĐiểm
1SSoT game design document (README.md)15%
2Agent prompts (minimum 6 agents)20%
3Agent hierarchy diagram + authority matrix10%
4Working RabbitMQ + ChromaDB setup10%
5Phase 1 implemented by agent pipeline20%
6Phase report + quality gate review10%
7Prompt improvement log (before/after)10%
8Presentation: demo + architecture walkthrough5%

Evaluation Criteria:

  • Agent prompts rõ ràng, có rules, có context injection
  • Multi-agent coordination hoạt động (conversation logs, event bus)
  • Phase gate criteria được enforce
  • Code chạy được, build clean
  • Thể hiện continuous improvement qua prompt adjustments

Bản đồ kỹ năng

                        AI AGENT FOR MASTER GAME DESIGN
                              SKILL MAP

    ┌─────────────────────────────────────────────────────────┐
    │                                                         │
    │  FOUNDATION (Module 1-2)                                │
    │  ├── Agent Prompt Engineering                           │
    │  ├── Role-Based Agent Design                            │
    │  ├── Single Source of Truth Pattern                     │
    │  ├── Authority Hierarchy                                │
    │  ├── Phase-Gated Development                            │
    │  └── Dependency Graph Planning                          │
    │                                                         │
    │  COMMUNICATION (Module 3)                               │
    │  ├── Event-Driven Architecture (RabbitMQ)               │
    │  ├── Topic Exchange & Routing Keys                      │
    │  ├── Conversation Protocol Design                       │
    │  ├── Long-Term Memory (ChromaDB)                        │
    │  ├── Memory Isolation & Access Control                  │
    │  └── Memory-Enhanced Workflows                          │
    │                                                         │
    │  GAME DEVELOPMENT (Module 4)                            │
    │  ├── Game Design Document as Code                       │
    │  ├── Server-Authoritative Architecture                  │
    │  ├── Real-Time State Synchronization                    │
    │  ├── Entity Interpolation                               │
    │  ├── Balance Design & Tuning                            │
    │  └── Cross-Agent Feature Development                    │
    │                                                         │
    │  GOVERNANCE (Module 5)                                  │
    │  ├── Super Agent Design                                 │
    │  ├── Quality Gate Enforcement                           │
    │  ├── Continuous Prompt Improvement                      │
    │  ├── Agent Performance Metrics                          │
    │  ├── Creative Agent Integration                         │
    │  └── System Scaling Patterns                            │
    │                                                         │
    │  PRODUCTION (Module 6)                                  │
    │  ├── CI/CD for Agent-Built Code                         │
    │  ├── Docker Deployment                                  │
    │  ├── Auth, Ranking, Anti-Cheat                          │
    │  ├── Load Testing & Performance                         │
    │  └── End-to-End Capstone Project                        │
    │                                                         │
    └─────────────────────────────────────────────────────────┘

Tài nguyên & Công cụ

Công cụ bắt buộc

ToolPurposeSetup
VS CodeIDE chínhDownload
GitHub CopilotAI Agent runtimeExtension + subscription
Docker DesktopRun RabbitMQ + ChromaDBDownload
BunJS/TS runtime + package managerDownload
GitVersion controlPre-installed hoặc download

Infrastructure (Docker)

yaml
# docker-compose.yml (minimal cho khóa học)
services:
  rabbitmq:
    image: rabbitmq:3-management
    ports: ["5672:5672", "15672:15672"]

  chromadb:
    image: chromadb/chroma
    ports: ["8000:8000"]
    environment:
      - IS_PERSISTENT=TRUE

Tài liệu tham khảo

ResourceTypeLink
Polymer Wars Source CodeCase study codebaseRepository root
.github/agents/13 agent prompt exemplars.github/agents/
docs/reports/Phase report examplesdocs/reports/
docs/conversations/Communication protocoldocs/conversations/
Phaser 3 DocumentationGame engine docsphaser.io
RabbitMQ TutorialsMessage brokerrabbitmq.com
ChromaDB DocumentationVector databasedocs.trychroma.com

Đánh giá & Chứng chỉ

Đánh giá liên tục

ModuleDeliverableTrọng số
Module 14 agent prompts hoàn chỉnh10%
Module 2Architecture diagram + phase plan10%
Module 3Working RabbitMQ + ChromaDB demo15%
Module 4Phase 1 + 2 game features by agents15%
Module 5Super Agent review + prompt improvements10%
Module 6Capstone project (full game)40%

Tiêu chí đạt

LevelYêu cầuChứng chỉ
PassHoàn thành Module 1-5 + Capstone Phase 1Certificate of Completion
Merit+ Capstone Phase 2 + working event busCertificate with Merit
Distinction+ Full capstone + creative agents + production deployCertificate with Distinction

Kỹ năng đầu ra

Sau khóa học, bạn có thể:

  1. Thiết kế hệ thống multi-AI-agent cho bất kỳ software project nào
  2. Viết agent prompts chuyên nghiệp với role, context, rules, memory
  3. Xây dựng event-driven agent communication với RabbitMQ
  4. Implement long-term agent memory với ChromaDB
  5. Vận hành phase-gated development pipeline với quality gates
  6. Govern agent quality thông qua Super Agent pattern
  7. Phát triển game hoàn chỉnh từ design → code → test → deploy bằng AI Agents
  8. Scale agent system khi project phức tạp hơn

"The future of software development isn't writing code — it's orchestrating agents that write code."

— AI Agent for Master Game Design, 2026