TL;DR
The Instruction-Driven Game Engine (IDGE) is a novel framework that transforms Large Language Models (LLMs) into functional game engines capable of simulating complex logic directly from natural language scripts. By framing gameplay as a "Next State Prediction" task and using a specialized curriculum learning strategy, researchers developed a system that can run standard poker variants and even invent entirely new games on the fly based on user descriptions.
The Challenge of Logical Consistency in Game Engines
Traditional game development is gated by a significant technical barrier: the need to master programming languages and complex engine architectures. This creates a disconnect between the creative vision of players and the practical constraints of developers. While recent AI research has explored video-based game generation, these models often struggle with the underlying logical consistency required for a functional game.
The authors address this by proposing the IDGE, which focuses on text-based game states. The challenge is twofold: stability (the engine must be 100% precise with rules and numbers over long sessions) and diversity (it must follow free-form, creative instructions). Models trained directly on raw game logs often fail at both, leading to an "ironic twist" where the model is neither stable nor diverse enough for actual play.
Methodology: Next State Prediction
The core of the IDGE is a fine-tuned LLM (specifically CodeGemma-7b) that treats gameplay as an autoregressive prediction problem.
- Next State Prediction (NSP): The engine predicts the next game state ($s_t$) based on the user-provided game script ($z$), the previous state ($s_{t-1}$), and the player's action ($x_t$).
- Code Modality & Core Functions: Recognizing that LLMs struggle with precise math (like calculating pot splits) and true randomness (like shuffling), the IDGE is designed to call "core functions." It can generate intermediate Python-like code that an external interpreter executes to ensure logical perfection.
Differential State Prediction (DSP)
To improve efficiency and accuracy, the authors introduced Differential State Prediction (DSP). Instead of regenerating the entire state—which can be token-heavy—the model predicts only the change ($\Delta s_t$) between states. This delta is then merged with the previous state using a code interpreter.
Training and Evaluation
The model is trained in three stages: a warmup for core functions, a standard stage for poker scripts, and a diverse stage using "Segment Rephrasing" (SR) to force the model to understand semantics rather than just memorizing templates.
The researchers constructed a specialized dataset of 10k state prediction samples using a custom poker simulator. To test true "instruction-following," proficient poker players created eight entirely new game scripts (e.g., "Dragonie" with new ranking rules) and played 80 rounds to evaluate the engine's adaptability.
Key Results
- 100% Success Rate: The fully trained IDGE achieved a 100% success rate across all ten in-domain poker variants.
- Zero-Shot Generalization: The model showed remarkable ability to handle novel games. In "Dragonie," it successfully learned a new suit-ranking hierarchy purely from the text script.
- Efficiency Gains: Predicting state deltas (DSP) reduced the average output length from ~405 tokens to ~136 tokens while actually increasing accuracy.
- Failure of General LLMs: Surprisingly, even GPT-4 (5-shot) failed to complete a single full round of poker successfully, frequently hallucinating cards or messing up the dealing order.
Conclusion
The IDGE demonstrates that LLMs can serve as reliable, instruction-following game engines for turn-based strategy games. While current inference latency is too slow for real-time genres, future work aims to expand the framework and integrate it with visual rendering engines like Unity for a complete "text-to-game" experience.
Summary updated