Abstract
The Instruction-Driven Game Engine (IDGE) project aims to democratize game development by enabling a large language model (LLM) to follow free-form game rules and autonomously generate game-play processes. The IDGE allows users to create games by issuing simple natural language instructions, which significantly lowers the barrier for game development. We approach the learning process for IDGEs as a Next State Prediction task, wherein the model autoregressively predicts in-game states given player actions. It is a challenging task because the computation of in-game states must be precise; otherwise, slight errors could disrupt the game-play. To address this, we train the IDGE in a curriculum manner that progressively increases the model's exposure to complex scenarios. Our initial progress lies in developing an IDGE for Poker, a universally cherished card game. The engine we've designed not only supports a wide range of poker variants but also allows for high customization of rules through natural language inputs. Furthermore, it also favors rapid prototyping of new games from minimal samples, proposing an innovative paradigm in game development that relies on minimal prompt and data engineering. This work lays the groundwork for future advancements in instruction-driven game creation, potentially transforming how games are designed and played.
Introduction
Traditional game development is often bottlenecked by the rigid nature of software engines, which require manual coding for every rule change or feature addition. This creates a significant barrier for players and designers who wish to experiment with novel game mechanics. The Instruction-Driven Game Engine (IDGE) project proposes a paradigm shift: using Large Language Models (LLMs) as the core logic keepers of a game. By interpreting free-form natural language instructions, an IDGE can autonomously generate and manage game-play processes, effectively democratizing game creation.
Problem Statement: The Precision Challenge
Unlike standard chat applications where minor hallucinations might be tolerable, a game engine must maintain perfect state consistency. A single error in calculating a chip count or "hallucinating" a card in a deck can break the entire game logic. The primary challenge lies in making LLMs precise enough to act as stable state machines over extended periods of play. General-purpose models like GPT-4, while capable in conversation, often fail to complete full game rounds correctly due to these accumulation of errors.
Methodology
The IDGE framework treats game simulation as a Next State Prediction (NSP) task. Formally, given a game script $z$ (the rules), the current state $s_{t-1}$, and a player action $x_t$, the model predicts the subsequent state $s_t$.
To achieve the required precision, the researchers implemented a Standard-to-Diverse Curriculum Learning strategy:
- Core Set Training: The model is first trained on 40 atomic functions (e.g., shuffling, dealing, hand evaluation).
- Standard Training: Learning from 100,000 samples across 10 standard poker variants.
- Diverse Training: Using GPT-3.5 to rephrase structured rules into diverse natural language descriptions to improve the model's linguistic robustness.
The team utilized CodeLLaMA and LLaMA2 models, fine-tuned via LoRA (Low-Rank Adaptation). Code-pretrained models showed superior performance in handling the structured nature of game states compared to general language models.
Key Results and Insights
The fine-tuned CodeLLaMA-13b-FT achieved an average state-level accuracy of 99.4%. A critical finding was the "Buckets Effect": the overall success of a game round is limited by the model's weakest sub-function. Even high accuracy in most tasks cannot compensate for a single failure point in a sequential state machine. On "Out-of-Domain" games with entirely new rules, the model achieved 100% success using few-shot prompting and Direct Preference Optimization (DPO) to rectify errors based on feedback.
Conclusion and Future Work
The IDGE project demonstrates that LLMs can serve as flexible, instruction-driven game engines, particularly for turn-based games. While current limitations include inference latency and context window constraints, future work aims to integrate these neural engines with visual rendering tools like Unity. This would allow for the automatic generation of 3D visual experiences directly from text-based state transitions, further closing the gap between creative vision and technical execution.
Summary updated