leigest519/OpenGame

OpenGame: Open Agentic Coding for Games

OpenGame – Agentic Framework for End‑to‑End Web Game Creation

What it is – OpenGame is an open‑source system that lets a large language model (the GameCoder‑27B code LLM) generate a complete, playable web game from a single natural‑language prompt. It combines a specialised Game Skill (template selection + debugging) with a CLI that drives the LLM, scaffolds the project, runs it in a sandbox, and iteratively fixes integration errors until the game runs.

Key components

  • Game Skill – two sub‑skills:
    • Template Skill: chooses an appropriate engine/template (e.g., Phaser, three.js, plain canvas) and creates a stable project skeleton.
    • Debug Skill: executes the generated game in a headless browser, captures console/runtime errors, and asks the LLM to repair them until the build is healthy.
  • GameCoder‑27B – a 27‑billion‑parameter code‑focused LLM fine‑tuned on game‑engine APIs and reinforced with playability‑based rewards.
  • OpenGame‑Bench – an evaluation harness that launches generated games, drives them with scripted interactions, and scores them on build health, visual usability, and alignment with the original prompt.
  • CLI (opengame) – a command‑line tool (Node 20+) that runs in headless mode: you give a prompt, the agent builds the game, and you receive a folder containing index.html (or a dev‑server command) ready to play.

Typical workflow

# 1. Install (Node 20+ required)
git clone https://github.com/leigest519/OpenGame.git && cd OpenGame
npm install && npm run build && npm link   # makes `opengame` available

# 2. Set API keys (OpenAI or compatible) for the LLM and for any asset providers you want (image, audio, video)
export OPENAI_API_KEY=…
export OPENGAME_IMAGE_PROVIDER=tongyi   # example
export OPENGAME_IMAGE_API_KEY=…

# 3. Generate a game from a one‑shot prompt
mkdir -p games/my-game && cd games/my-game
opengame -p "Build a Snake clone with WASD controls and a dark theme." --yolo

# 4. Play
open index.html   # or run the printed `npm run dev` command

The --yolo flag lifts the default safety guard that blocks the agent from executing shell commands, allowing it to run npm install or other build steps automatically.

Demo gallery – The repository ships a small gallery of fully generated games (Marvel Avengers platformer, Harry‑Potter card‑battle, K.O.F. quiz‑fighter, etc.). Each demo can be previewed on the project landing page, run live, or downloaded as a zip file and launched locally with:

unzip demo_*.zip && cd demo_*
npm install
npm run dev   # http://localhost:5173

Configuration – Settings can be supplied via:

  • settings.json files (~/.qwen/settings.json for user‑wide defaults, .qwen/settings.json per project – the folder name will change to .opengame in a future release),
  • environment variables (e.g., OPENAI_API_KEY, OPENGAME_IMAGE_PROVIDER),
  • CLI flags.

Dependencies

  • Node.js ≥ 20
  • Phaser (or other HTML5 game engines) for rendering
  • qwen‑code runtime (the underlying agent framework OpenGame extends)

License – The repository is released under the Apache‑2.0 license (as indicated in the source files), allowing free use, modification, and distribution.

Why it matters – Most existing code‑generation agents can write isolated snippets, but they struggle with the multi‑file, state‑ful nature of full games. OpenGame’s combination of template scaffolding, automated debugging, and a game‑specific LLM pushes agentic programming toward building complex, interactive applications rather than just single‑file scripts.

Related

  • Project
  • Project
  • Project