Source-linked AI summary

Compiling VGDL into Causal Models

Mohit Jiwatode, Bodo Rosenhahn, Alexander Dockhorn

arXiv:2609.05459v1cs.AI

TL;DR

Game AI lacks a formal way to map complex mechanics into causal models, while reinforcement learning and language models can rely on spurious correlations or hallucinated rules. The paper deterministically compiles VGDL descriptions into Dynamic Structural Causal Models, producing grounded causal representations for reasoning and agent development.

  • Problem

    Game AI lacks a formal methodology for mapping complex game mechanics into causal models, while reinforcement learning and language models can misrepresent those mechanics.

  • Method

    The framework deterministically translates VGDL sprite dynamics, interactions, layouts, and termination rules into a Dynamic Structural Causal Model across game ticks.

  • Results

    The resulting models provide explicit causal pathways and causal fidelity to the ground-truth mechanics, supporting interventions and counterfactual analysis.

  • Takeaways & Limitations

    The framework supports explainable game reasoning, causal reinforcement learning, counterfactual simulation, and procedural validation of game descriptions.

  • Takeaways & Limitations

    Model size scales with VGDL complexity, while intricate physics, hidden states, or implementation deviations may require approximations or produce mapping errors.

Abstract

from arXiv · show

Reinforcement learning and large language models often struggle to accurately capture the causal mechanics of game environments. Standard reinforcement learning agents tend to rely on spurious correlations, while large language models are prone to hallucinating game rules. Although causal reinforcement learning improves interpretability, there is currently no formal methodology to map complex game mechanics directly into causal models. To address this, we propose a deterministic framework that compiles games specified in the Video Game Description Language into Dynamic Structural Causal Models. Rather than inferring causal structures from gameplay traces or noisy large language models' outputs, our methodology directly translates game components, including sprite dynamics, interaction rules, and termination conditions, into explicit structural equations. Each game tick represents a causal transition from state variables at time $t$ to $t+1$. By establishing this grounded mapping, the approach guarantees absolute causal fidelity to the ground-truth game mechanics. The resulting models offer transparent causal pathways that support counterfactual reasoning, causal reinforcement learning agent training, and procedural content validation. This framework provides a principled bridge between symbolic game descriptions and causally grounded game AI.

I. INTRODUCTION

Game AI agents struggle to capture true causal mechanics: reinforcement learning can rely on spurious correlations, while language models may hallucinate or misidentify rules. Existing approaches lack a formal framework for mapping game mechanics into structured causal models.

  • Standard reinforcement learning methods struggle to understand underlying causal game mechanics because their deep models are generally opaque.
  • Hidden rules and changing environments create adaptation challenges for naive game-learning agents.
  • Observation-based knowledge bases may encode spurious correlations instead of the true rules of the underlying environment.
  • Existing game benchmarks and agents rarely incorporate causality, and no formal framework maps game mechanics into causal models.
  • Logic-based systems support strategy analysis and logical causal reasoning but do not provide the structured causal models targeted here.

A. Causality

Causality distinguishes association, intervention, and counterfactual reasoning, while dynamic structural causal models extend structural causal models across discrete time. These models represent temporal dependencies through functions that derive variables from their current and preceding parents.

  • Causality supports predicting outcomes beyond correlations through association, intervention, and counterfactual reasoning.
  • An SCM consists of exogenous variables, endogenous variables, and functions deriving each endogenous variable from its parents and corresponding noise variable.
  • A DSCM indexes variables over discrete time and defines each state from parents in current and preceding time steps.
  • Figure 1 illustrates a DSCM through a causal-dependency graph paired with structural equations defining recursive assignments.

B. General Video Game AI (GVGAI) and Video Game Description Language (VGDL)

GVGAI provides a unified interface for comparing agents across arcade-like games, whose VGDL descriptions specify sprites, level mappings, termination conditions, and interactions. The proposed approach deterministically compiles these VGDL rules into a two-time-slice dynamic SCM rather than learning rules from traces.

  • GVGAI enables comparison of AI agents across a large corpus of arcade-like games through a unified interface.
  • VGDL is a lightweight, human-readable format comprising a sprite set, level mapping, termination set, and interaction set.
  • VGDL termination and interaction sets describe game logic through collision outcomes expressed as cause-and-effect relationships.
  • The approach deterministically compiles known VGDL rules into a two-time-slice SCM, avoiding language-model inference and matching ground-truth mechanics.

III. DYNAMIC CAUSAL MODEL OF GAMES

The framework models a VGDL game as a Dynamic Structural Causal Model whose time-indexed state transitions are determined directly by sprite, layout, interaction, and termination elements. Exogenous inputs include player actions, randomness, and the initial level layout.

  • Dynamic causal model: Each game tick is represented as a causal transition from state t to t + 1, with VGDL elements determining the structural causal relationships.The mapping uses SpriteSet, LevelMapping, InteractionSet, and TerminationSet rather than learning parents from gameplay correlations.
  • State representation: The endogenous state includes sprite position, orientation, velocity, alive-state, resource, health, time, live-instance counts, and terminal conditions.Not every game uses every attribute; basicgame uses position, orientation, velocity, alive-state, live-instance counts, and terminal-state variables.
  • State representation: The state is indexed over sprite types and instances, while termination conditions form a separate set of win or loss variables.Terminal variables are abbreviated as Terminal in the concrete mapping, alongside P, O, V, A, and Count.
  • Exogenous inputs: Exogenous variables represent the player or agent action, stochastic random choices, and the initial level-layout symbols.The initial layout is exogenous because it is specified before play and determines which sprite instances exist and where they are placed.
  • Structural functions: The framework compiles VGDL components into explicit structural functions whose causal parents are obtained from the game description rather than inferred from correlations.Table I provides the concrete basicgame mapping using abbreviated causal variables and exogenous inputs.

A. Sprite Dynamics

Sprite classes contribute local causal mechanisms that update attributes between game ticks. These mechanisms distinguish action-dependent, randomness-dependent, and persistent sprite behavior before interactions modify the next state.

  • Local sprite mechanisms: Sprite dynamics update attributes such as position, orientation, velocity, and alive-state from time t to time t + 1.Each sprite class contributes a local mechanism derived from its VGDL SpriteSet definition.
  • Moving sprites: A moving sprite’s next position depends on its current position, orientation, velocity, and relevant input.For the avatar, the relevant input is the player action; for a random enemy, it is the random-number input.
  • Moving sprites: MovingAvatar behavior is action-dependent, whereas RandomNPC behavior is RNG-dependent.The distinction makes the causal role of each sprite class explicit in the baseline state transition.
  • Immovable sprites: Immovable sprites use an identity position mechanism and preserve their alive-state unless an interaction rule changes it.Walls and goals therefore persist through the baseline sprite transition.
  • Interaction effects: Sprite dynamics define the baseline transition before interaction rules such as stepBack or killSprite modify the next state.Interactions therefore act on the state produced by the sprite-class mechanisms.

B. Interaction Mechanisms

Interaction mechanisms translate VGDL collision rules into explicit causal updates to sprite states. Each rule specifies the spatial condition, affected state, and VGDL operation governing the next state.

  • Interaction mechanisms derive from the VGDL InteractionSet and define how one sprite’s state changes when it spatially interacts with another.
  • An interaction activates when two sprites satisfy a spatial condition such as overlap.
  • Rules such as stepBack modify the affected sprite’s next-state variable when attempted movement causes contact with an obstacle.
  • The killSprite rule changes the affected sprite’s alive-state when the required overlap condition holds.
  • These mechanisms encode causal effects of spatial contact by specifying which state changes, under which condition, and through which VGDL rule.

C. Termination Mechanisms

Termination mechanisms derive win and loss conditions from VGDL’s TerminationSet. They compute terminal states from sprite alive-state counts, making termination downstream of earlier dynamics and interactions.

  • Termination mechanisms define when the game reaches a win or loss state using rules from the VGDL TerminationSet.
  • For basicgame, termination depends on live-instance counts for goal and avatar sprites.
  • Live-instance counts are computed from the alive-state variables for each sprite type.
  • A terminal variable is computed from each sprite type’s live-instance count.
  • In basicgame, the game is won when no goal sprites remain and lost when no avatar sprites remain.
  • Termination nodes are leaf nodes that summarize earlier sprite dynamics and interactions rather than directly causing movement or collision outcomes.

IV. DISCUSSION AND FUTURE WORK

The dynamic SCM framework makes game causal pathways explicit and supports counterfactual reasoning, causal reinforcement learning, and procedural validation. Its scalability and fidelity depend on VGDL complexity and agreement between the description and implementation, motivating broader tooling and evaluation.

  • The framework supports explainability by making causal pathways explicit, enables counterfactual simulation, and supplies a full state model for causal reinforcement learning.
  • It also supports procedural content validation by testing whether generated game descriptions are logically consistent through their implied causal models.
  • The causal model’s size scales with the complexity of the VGDL description, while intricate physics or hidden states may require structural approximations.
  • If the implementation deviates from the VGDL design through bugs or unmodeled nuances, errors arise in the causal mapping.
  • Future work includes semiautomated extraction from game code, extensions to multi-agent or real-time games, empirical evaluation, and alternative spatial encodings.
  • Mapping games to a dynamic causal framework enables reasoning about actions and outcomes while complementing statistical and learning-based methods.
Loading 2609.05459v1…