AB
AiBoss
project

OpenGame - An open-source end-to-end web game intelligent agent framework from CUHK.

OpenGame is the first end-to-end web game intelligent agent framework open-sourced by MMLab at the Chinese University of Hong Kong. It automatically generates playable web games through natural language prompts.

What is OpenGame?

OpenGame is the first end-to-end intelligent agent framework for web games, open-sourced by the MMLab at the Chinese University of Hong Kong. It automatically generates playable web games through natural language prompts. The core framework, Game Skill, consists of Template Skill (a project skeleton template library) and Debug Skill (a dynamic debugging protocol). It is equipped with GameCoder-27B, a three-stage code model specifically trained for game engines, and works with the OpenGame-Bench dynamic evaluation benchmark to systematically solve the problems of cross-file inconsistencies and logical defects.

OpenGame's main functions

  • End-to-end game generationIt receives natural language design requirements and automatically outputs complete, buildable, and runnable web game projects, covering the entire process from concept to finished product.
  • Game Skill System
    • Template SkillBased on physical mechanism classification (such as horizontal gravity, top-down continuous motion, discrete mesh, etc.), it automatically selects and instantiates a stable family of project templates to ensure consistent structure across files.
    • Debug SkillMaintain a dynamic debugging protocol, accumulate error signatures, root causes, and verification solutions to achieve systematic integrated error repair rather than isolated syntax patches.
  • Game Design Document (GDD) Automatic GenerationTransform natural language requirements into technical GDD, dynamically load engine API constraints, and ensure that the mechanism is feasible within the selected framework.
  • Multimodal asset generationIt calls image, audio, and video generation models to automatically synthesize backgrounds, character animations, sound effects, and tilemaps based on the GDD asset list.
  • Three-layer reading strategy code implementationBy progressively loading API summaries, target source code, and implementation guidelines, and combining this with the template method pattern (Hook-Driven), game logic is injected to avoid context overflow.
  • Verification and Self-Correction Loop: Build and test using a headless browser, parse the compilation output and iteratively fix it until the game is playable.

OpenGame's technical principles

  • GameCoder-27B Three-Stage TrainingBased on the Qwen3.5-27B backbone, we establish game engine architecture priors and API usage patterns through continuous pre-training (CPT, Phaser/JS game code and documentation), supervised fine-tuning (SFT, GPT-Codex to generate complex design hints and MiniMax to synthesize high-quality solutions), and execution reinforcement learning (RL, single-file module-level unit test feedback).
  • Physics-First Classification MechanismBased on physical constraints and spatial mechanisms (such as "falling without ground support" being mapped to the platform jumping prototype), game requirements are categorized into prototypes to guide subsequent template selection.
  • Template Method Pattern (Hook-Driven Implementation): The proxy copies the template file and overrides the specified hook method (e.g.) setupCustomCollisionsWhile preserving the determinism of basic lifecycle management, specific logic is injected.
  • Dynamic Proxy EvolutionTemplate Skill evolved from a single-element template M0 through experience into a template library L encompassing five major families (gravity-driven side view, top-down continuous motion, discrete mesh, path wave, and UI-driven). Debug Skill records error signatures, root causes, and verification fixes from execution failures, forming the Living Debugging Protocol P, which includes pre-execution checks for high-frequency inconsistency categories.
  • OpenGame-Bench Dynamic EvaluationThe generated game is executed through a headless browser and evaluated using VLM (Visual Language Model). It scores the game across three dimensions: Build Health, Visual Usability, and Intent Alignment, outperforming static unit tests.

How to use OpenGame

  • Environmental preparationInstall Node.js 20+, clone the repository and execute. npm install,npm run build,npm link,Will opengame The command is registered to the system path.
  • Configure API key:set up OPENAI_API_KEY and optional OPENAI_BASE_URL,OPENAI_MODELSimultaneously configure multimodal provider keys (image, video, audio, inference), such as DashScope, Doubao, etc., see reference. .env.example.
  • Generate GameCreate an empty directory and execute. opengame -p "Build a Snake clone with WASD controls and a dark theme." --yoloThe agent will automatically complete the end-to-end build.
  • run locallyEnter the generated project directory and execute... npm install and npm run devOpen in browser http://localhost:5173 You can play there immediately.
  • Advanced configuration: can be passed settings.json(User level) ~/.qwen/settings.json or project level .qwen/settings.jsonAnd CLI parameter adjustment behavior; settings GAME_TEMPLATES_DIR and GAME_DOCS_DIR You can create a game at any location using an absolute path.

Key information and usage requirements for OpenGame

  • Open source license: An open-source project built on the qwen-code extension.
  • Operating modeCurrently in command-line Headless mode, one-click prompt word generation.
  • Model dependencySupports OpenAI-compatible APIs, with optional backends such as GameCoder-27B (local deployment) or Claude Sonnet 4.6.
  • Multimodal requirementsYou need to configure the API keys for image, video, and audio generation services yourself; the framework does not include a default provider.
  • Node.js versionRequires Node.js version 20 or higher.

OpenGame's core advantages

  • The first game-specific intelligent agent frameworkUnlike general code proxies, it is specifically designed for complex, multi-file projects and real-time interactive systems in end-to-end web games.
  • Structural stabilityTemplate Skill significantly reduces cross-file inconsistencies and scene connection errors through physical prototype classification and template family instantiation.
  • Cumulative debuggingThe Debug Skill's Living Protocol makes repair experience reusable, preventing the repeated discovery of the same integration errors.
  • Domain-specific modelsGameCoder-27B undergoes three stages of game code training, mastering engine APIs and multi-file game logic, outperforming general LLMs.
  • Dynamic playability verificationOpenGame-Bench evaluates the quality of actual interactions with VLM through a headless browser, rather than just checking static code compilation.
  • SOTA performanceWith 150 diverse game hints, it achieves Build Health 72.4, Visual Usability 67.2, and Intent Alignment 65.1 when equipped with Claude Sonnet 4.6, surpassing baselines such as Cursor.

OpenGame's project address

  • Project official websitehttps://www.opengame-project-page.com/
  • GitHub repository: https://github.com/leigest519/OpenGame
  • arXiv technical paper: https://arxiv.org/pdf/2604.18394

Comparison of OpenGame's similar products

Comparison Dimensions OpenGame Cursor + Claude Sonnet 4.6 Claude Sonnet 4.6 directly generates
Product Positioning End-to-end web game dedicated intelligent agent framework General-purpose AI programming IDE + intelligent agent backend Zero-shot code generation for general large language models
Project scaffolding Template Skill automatically matches multi-file template families based on physical prototypes, forcing Hook-Driven code organization. There is no dedicated game scaffolding; it relies on general file navigation and manual initialization. It easily degenerates into a single-file Vanilla HTML5/JS, lacking cross-file state synchronization.
Debugging mechanism Debug Skill dynamically accumulates and integrates error repair protocols, using pre-execution verification + runtime iterative repair. General compilation error repair, with no specific accumulation of knowledge on runtime and scene connection errors in games. There is no systematic debugging loop; manual prompts and corrections are required repeatedly.
Evaluation methods OpenGame-Bench: Headless browser + VLM for dynamic playability evaluation Static unit testing or manual inspection Static code analysis or manual testing
Building Health (BH) 72.4 66.8 59.8
Visual Usability (VU) 67.2 61.4 61.3
Intended Alignment (IA) 65.1 58.9 55.2
Core gap Structural Leadership: Templated scaffolding + dynamic debugging protocol systematically solves inconsistencies across files. General-purpose tools lack solidified knowledge in the gaming field, and complex engineering is prone to logical drift. The bare model lacks engineering constraints, and global state loss and scene connection errors occur frequently.

Application scenarios of OpenGame

  • Independent developer prototype verificationIt can quickly transform game ideas into playable demos, reducing the initial technical barriers and engine learning costs.
  • Educational interactive content developmentTeachers can integrate course knowledge points (such as physics and mathematics) into game mechanics to generate quiz-based fighting or level-based games to assist teaching.
  • Marketing and social media viral contentBloggers or brands can quickly generate customized interactive mini-games based on trending memes or IPs for social media dissemination.
  • Game design concept proofThe planners quickly generated interactive prototypes using natural language descriptions to verify the feasibility of the core gameplay and visual style.
  • AI Game Generation ResearchIt provides the academic community with a standardized end-to-end game generation framework and evaluation benchmark (OpenGame-Bench), and promotes the evolution of code proxies towards complex interactive applications.