Skip to content

Instantly share code, notes, and snippets.

@eigenbom
Created February 2, 2025 04:01
Show Gist options
  • Save eigenbom/7d402c470944f3714782153c4b3ae6fd to your computer and use it in GitHub Desktop.
Save eigenbom/7d402c470944f3714782153c4b3ae6fd to your computer and use it in GitHub Desktop.

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 audio
  • b(id) -> Button state
  • s(id, x, y) -> Draw sprite
  • u -> Update function
  • r(id) -> Read memory
  • d -> Draw function

The machine expects five data files:

  • s -> sprites
  • p -> program
  • a -> audio
  • c -> config
  • e -> 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment