Skip to content

VGDL Language

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

The Video Game Definition Language (VGDL) is a language design by Tom Schaul, originally implemented by him in Python using py-game. This project is a Java port of the original py-vgdl (we call it, not surprisingly, java-vgdl). The Java port is not fully function yet compared to the original engine (only support GridPhysics).

To define a game in VGDL, you need to define two or more files:

Here is an example for Game Description File for Sokoban game:

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

Here is the first Level Description File:

wwwwwwwwwwwww
w        w  w
w   1       w
w   A 1 w 0ww
www w1  wwwww
w       w 0 w
w 1        ww
w          ww
wwwwwwwwwwwww

Here is the two player Sokoban Game Description File:

BasicGame key_handler=Pulse square_size=50 no_players=2
    SpriteSet
        hole   > Immovable color=DARKBLUE img=hole
        ground > Immovable img=water hidden=True
        avatar > MovingAvatar
            avatar1 > img=avatar
            avatar2 > img=alien
        bbox    > Passive 
            box > img=box
            boxin > img=city
			
    LevelMapping
        0 > hole
        1 > box ground
        . > ground
        A > avatar1 ground
        B > avatar2 ground
	
    InteractionSet
        avatar wall avatar > stepBack
        bbox avatar  > bounceForward
        bbox wall bbox   > undoAll
        box hole    > transformTo stype=boxin scoreChange=1,1
        boxin ground > transformTo stype=box scoreChange=-1,-1
	
    TerminationSet
        SpriteCounter stype=box    limit=0 win=True,True

Here is its first Level Description File:

wwwww....
wA..w....
w.11w.www
w.1.w.w0w
www.www0w
.ww....0w
.w.B.w..w
.w...wwww
.wwwww...

The following sections describe each file in details.

Table of Contents:

Clone this wiki locally