An engine for describing games built around Xerces, exprtk, and SFML.
Status: a small set implemented (Frogger added five); the rest is a plan
A verb is a named behavior with parameters. A good declarative verb captures the behavior space of a concept rather than an implementation. With a well-defined vocabulary the author expects to describe the 2D non-scrolling games of the late 70s and early 80s “pretty easily”, and, with verbs like jump, the scrolling ones too.
the command tags <bounce />, <stick />, <die />, <reset />, <inc />, <dec />, <wrap />, <carry />, <move direction=...>, <hop direction=...>, <push />, <pop />, <trigger />, <fire />, <accelerate direction= burn=>, <stop />; sprites <circle>, <rectangle>, <text>, <image>, <line>, <grid>; an object’s <acceleration>; a collision <type> and the rule filters slower and faster; a collision rule filter, unless; the value tag <random>; and the condition forms atleast, atmost and remaining. See docs/readme.md for exact meanings.
Rough coverage by game: Pong is essentially bounce() and stick(); Breakout adds die(); Space Invaders adds fire() and formation movement through lockstep bounce; Frogger adds hop, carry, wrap, dec, unless and atmost (see 21 for why each is shaped the way it is). Space Race added no verbs: it is move, stick, inc, reset, wrap and a score condition. Kaboom added none either: move, stick, bounce, inc, dec, reset, <random>, a state per wave and variable conditions, one of which does a reset object= for the explosion (30). Freeway, Depth Charge and Astrosmash added none: Freeway is Frogger’s road (hop, wrap, reset, inc), Depth Charge is fire pointed down with a dec on the floor rule and a remaining win, and Astrosmash is Kaboom’s falling pieces plus fire (31, 32, 33). Lunar Lander added the most since Frogger: <line>, <type>pixel</type>, <acceleration>, <accelerate> with burn, <stop />, <slower> and <faster>, each because gravity, a thrust that runs out, and a landing that is good or bad by speed could not be said without it (34).
The rule of thumb held: each of those was added because Frogger could not be described without it, and each names a behavior rather than an implementation (carry says an object rides another, not how its position is updated).
Two types.
| Type | Behavior | Parameters (at minimum) | Model |
|---|---|---|---|
| Static | Pressing jump stops walking; the character follows a predefined arc and fully lands before control returns | height, width (length), time | Castlevania |
| Dynamic | Height depends on how long the button is held; run speed extends the jump; direction can be changed in the air | maximum hold time, maximum height, upward acceleration, whether the player can slow or stall in the air, whether the player can move backwards in the air | Super Mario Bros. |
hop is the tile-step cousin of the static jump, not an arc: one instant step per key press, with no height, width or time. It is what a grid game needs (Frogger, and later Pac-Man-style turns), and an arcing jump would be a separate verb that shares the one-shot key handling.
Notes: in Super Mario Bros. you can jump up and back onto a ledge directly above by moving backwards mid-jump; in Mega Man you can slow or stall but not reverse. Whether backwards movement is allowed is therefore a parameter.
Classic maze-game AI looks complex but decomposes into a few strategies with parameters. The Pac-Man ghosts, described verbally:
Sketch in the same declarative style:
<ai targeting="direct" />
<ai targeting="ahead" lookahead="4" />
<ai targeting="flank" reference="blinky" />
<ai targeting="proximity_flee" threshold="8" fallback="corner" />
Pathfinding is the engine’s job, not the XML’s. Other likely targeting modes: direct, predictive, flanking, random, territorial. A survey of more maze games is expected to reveal the basic set.
<random min="-7" max="7" /> can give a near-zero velocity; the workaround so far is to reload. A declarative fix: a random magnitude with a random sign (a random from 3 to 7 times a sign), for example a <sign> value tag, avoiding an if.