Epic Quest Land  Module Overview

EQL can conceptually be broken into a number of intermingled "modules":

Independent modules:

  • config.hpp contains a few definitions that are needed basically everywhere, including types for positions and time, and the debugging constant (if compiled to a debug build)
  • math.hpp contains some useful math definitions.

Main modules:

  • log contains code related to logging messages. Nearly every other module depends on this one, as they all do some logging, if only in their initialization.
  • images handles loading/saving PNG images with their palettes. SFML automatically converts paletted images to RGBA; these functions preserve the palette for later use.
  • resources manages all the resources needed for the game: images, sfx, music, etc.
  • time manages the passage of time, keeping track of elapsed time and frame counts.
  • screen manages the virtual screen, adjusting its size as the window size changes.
  • mode manages modes: each distinct way of interpreting keyboard/mouse input and drawing to the screen is a "mode". E.g., the main menu is a mode, as distinct from the game itself, or the inventory screen, etc. Modes are kept on a stack, so we can "switch" modes by pushing a new mode (the top mode is always the current mode), and then switch back to whatever mode we left by popping it off.
  • entity manages in-game entities. An entity is anything that has a position/velocity/acceleration and can be drawn. Access to these is through virtual methods. The class entity provides a standard semi-implicit Euler solver for P/V/A.
  • player manages the different kinds of player classes (i.e., "classes" in the in-game sense). Players are entities which respond to input.

Most modules have an init_MODULENAME function in the eql namespace that does whatever initialization they need. These are mostly dependency-free, except that any program should call init_logging() first to make sure the logging system is properly set up (but the logger is designed so that it will still work, logging to stdout, if you forget).