Skip to content

About

๐ŸŽฎ Type one sentence. Get a playable game. Scan. Play. โ€” AI ไธ€ๅฅ่ฏ็”Ÿๆˆๅฏ็Žฉๆธธๆˆ๏ผš่ง„ๅˆ’ โ†’ ไปฃ็  โ†’ ๆž„ๅปบ โ†’ ่‡ชไฟฎๅคๅ…จ้—ญ็Žฏ๏ผŒๆ‰‹ๆœบๆ‰ซ็ ๅณ็Žฉ

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

1 Commit

Folders and files

Repository files navigation

๐ŸŽฎ Game Arena โ€” AI Game Generator

English | ็ฎ€ไฝ“ไธญๆ–‡ | ๆ—ฅๆœฌ่ชž

Type one sentence. Get a playable game. Scan. Play.

Describe the game in your head โ€” AI plans it, writes the full code, builds it, fixes its own mistakes, and hands you a QR code. Your phone is the controller screen.

License Version React 18 FastAPI Docker PRs Welcome

Game Arena โ€” Generator

๐Ÿ“ธ See it in action

Game Library (live preview + QR) AI-generated game running on a phone
Game Library Playing on phone

The soccer game above was 100% AI-generated from the sentence "ไธ–็•Œๆฏไปปๆ„็ƒๅคงๅธˆ" โ€” code, visuals, sound effects, all of it.

๐Ÿค” Why Game Arena?

LLMs can write code โ€” but going from "an idea" to "something you can actually play" is still a slog: scaffolding, dependencies, build errors, broken layouts on mobile, and the inevitable half-finished output.

Game Arena closes that loop end-to-end:

  • It plans before it codes โ€” a multi-skill planning stage (interaction / gameplay / level / numerical design) produces a real design spec first
  • It builds and repairs itself โ€” source validation + vite build; on failure the LLM auto-fixes, and if that still fails, a stable fallback of the same game type is served. You always get something playable
  • Zero-click sharing โ€” every game gets a QR code; scan it on the same LAN and play on your phone instantly

โœจ Features

  • ๐Ÿ—ฃ๏ธ One-sentence generation โ€” natural language in, complete React + TypeScript game out (optional reference image for visual style)
  • ๐Ÿ“ก Streaming progress โ€” SSE pushes every step live (planning โ†’ codegen โ†’ build โ†’ preview), with cancellable generation
  • ๐Ÿ”ง Self-repair & fallback โ€” build failure triggers an LLM fix round; ultimate failure swaps in a stable fallback version
  • ๐Ÿ•น๏ธ Game library โ€” search, sort, live-preview, share via QR, delete; all generated games in one place
  • ๐Ÿ“ฑ Scan-to-play โ€” automatic QR codes, phone-optimized 375px portrait gameplay with synthesized Web Audio sound
  • ๐ŸŒ i18n โ€” Chinese & English, auto-detected from your browser, one-click switch
  • ๐ŸŽจ Esports-grade UI โ€” neon arcade design with a HUD-style generation screen

๐Ÿš€ Quick Start

Option A: Docker (one command)

# 1. Add your ARK API key to backend/.env
echo 'ARK_API_KEY=your_api_key_here' > backend/.env

# 2. Run everything
docker compose up --build

Open http://localhost:8080 โ€” that's it.

Option B: Local development

Prerequisites: Node.js 20+ & pnpm ยท Python 3.10+ ยท a Volcengine ARK API key

# 1. Configure the backend
cat > backend/.env <<'EOF'
ARK_API_BASE=https://ark.cn-beijing.volces.com/api/coding/v3
ARK_API_KEY=your_api_key_here
ARK_MODEL=ark-code-latest
ARK_VISION_MODEL=kimi-k2.7-code
EOF

# 2. Backend (port 8002)
cd backend && pip install -r requirements-deploy.txt && python3 game_service.py

# 3. Frontend (port 3000, auto-proxies /api & /preview)
cd game-generator-ui && pnpm install && pnpm dev

Open http://localhost:3000, type something like "ๅšไธชๆ‰“ๅœฐ้ผ ๆธธๆˆ", and watch it come alive.

๐Ÿง  How It Works

Your sentence โ”€โ”€โ–บ โ‘  Planning        โ”€โ”€โ–บ โ‘ก Code Generation โ”€โ”€โ–บ โ‘ข Validation
 (optional        (4 design skills:     (App.tsx + index.css    (dangerous API /
  image style)     interaction,           with hard rules:       incomplete code /
                    gameplay, level,      mobile 375px, rAF       interaction entry)
                    numerical)            loop, Web Audio)
                                                          โ”‚
                          โ‘ฅ Scan & Play โ—„โ”€โ”€ โ‘ค Build โ—„โ”€โ”€ โ‘ฃ Auto-Repair
                          (QR code,        (vite build    (LLM fixes
                           same LAN)        + preview)     failures, fallback
                                                          as safety net)
  1. Planning โ€” game-planning/*/SKILL.md files act as system prompts; the LLM produces a design spec across up to 4 dimensions
  2. Code generation โ€” the LLM outputs ===GAME_META=== / ===APP_TSX=== / ===INDEX_CSS=== sections under strict hard rules (no 100vh, rAF game loop, synthesized audio, no localStorage/eval)
  3. Validation & repair โ€” static checks + real vite build; failures feed back to the LLM for one fix round
  4. Guaranteed playable โ€” if repair still fails, a stable same-type fallback is deployed instead
  5. Instant sharing โ€” built games are served at /preview/{id}/ and rendered into a QR code

๐Ÿ› ๏ธ Tech Stack

Layer Technology
Frontend React 18 ยท TypeScript ยท Vite ยท Tailwind CSS ยท framer-motion ยท lucide-react
i18n i18next ยท react-i18next
Backend FastAPI ยท uvicorn ยท httpx ยท pydantic
LLM Volcengine ARK (chat/completions, code + vision models)
Deployment Docker ยท Node reverse proxy

๐Ÿ“ก API Overview

Method Path Description
POST /api/games/generate-llm-stream Stream-generate a game (SSE: step progress โ†’ done/error)
GET /api/games/list List built games
GET /api/games/{game_id}/health Query build status
DELETE /api/games/{game_id} Delete a game
GET /api/games/types List supported game types & themes
GET /preview/{game_id}/ Play the built game

โš™๏ธ Configuration

All via backend/.env:

Variable Default Description
ARK_API_KEY โ€” Required. Volcengine ARK API key
ARK_API_BASE https://ark.cn-beijing.volces.com/api/coding/v3 API endpoint
ARK_MODEL ark-code-latest Model for planning / codegen / repair
ARK_VISION_MODEL kimi-k2.7-code Vision model for reference-image style analysis
GAME_PLANNER_MAX_TOKENS 4096 Planning overview max tokens
GAME_PLANNER_SUB_SKILL_MAX_TOKENS 2048 Planning sub-skill doc max tokens
GAME_PLANNER_TIMEOUT_SECONDS 90 Planning LLM timeout
GAME_PLANNER_TEMPERATURE 0.5 Planning temperature
GAME_GENERATOR_TIMEOUT_SECONDS 240 Code generation timeout
GAME_GENERATOR_MAX_KEPT_GAMES 200 Max games kept (oldest auto-cleaned)

๐Ÿ“ Project Structure

โ”œโ”€โ”€ backend/                # FastAPI service (port 8002): LLM calls, codegen, build, API
โ”œโ”€โ”€ game-generator-ui/      # React frontend (port 3000)
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ”œโ”€โ”€ components/     # SideNav / ArenaScreen / ConsolePanel / LibraryPage / ...
โ”‚       โ”œโ”€โ”€ hooks/          # useGameGeneration (SSE) / useGameList / useToast
โ”‚       โ””โ”€โ”€ i18n/           # zh & en locales
โ”œโ”€โ”€ game-planning/          # Planning skills (system prompts for the planning stage)
โ”œโ”€โ”€ skills/game-templates/  # Scaffold templates + runtime output dir for generated games
โ”œโ”€โ”€ prebuilt-games/         # Prebuilt games shipped with the image
โ”œโ”€โ”€ deploy/                 # start.sh / proxy.js (container entry)
โ”œโ”€โ”€ docker-compose.yml
โ””โ”€โ”€ Dockerfile

๐ŸŒ Internationalization

Chinese & English ship out of the box โ€” auto-detected from navigator.language, manually switchable, persisted to localStorage. To add a language: drop a new JSON into game-generator-ui/src/i18n/locales/ and register it in src/i18n/index.ts.

๐Ÿ’ฌ Community

Questions, ideas, or just want to chat about AI-generated games? Scan to join โ€” ๅ’Œๆˆ‘ไบคๆต:

QQ Group WeChat
QQ Group QR code WeChat QR code

โญ Support

If Game Arena sparks an idea for you, a star means a lot โ€” it helps more people discover the project. Issues and PRs are always welcome!

๐Ÿ“„ License

MIT

About

๐ŸŽฎ Type one sentence. Get a playable game. Scan. Play. โ€” AI ไธ€ๅฅ่ฏ็”Ÿๆˆๅฏ็Žฉๆธธๆˆ๏ผš่ง„ๅˆ’ โ†’ ไปฃ็  โ†’ ๆž„ๅปบ โ†’ ่‡ชไฟฎๅคๅ…จ้—ญ็Žฏ๏ผŒๆ‰‹ๆœบๆ‰ซ็ ๅณ็Žฉ

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages