XMLGameEngine is a VGDL (video game description language) and an engine for running games completely contained within an XML file.
A <map> is level data drawn as text: each <row> is a row of tiles, one character a tile, so the file shows the level as it looks. It stands in any <objects>, or in the kit. With <cells /> it is a playfield of cells for grid puzzles and board games.
<map name="maze">
<tile><width>tile</width><height>tile</height></tile>
<position><x>0</x><y>top</y></position>
<row>r--------T--------7</row>
<row>|o.......|.......o|</row>
<row>|.[].[-].u.[-].[].|</row>
...
<group name="walls" class="wall">
<group name="across" char="-"> <sprite>...</sprite> </group>
<group name="corner" char="r"> <sprite>...</sprite> </group>
</group>
<group name="dots" char="." class="food"> ... </group>
<object name="pacman" char="@"> ... </object>
</map>
<tile> is a tile’s size, <position> the map’s top left. Rows must be equally wide.char="x" has a member in the middle of every tile of that character, named under the map in reading order (maze.dots.1). It has no position or members of its own, but everything else a group has, inner groups too.,), not a space.<reset object="maze" />).<map name="maze"><row>+-+x+-+</row> ... </map>.An object with <maze map="maze"> walks that map’s tiles: it keeps to the middle of its lane, chooses its way only in the middle of a tile, and never steps onto a tile that is a wall to it.
<maze map="maze">
<wall class="wall" />
<wall class="door" sprite="normal" /> <!-- a wall only while it shows "normal" -->
<slow class="tunnel">0.5</slow> <!-- half speed on those tiles -->
</maze>
<wall>s: every object of that class on the map in play, optionally only while the walker shows a look. So ghost eyes go in through a door that stops ghosts.<go> (a player’s stick), <hunt> (arcade targeting), <wander> (at random).<wrap /> brings it round.<reverse /> turns it round; <stop /> or a reset stops it until told again.A map with <cells /> is a playfield such as Tetris’s well: pieces move a whole cell at a time, it knows which cell holds what, and it can be asked about its rows.
<map name="board">
<tile><width>cell</width><height>cell</height></tile>
<position><x>left</x><y>top</y></position>
<columns>10</columns> <!-- in place of rows: an empty map -->
<rows>20</rows>
<cells />
<group name="blocks" class="block">
<group name="cyan" char="i"> ... </group> <!-- on no tile: waits to be spawned -->
</group>
<group name="pieces" class="falling">
<timers><timer><every>status.gravity</every><hop direction="down" /></timer></timers>
<collisions><collision edge="bottom"><settle /></collision></collisions>
<group name="t">
<shape>
<row>.t.</row>
<row>ttt</row>
<row>...</row>
</shape>
</group>
</group>
<checks>
<full class="block"><clear /><collapse /><inc variable="status.lines" /></full>
</checks>
</map>
<row>s, or <columns> and <rows> for one that starts empty (not both).board.cyan) until spawned into a cell.<spawn object="pieces"><random /><column>4</column><row>1</row></spawn>. Column and row count from 1; left out, they are the spawner’s cell. <free /> is a free cell at random (<free><below>6</below></free>: under row 6). <random /> picks one member of a group. A spawn into a taken cell or off the map is refused.<shape> is a piece of several cells drawn as rows; each character is the map’s piece that picks it, . is no cell. A group of groups may pick one character for all of them: a shape’s cell of that character is any one at random (Columns’ jewels). Live numbers column and row are a piece’s cell.| Verb | Does |
|---|---|
<hop direction="down" /> |
one cell (its content: that many) |
<move direction="left">12<wait>0.2</wait></move> |
held: one step, waits, then 12 cells a second |
<slide direction="down" /> |
cell by cell at once until refused (Tetris’s hard drop) |
<turn direction="clockwise" /> |
a quarter turn of a shape, once a press |
<cycle /> |
each cell of a shape moves on along its outline (Columns) |
<go direction="up">8</go> |
keeps going 8 cells a second until another <go> |
<collision class="block" side="bottom">, <collision edge="bottom">. If the rules take away what was in the way (<despawn />), the step goes on: that is how Snake eats. A <through /> makes the step into the taken cell anyway, the two sharing it.<chain object="body" /> on a piece: the pieces of that name behind it, drawn beside one another in the rows (ooo@), are its links; each step every link takes the cell of the one ahead. The tail is no blocker.
<grow />: one link longer after the next step.<split /> on a link (the one shot) cuts the chain: the link behind becomes a head with the rest, the old head’s way and look.<reverse /> turns a <go> round; a go straight back into the first link is refused.<settle /> ends a shape: it is despawned and its cells stay, loose. Then the map asks its checks.<joins> (after <grip>) names a look per way the joined piece lies: <alone sprite="pill" /><left sprite="openleft" /><right .../><up .../><down .../>. Settled cells with <joins> stay joined, and <fall /> moves them together (Capsules).Asked after each settle or put:
| Check | Finds | Then |
|---|---|---|
<full class="block"> |
each row whose every cell holds that class | its commands run once a row, bottom up; <clear /> takes the row away, <collapse /> brings everything above down a row |
<line class="jewel"><atleast>3</atleast> |
every line of that many alike, across, down or slanting (<straight />: no slants) |
its commands run once for all; asked again until nothing is taken (chains) |
<alike variable="hue" /> the same value of that variable.<fall /> drops every loose piece down its column; <fall class="pill" /> only that class, the rest holding things up.<push>: set a variable and let a condition answer.A cell map may hold nothing: <map name="next"> with its tile, position, <columns>4</columns><rows>2</rows><cells />.
<spawn object="pieces" into="next"><random /></spawn> makes a piece there.<send object="pieces" from="next" into="board"><column>4</column><row>1</row></send> moves it (refused if there is none or no room).