Real-Time World Crafting: Generating Structured Game Behaviors from Natural Language with Large Language Models
Austin Drake, Hang Dong
TL;DR
This paper presents Latent Space, a DSL-mediated architecture that safely translates natural language commands into executable game mechanics by grounding LLM outputs in a constrained JSON-based DSL executed within an ECS. Through two game modes—spell-based Battle Mode and cellular automata–based Alchemy Mode—the authors evaluate multiple modern LLMs under varied prompting strategies, demonstrating that model quality and task structure strongly influence translation quality and emergent gameplay potential. A validated LLM judge and a human pilot study provide both automated and human perspectives on Creative Alignment, Instruction Following, Emergence, and Structural Coherence, revealing a trade-off between precision and creative throughput. The work contributes a practical LLM–ECS pattern, comparative model insights, and prompting guidelines, offering a pathway toward safer, scalable language-driven gameplay with measurable performance and guidance for future research and tooling in game development. The results highlight the importance of tooling, grounding, and abstraction level in enabling emergent behavior while maintaining system stability and safety in real-time interactive environments.
Abstract
We present a novel architecture for safely integrating Large Language Models (LLMs) into interactive game engines, allowing players to "program" new behaviors using natural language. Our framework mitigates risks by using an LLM to translate commands into a constrained Domain-Specific Language (DSL), which configures a custom Entity-Component-System (ECS) at runtime. We evaluated this system in a 2D spell-crafting game prototype by experimentally assessing models from the Gemini, GPT, and Claude families with various prompting strategies. A validated LLM judge qualitatively rated the outputs, showing that while larger models better captured creative intent, the optimal prompting strategy is task-dependent: Chain-of-Thought improved creative alignment, while few-shot examples were necessary to generate more complex DSL scripts. This work offers a validated LLM-ECS pattern for emergent gameplay and a quantitative performance comparison for developers.
