a b s u r d _ s p a c e
thoughts about game engine minimalism
by Ben Porter
the machine
The absurd machine is an abstract video game machine with a minimal API:
a
(id) -> Play audiob
(id) -> Button states
(id, x, y) -> Draw spriteu
-> Update functionr
(id) -> Read memoryd
-> Draw function
The machine expects five data files:
s
-> spritesp
-> programa
-> audioc
-> confige
-> et cetera
The absurd host boots the machine using the config file, loads the sprites, audio and etcetera into memory, and then runs the program.
the API
a
: The audio data specifies chunks of audio, each with a string id. The a(id)
function should play the audio file, at a fixed volume, until it has ended.
b
: Absurd provides a fixed set of buttons for input and b(id)
will return true if a button with this id is down. The ids are setup as part of the config file.
s
: The only graphical element in absurd is the sprite. The sprites data contains all the sprites, each associated with a string id. The host should blit a sprite to the screen with s(id, x, y)
. To render text or other elements, sprites or combinations of sprites should be used.
u
: The host calls the update function at a fixed framerate. Any initial setup of the program can be done the first time the u
function is called.
r
: The data stored in etcetera can be read with the r(id)
function. Each element of data is associated with a string id. Additional game data can be stored in etcetera.
d
: Absurd displays a fixed resolution screen (specified in the c
file) which is then cleared every draw frame. The host calls the d
function at a fixed framerate.
homework
Implement absurd.