Skip to content

Game Description File

Raluca D. Gaina edited this page Feb 12, 2018 · 2 revisions

This section is about the first file of VGDL. This file specifies how the game is played and all the interactions. The file describes games in a very concise manner, each game taking a few dozens of lines of plain text. The definition is divided into four sections.

  • SpriteSet: Defines all available sprites for the game, including their parameters and display settings.
  • TerminationSet: Specifies the end conditions of the game, indicating whether the player wins or not.
  • InteractionSet: Specifies what events occur when two sprites of a given type collide in the game.
  • LevelMapping: Defines relationships between characters, used in the level definitions, and the available sprites.

The following is a general format for the Game Description file.

BasicGame
    SpriteSet
        ....
    InteractionSet
        ....
    TerminationSet
        ....
    LevelMapping
        ....

The following is a general format for two player games for the Game Description file.

BasicGame no_players=2
    SpriteSet
        ....
    InteractionSet
        ....
    TerminationSet
        ....
    LevelMapping
        ....

The first line must include the number of players (if not specified, the default value of 1 is used instead).

Examples:

The following examples will show different game description files for different games which will help to have an overview about writing these files.

BasicGame
    SpriteSet
        hole   > Immovable color=DARKBLUE img=hole
        avatar > MovingAvatar
        box    > Passive img=box
        wall   > Immovable img=wall
    InteractionSet
        avatar wall > stepBack
        box avatar  > bounceForward
        box wall    > undoAll
        box box     > undoAll
        box hole    > killSprite scoreChange=1
    TerminationSet
        SpriteCounter stype=box limit=0 win=True
    LevelMapping
        0 > hole
        1 > box
        A > avatar
        w > wall

The above example is a simplified version of Sokoban game. The avatar tries to destroy all boxes by moving them over a hole.

BasicGame
    SpriteSet
        exit > Door img=exit
        wall > Immovable img=wall
        water > Immovable img=water
        box > Passive img=box
        avatar > MovingAvatar img=avatar
    TerminationSet
        SpriteCounter stype=door limit=0 win=True
        SpriteCounter stype=avatar limit=0 win=False
    InteractionSet
        avatar wall > stepBack
        box avatar > bounceForward
        box wall > undoAll
        wall box > undoAll
        box box > undoAll
        water box > killSprite
        box water > killSprite
        avatar water > killSprite
        exit avatar > killSprite
    LevelMapping
        A > avatar
        w > wall
        x > water
        b > box
        e > exit

This is a game called WaterGame where your goal is to reach the exit without drowning in water. The path towards the exit is always blocked with water and it can be destroyed by pushing box over water.

Table of Contents:

Clone this wiki locally