Video Game Description Language (VGDL)
- VGDL is a domain-specific language that encodes 2D game rules and level layouts in a concise, machine-readable text format.
- It uses a structured EBNF grammar for defining sprites, interactions, and termination conditions, facilitating both human and automated game synthesis.
- Integrating with the GVGAI framework, VGDL supports agent evaluation, procedural content generation, and benchmarking for AI research.
The Video Game Description Language (VGDL) is a domain-specific, declarative language designed to encode both the rules and level layouts of 2D arcade-style games in a concise, machine-readable text format. It provides foundational infrastructure for the General Video Game AI (GVGAI) framework and is a principal tool in procedural content generation, agent evaluation, and generative game design. VGDL’s compact syntax, structured grammar, and explicit separation of game structure facilitate both human authoring and automated synthesis of new games, supporting experimental and benchmarking needs in AI research (Hu et al., 2024, Perez-Liebana et al., 2018).
1. Origins and Motivations
VGDL was originally developed by Schaul (2013) to enable the automatic generation and simulation of a wide variety of 2D games, primarily in the context of the GVGAI competition and its research framework. Its purpose is twofold: first, to abstract the specification of game mechanics and environments from any single title, and second, to enable the procedural synthesis, modification, and evaluation of novel games by AI agents and PCG algorithms (Perez-Liebana et al., 2018). The language design prioritizes minimalism (with only a handful of core blocks), readability (ASCII-level notation for levels), and direct mappability to simulation engines.
In PCG, VGDL serves as a unified target representation: game rules (mechanics, interactions, and win/loss conditions) and concrete level layouts are encoded together, supporting automatic parsing, simulation, and playability assessment (Hu et al., 2024). The GVGAI open-source framework parses VGDL directly, compiling structural and behavioral information into the in-memory representation required for both human and AI play.
2. Formal Grammar and Syntax
VGDL is formally defined using an Extended Backus–Naur Form (EBNF) grammar to specify its syntactic constructs. The language consists of distinct blocks for high-level game definition, sprite types, inter-sprite interactions, termination (win/lose) conditions, and level mapping. A minimal but complete example is as follows (Hu et al., 2024):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
BasicGame SpriteSet wall > Immovable color=GRAY avatar > MovingAvatar color=BLUE goal > Immovable color=GOLD singleton=True LevelMapping W > wall A > avatar G > goal InteractionSet avatar wall > stepBack avatar goal > removeSprite TerminationSet SpriteCounter stype=goal limit=0 win=True |
The corresponding ASCII map for the level is stored separately:
1 2 3 4 5 6 7 |
WWWWWWWWW WA W W W WWW W W W GW W W WWWWW W W W WWWWWWWWW |
The formal grammar, as presented in (Hu et al., 2024), uses the following EBNF (LaTeX typesetting):
$\begin{array}{r@{\,::=\;}l} \langle\text{game}\rangle & \text{game\_class}\;\langle eol\rangle\;\text{INDENT}\; \langle level\text{-}block\rangle\;\langle sprite\text{-}block\rangle\; \langle interaction\text{-}block\rangle\;\langle termination\text{-}block\rangle, \[6pt] \langle level\text{-}block\rangle & \text{LevelMapping}\;\langle eol\rangle\;\text{INDENT}\;\{\langle char\_map\rangle\;\text{NEWLINE}\}\;\text{DEDENT}, \[3pt] \langle sprite\text{-}block\rangle & \text{SpriteSet}\;\langle eol\rangle\;\text{INDENT}\;\{\langle sprite\_def\rangle\;\text{NEWLINE}\}\;\text{DEDENT}, \[3pt] \langle interaction\text{-}block\rangle & \text{InteractionSet}\;\langle eol\rangle\;\text{INDENT}\;\{\langle interaction\_def\rangle\;\langle eol\rangle\}\;\text{DEDENT}, \[3pt] \langle termination\text{-}block\rangle & \text{TerminationSet}\;\langle eol\rangle\;\text{INDENT}\;\{\langle termination\_def\rangle\;\langle eol\rangle\}\;\text{DEDENT}, \[6pt] \langle char\_map\rangle & \text{CHAR}\;\texttt{">"}\;\langle sprite\_type\rangle\;(\,\text{``\ "} \langle sprite\_type\rangle)^*, \[3pt] \langle sprite\_def\rangle & \langle sprite\_type\rangle\;\texttt{">"}\;\langle class\rangle\;( \langle option\rangle)^*, \[3pt] \langle interaction\_def\rangle & \langle sprite\_type\rangle\;\langle sprite\_type\rangle\;\texttt{">"}\;\langle method\rangle\;( \langle option\rangle)^*, \[3pt] \langle termination\_def\rangle & \langle term\_class\rangle\;( \langle option\rangle)^*, \[3pt] \langle option\rangle & \text{IDENTIFIER}\;\texttt{=}\;( \langle sprite\_type\rangle \mid \langle evaluable\rangle ), \[3pt] \langle eol\rangle & (\texttt{" "})^*\;[\texttt{"\#"}\;(\text{CHAR}\mid\text{" "})]^*\;\texttt{NEWLINE}. \end{array}$
The core structure consists of four sections: SpriteSet, InteractionSet, TerminationSet, and LevelMapping (plus optional Level blocks) (Perez-Liebana et al., 2018).
3. Core Language Constructs
VGDL's declarative structure allows for clear specification of both spatial and gameplay elements. The four principal sections are summarized below:
| Section | Function | Example Line |
|---|---|---|
| SpriteSet | Defines sprite types and associated parameters | avatar > MovingAvatar color=BLUE |
| LevelMapping | Maps ASCII characters to sprite types | A > avatar |
| InteractionSet | Pairs of sprite interactions and their effects | avatar wall > stepBack |
| TerminationSet | Win/lose/stop conditions (numeric, timer, etc.) | SpriteCounter stype=goal limit=0 win |
- SpriteSet: Each line defines a sprite identifier, its VGDL class derivative, and optional parameters (e.g., color, singleton).
- LevelMapping: Associates ASCII symbols in a level file to one or more sprites.
- InteractionSet: Lists collision rules, e.g., what occurs when the avatar touches a wall or a goal.
- TerminationSet: Expresses when the game ends, using predicates like SpriteCounter, Timeout (Perez-Liebana et al., 2018).
Inheritance is supported, with classes such as Immovable, MovingAvatar, MissileShooter, NPC, and Portal denoting behavioral properties. Parameters handle movement, spawn rates, color, and constraints.
4. Execution Semantics and Framework Integration
At runtime, a VGDL game is parsed into internal Java/Python objects within the GVGAI engine. Each block is mapped to factory objects (sprites, effects, terminals), and the game loop executes a fixed pipeline every tick:
a) Portals spawn sprites if their cooldown expires b) Avatar/NPCs select actions c) Movables update position d) Collision detection fires InteractionSet rules e) Effects (removals, score changes, spawns) are applied immediately f) TerminationSet is checked; win/lose triggers end immediately g) Next state is dispatched to the GUI or AI agent (Perez-Liebana et al., 2018)
All interactions are immediate; sprawling or chained effects are scheduled only in the next tick. VGDL’s design supports forward simulation (copy-and-step models) for planning agents, quick reconfiguration for level/rule generation tracks, and interpretable mappings between text and world state.
5. Procedural Content Generation and LLM-Driven Game Synthesis
VGDL is central in procedural content generation pipelines, acting as both the input format and output schema for algorithms that evolve or synthesize new games (Hu et al., 2024). In the context of LLM–driven game generation, a prompt can contain: (i) a base instruction, (ii) explicit mapping of ASCII codes to sprites, (iii) the EBNF grammar with type constraints, and (iv) a canonical example (e.g., Aliens). This prompt structure allows LLMs such as GPT-4 to generate both rule sets and level files in fully valid, logically sound VGDL code.
Combinatorial prompt ablation shows that full context (grammar + example + level key) is required for reliable, fully functional outputs. Under the most complete prompt (), GPT-4 achieves 10/10 in parsability, logical coherence, and mapping correctness; for less powerful models (e.g., GPT-3.5), correctness drops, and for open-source models (e.g., Gemma 7B), failures dominate (Hu et al., 2024).
VGDL is used strictly as plain text in LLM contexts—no special tokenization is needed. Type constraints in the prompt are essential to guide LLMs toward supported sprite classes and methods.
6. Extensibility, Modifications, and Limitations
VGDL’s section-based and text-centric architecture ensures extensibility; new games and levels can be authored or evolved simply by editing text blocks or ASCII maps. The engine accepts new sprite classes and interaction types via Java subclassing, though the ontology of valid types/effects is fixed in the parser.
In recent work, the “removeSprite” interaction was added to accommodate the LLMs' subject-verb-object logic, distinguishing it from the conventional “killSprite” (which targets the first argument). This modification aligns syntactic expectations with the semantics of VGDL execution without requiring changes to the underlying simulation engine (Hu et al., 2024).
Intrinsic limitations are present:
- Restricted to 2D grid-based or simple physics games;
- No support for continuous actions, advanced physics, 3D environments, or global puzzle-like state;
- Expressivity is bounded by the core block types and the pre-defined effect set.
7. Research Impact and Benchmarks
VGDL, as formalized within the GVGAI competition framework, provides a unique multi-track testbed for AI research. Its declarative grammar underpins agent planning, learning, rule and level generation competitions, and offers a benchmark platform that contrasts with the Atari Learning Environment (ALE). VGDL games are extensible and interpretable; their playability can be formally tested by automated agents.
The research trajectory includes proposals for richer sprite parameterization, continuous actions, support for higher-dimensional worlds, multi-agent extensions, and integration with platforms such as OpenAI Gym, ALE, and Malmo. The GVGAI framework, leveraging VGDL, continues to be a key enabler for empirical evaluation of general video game–playing agents and procedural game content methods (Perez-Liebana et al., 2018).