Code2games builds consistent gaming worlds from natural language prompts

Code2Games: Enabling Coding Agents for Gaming World Generation

Computer Vision and Pattern Recognition

Summary

Creating detailed and playable video game worlds from a simple text description is hard because many parts need to work together, like the scene, characters, and game rules. The researchers propose Code2Games, a system that starts by making a basic world in Blender and then carefully adds game logic and interactive elements while keeping everything consistent. It also translates the world into Unreal Engine 5 and fixes issues by testing and adjusting the game. Their tests show Code2Games makes better-looking, more interactive, and more playable game worlds than other methods.

What this means in practice

  • For game developers: Generate more consistent and high-quality game worlds from natural language descriptions, improving workflow from concept to playable game.$Commercial implications: A product that automates parts of game environment creation and logic setup for game studios enabled by Code2Games' framework.
  • For virtual reality designers: Create immersive and interactive VR worlds that maintain consistency between visuals and interactive elements from simple textual intents.

Authors

Wei Wu, Ziyang Xu, Zeyu Zhang, Yang Zhao, Hao Tang

Abstract

Generating a high-quality gaming world from a natural-language game intent requires joint reasoning about scene structure, spatial layout, gameplay objectives, interactive entities, and executable gameplay logic. Existing coding agents can generate individual assets, scenes, or scripts, but often struggle to maintain consistency across these components. We propose Code2Games, an agentic framework that builds a structured gaming world upon a base Blender world generated from the same game intent. Code2Games coordinates scene analysis, gameplay planning, constrained gaming-world generation, and gaming-engine customization through a shared scene-gameplay representation with persistent element correspondence. After world generation, Code2Games adapts the generated world to Unreal Engine 5 and employs an execution-guided reconstruction process that uses compilation diagnostics, runtime feedback, and gameplay test results to resolve inconsistencies arising during engine adaptation. To systematically evaluate gaming-world generation, we introduce the GameCode4D benchmark, which comprises ten fixed game prompts spanning different levels of scene and gameplay complexity. We evaluate the generated results across four dimensions: visual quality, interactive fidelity, multimodal artifact quality, and playable-game quality. Experiments demonstrate that, compared with direct gaming-world generation by coding agents and existing baseline methods, Code2Games consistently improves the visual quality and interactive fidelity of generated gaming worlds, as well as the quality of the resulting games after engine adaptation.