less_retarded_wiki

main page, file list (578), source, all in md+txt+html+pdf, report abuse, stats, random article, consoomer version

SAF

SAF is a LRS C library for small, very portable games (and possibly other kinds pf programs); it can also be seen as a fantasy console. It was made by drummyfish. The repository is available e.g. at https://codeberg.org/drummyfish/SAF. MicroTD is an example of a LRS game made with SAF, but even more complex games such as Anarch have been ported to it.

The whole SAF library is implemented in a single header file (currently a bit under 5000 lines of code, which is mostly due to including all the boilerplate for all possible platforms it supports, the actual SAF logic is pretty small) and offers a simple API for programming games, i.e. functions for drawing pixels to the screen, playing sounds, reading buttons, computing the sine function etc., and it handles boring/annoying issues such as the game main loop. It also has built-in a number of frontends that allow compiling a correctly made SAF games to any supported platform among which are SDL, SFML, X11, ncurses (terminal), even open consoles such as Pokitto, Arduboy or Gamebuino META. There is an option to auto-convert a color game to black-and-white only displays. Some PC frontends add emulator-like features such as time manipulation, pixelart upscaling, TAS support and so on.

Games made with SAF run in 64x64 resolution, with 256 colors (332 palette) and 25 FPS. They can use 7 input buttons (arrows, A, B and C), play 4 different sound effects and use 32 bytes of persistent memory, e.g. for savegames or highscores. These relatively low specifications are set on purpose so as to help portability, reduce bloat, frustration and friction. Many times good, entertaining games can be very simple, as is the case e.g. with Tetris, chess, various shmups, roguelikes and so on -- these are the kinds of games SAF is ideal for.

      []  [][][][][]
      [][][]      [][]
      [][]          []
      []    XX    XX[]
      []      XXXX  []
      [][]          []
      [][][]      [][]
      []  [][][][][] 

SAF logo

 microTD
  ________________________________________________________________
 |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;|
 |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;|
 |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;|
 |;;;;;;;;;;;;;;;;;;;;;;;;' ';; ' ' ;;' ';;;;;;;;;;;;;;;;;;;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;;;;;;;;;|
 |                  ,, ,  ,,,   ,,,          ,,                   |
 |                  ;'';  ;,;   ;,;           ;                   |
 |                  '  '  ' '   '            '''                  |
 |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;|
 |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;|
 |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;|
 |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;|
 |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;|
 |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;|
 |;';;;;;;'';;;;;;;;;;';;;;;;;;;;;;;;;;''';;;;;;;;;;;;;;;;;;;;;;;;|
 |; ,';;; ',,;;; ,;;;, ,;;;;,;;;;;;;;;;,, ;;;;;;;;;;;;;;;;;;;;;;;;|
 |;,,;;;;;,,;;;,,;;;;;,,;;;;,;;;;;;;;;;,,,;;;;;;;;;;;;;;;;;;;;;;;;|
  ----------------------------------------------------------------

screenshot of a SAF game (uTD) running in terminal with ncurses

See Also


Powered by nothing. All content available under CC0 1.0 (public domain). Send comments and corrections to drummyfish at disroot dot org.