Silverspark API: High Level Design - Volts-of-Doom/voltsofdoom GitHub Wiki

Silverspark consumes a texture atlas (ITextureAtlas) which is created by an external implementation (in this case, Volts of Doom's atlas implementation and TextureManager). The texture manager's job is to read textures from the file system and build a definitive atlas.

VOD's game loop takes in an initial state from configuration (Adventure), and runs at a fixed rate (configurable, but typically c. 20 ticks per second). It passes renderable information to Silverspark on each iteration. Silverspark takes this information and uses the texture atlas to display it to the screen..

VOD passes a list of renderable items, their locations and their velocities to Silverspark, which will look up each texture using the texture atlas. Silverspark runs its own logic loop at a higher cadence (e.g. 100 or more ticks per second). It uses this loop to interpolate the position of each entity (possibly using compute-shaders), and on every iteration will pass the interpolated position and entity to its render loop, which is rate-unlimited (i.e. limited only by GPU capacity). VOD will pass information on renderables within the current display area, plus a surrounding buffer (e.g. 25%).

Silverspark API contains:

  • Name of renderable (for look-up in texture atlas): String
  • Current x, y co-ordinates (in Game Units) of each renderable: Float x2
  • Velocity (in Game Units per tick on each axis) of each renderable: Vector2f x2
  • Width and height of viewport (in Game Units)

Silverspark will also receive user input. When Silverspark is created, the user provides call-backs to handle the event. When Silverspark's own call-backs to GLFW are called on, they simply call on the super-application's call-backs to Silverspark.