Code2Games:为游戏世界生成启用编码代理
研究论文 · 2026/10/06
从自然语言游戏意图生成高质量游戏世界需要联合推理场景结构、空间布局、游戏目标、交互实体和可执行游戏逻辑。现有编码智能体可以生成单个资产、场景或脚本,但往往难以保持这些组件之间的一致性。我们提出 Code2Games,一个智能体框架,它在由同一游戏意图生成的基础 Blender 世界上构建结构化游戏世界。Code2Games 通过具有持久元素对应关系的共享场景-游戏表示,协调场景分析、游戏规划、受限游戏世界生成和游戏引擎定制。在世界生成之后,Code2Games 将生成的世界适配到 Unreal Engine 5,并采用执行引导的重建过程,利用编译诊断、运行时反馈和游戏测试结果来解决引擎适配过程中出现的不一致。为了系统评估游戏世界生成,我们引入了 GameCode4D 基准,它包含十个固定的游戏提示,涵盖不同级别的场景和游戏复杂度。我们从四个维度评估生成结果:视觉质量、交互保真度、多模态产物质量和可玩游戏质量。实验表明,与编码智能体直接生成游戏世界和现有基线方法相比,Code2Games 持续提高了生成游戏世界的视觉质量和交互保真度,以及引擎适配后所得游戏的质量。
该研究解决了编码智能体在生成游戏世界时组件一致性差的痛点,提出了系统性的框架和评估基准,并通过实验验证了其在视觉质量、交互保真度和可玩性上的提升,对游戏生成和智能体研究具有参考价值。
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.