Backends

From OHRRPGCE-Wiki
(Redirected from Backend)
Jump to navigation Jump to search

A backend is part of the engine that handles some low-level task like displaying graphics and can be swapped out for a replacement which achieves the same thing in a different way, usually by using a different library. The OHRRPGCE uses several different backends for graphics and music. Different builds of the engine are available with differing backends or other "compile-time" options. We provide a far greater range of backends nightly builds. For stable releases, the "win95" Windows builds and the 32-bit Mac builds use gfx_sdl + music_sdl instead of the default gfx_sdl2 + music_sdl2, but if you anything else you either need to compile it yourself, or use a nightly build.

The easiest way to see which backends you are using is to run Game or Custom. At the bottom of the initial screen you'll see a line like "OHRRPGCE wip 20160610 directx/sdl" meaning gfx_directx and music_sdl. You can also examine c/g_debug.txt for lines starting with gfx_### or music_### (don't be fooled by the version info line, which lists all backends compiled in).

You can switch gfx backend by pressing Ctrl-F8 (also available from the F8 in-game debug menu, or the F9 in-editor global settings menu). You can't switch music backend; instead you need to download a different build of the engine.

gfx[edit]

gfx backends provide the graphics and user-input (keyboard, mouse, joystick/gamepads) and often other OS-specific code (especially Android functionality such as the onscreen keyboard, in gfx_sdl). The OHRRPGCE can be compiled with any combination of graphics backends, and the one to use selected with the --gfx commandline switch (run with commandline option "/?" or "--help" for usage information), or swapped at runtime by pressing Ctrl-F8. The default backend is gfx_sdl2 whenever it is available, and gfx_sdl on Android, 32-bit Mac, and Windows 9X. Official OHRRPGCE builds also include as fallbacks, when possible for th current platform, gfx_fb (Linux and Windows) and gfx_directx (Windows). gfx_alleg and gfx_console are not included by default. gfx_sdl and gfx_sdl2 can't both be compiled into one build.

name status description smoothing platforms resolutions other than 320x200
gfx_sdl stable Simple DirectMedia Layer (SDL) 1.2 graphics. This is the default backend on Android, 32-bit Mac, and in "win95" builds (for Windows 2000 and earlier; SDL2 requires Win XP) Yes GNU/Linux, BSD, Mac, Windows, Android Yes
gfx_sdl2 stable Simple DirectMedia Layer (SDL) 2 graphics. This is the default backend on Windows, GNU/Linux, Mac and Web (HTML5). The only backend that fully supports gamepads. Much better fullscreen handling than gfx_sdl or gfx_fb. Yes GNU/Linux, BSD, Mac, Windows, Web, Blackbox Yes
gfx_directx stable but out of date This backend exists as gfx_directx.dll - all Windows builds normally include support for it even if the .dll isn't included. Still 320x200 only, so this doesn't support many games. This has better joystick and fullscreen support than gfx_sdl, but doesn't support gamepad button mappings Yes (texture scaling) Windows No
gfx_fb stable Based on Freebasic's standard graphics library. This backend is fairly well-tested and used to be the default, but has a few minor unsolvable problems Yes GNU/Linux, BSD, Windows Yes
gfx_alleg working?, but very little testing
Linux: keyboard input broken
Allegro backend. Not currently compiled for nightly builds (due to a problem with the build machine) No (Mac?, Linux?), Windows No
gfx_console diagnostic Curses-based backend (displays text only, no graphics). Or run with --nogfx to run without curses. For testing only; no builds available. NA All Yes... kinda

music[edit]

music backends provide the music and sound effects. Unlike the graphics backend, each build of the engine only supports a single music backend and it isn't possible to switch to a different backend without recompiling. Some Windows nightly build .zip files have the name of the music backend in the download name, eg ohrrpgce-win-wip-music_native.zip, while ohrrpgce-win-wip-win95.zip is gfx_sdl and music_sdl. All other builds for all platforms, including Windows installers and stable releases use the default, music_sdl.

gfx_sdl can't be combined with music_sdl2, and gfx_sdl2 can't be combined with music_sdl.

Both music_sdl and music_sdl2 are compiled from music_sdl.bas, with different preprocessor directives. Both music_native and music_native2 are linked to music_audiere.bas.

name status description advanced MIDI looping
music_native Windows:only plays MIDI (MIDI playback very buggy)
Linux:No MIDI support
Audiere and Native windows MIDI. MIDI playback is very buggy. Usually does not work on Linux because Audiere uses OSS. Since some years ago, Audiere has also mysteriously stopped playing anything on Windows. Windows:Yes
Linux:No
music_sdl stable SDL 1.2+SDL_mixer backend. Used in gfx_sdl builds. Various bugs. MIDI playback on Windows sometimes crashes. Variable-bitrates and unusual sample rates are broken. MP3 files with unusual sample rates also cause crashes on Linux machines with old versions of SDL_mixer. Converting .mp3s to .oggs avoids some of these problems. No
music_sdl2 stable SDL 2+SDL2_mixer backend. This must be used instead of music_sdl when compiling with gfx_sdl2. SDL2_mixer and music_sdl2 are almost identical to SDL_mixer and music_sdl, except SDL2_mixer is far less buggy and uses better libraries for .mp3 and module playback (we supply SDL_mixer builds which use better libraries than the defaults anyway) No
music_allegro obsolete Allegro backend. Unmaintained; no longer works or even compiles. Only worked together with gfx_alleg No
music_native2 only plays MIDI (MIDI playback buggy) (Windows-only) music_native variant with alternative, "better" (but still pretty buggy) MIDI implementation. Identical Audiere sound effects implementation. Since some years ago, Audiere has also mysteriously stopped playing anything on Windows. Controller 111 loop points only
music_silence diagnostic Does not play any music or sound at all. Useful for checking whether or not a bug is related to music. No
music_blackbox special port This is a simple interface to the audio API for the 'Blackbox' console port. You can't compile this. No

Other builds[edit]

These aren't backends but rather are other compile-time options.

name status description
-debug diagnostic Any nightly build with -debug in the filename has been compiled with -g which adds debugging symbols for use with the GNU Debugger, and with -exx which adds extra error checking (asserts) for out-of-bounds array access and null pointer dereferencing. Failed asserts cause the program to show a fatal error screen. These builds are slower, something which might be noticeable on old computers.

See Also[edit]