Table of Contents
Fetching ...

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.

Real-Time World Crafting: Generating Structured Game Behaviors from Natural Language with Large Language Models

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.
Paper Structure (32 sections, 7 figures, 4 tables)

This paper contains 32 sections, 7 figures, 4 tables.

Figures (7)

  • Figure 1: A flow diagram of the developed architecture. The LLM interface (left) handles translating Natural Language (NL) into DSL code. The ECS (center) consists of data output by the LLM and logical systems operating on that data. The I/O container (outside edges) is the mode of content delivery and interaction for the player.
  • Figure 2: A pair of screenshots from Latent Space's Battle Mode. Natural language magic descriptions, e.g., "Singeing arrow volley," entered into the text interface (left), can have explosive consequences (right). Each team's remaining players and their health (red/purple) are visible above, as is the amount of time remaining for each turn.
  • Figure 3: A screenshot from Latent Space's Alchemy Mode. Natural language material descriptions are translated into actionable cellular automata rules (right) by the LLM. Players can observe the generated behaviors in the workspace (left).
  • Figure 4: An example of the magical spell scripting DSL (left) and the cellular automata DSL (right). In natural language, these are "A controllable wind pixie that warps me when I call," and "a cloudy gas that diffuses randomly."
  • Figure 5: Clustered bar chart for the bidirectional translation experiment. Left: Jaccard Similarity (higher is better). Right: Tree Edit Distance (lower is better).
  • ...and 2 more figures