taisei/ENVIRON.md
2017-10-01 07:50:51 +03:00

7.6 KiB

Taisei environment variables

Introduction

Some of Taisei's more advanced configuration options are delegated to environment variables. This document attempts to describe them all.

Generally you don't need to set any of them. They are intended for developers and advanced users only. Therefore, familiarity with the concept is assumed.

In addition to the variables listed here, those processed by our runtime dependencies (such as SDL) also take effect, unless stated otherwise.

Variables

Virtual filesystem

  • TAISEI_RES_PATH (default: unset): if set, overrides the default resource directory path. This is where Taisei looks for game data. The default path is platform- and build-specific:

    • On macOS, it will be the Contents/Resources/data directory inside of the Taisei.app bundle.
    • On Linux, *BSD, and most other Unix-like systems (without -DRELATIVE), it will be $prefix/share/taisei. This path is static and determined at compile time.
    • On Windows and other platforms when built with -DRELATIVE, it will be the data directory relative to the executable (or to whatever SDL_GetBasePath returns on the given platform).
  • TAISEI_STORAGE_PATH (default: unset): if set, overrides the default storage directory path. This is where Taisei saves your configuration, progress, screenshots and replays. Taisei also loads custom data from the resources subdirectory in there, if any, in addition to the stock assets. The custom resources shadow the default ones if the names clash. The default path is platform specific, and is equivalent to the return value of SDL_GetPrefPath("", "taisei"):

    • On Windows, it's %APPDATA%\taisei.
    • On macOS, it's $HOME/Library/Application Support/taisei.
    • On Linux, *BSD, and most other Unix-like systems, it's $XDG_DATA_HOME/taisei or $HOME/.local/share/taisei.

Resources

  • TAISEI_NOASYNC (default: 0): if 1, disables asynchronous loading. Increases loading times, might slightly reduce CPU and memory usage during loads. Generally not recommended unless you encounter a race condition bug, in which case you should report it.

  • TAISEI_NOUNLOAD (default: 0): if 1, loaded resources are never unloaded. Increases memory usage, reduces filesystem reads and loading times over time.

  • TAISEI_NOPRELOAD (default: 0): if 1, disables preloading. All resources are only loaded as they are needed. Reduces loading times and memory usage, but may cause stuttering during gameplay.

  • TAISEI_PRELOAD_REQUIRED (default: 0): if 1, the game will crash with an error message when it attempts to use a resource that hasn't been previously preloaded. Useful for developers to debug missing preloads. Doesn't affect optional resources.

Video and OpenGL

  • TAISEI_VIDEO_DRIVER (default: unset): The video backend for SDL to use. If this is not specified, Taisei will try to use the first driver that SDL supports, ignoring x11 and dummy drivers. If that fails, fall back to the default driver as seen by SDL (this step will either load the x11 driver, or not work at all). This is done to improve support for newer display systems like Wayland, where an X11 compatibility layer may be present. If SDL was compiled with x11 support, it will generally try to use it first by default. If that succeeds on such a system, Taisei will be running in X11 compatibility mode, even though it could use the native protocol. This level of indirection degrades performance and introduces display artifacts at least on some systems. The standard SDL_VIDEODRIVER variable has no effect, unless TAISEI_VIDEO_DRIVER is set to sdldefault, or the default algorithm falls back to letting SDL pick the driver.

  • TAISEI_LIBGL (default: unset): OpenGL library to load instead of the default. The value has a platform-specific meaning (it's passed to the equivalent of dlopen). Takes precedence over SDL_OPENGL_LIBRARY if set. Has no effect if Taisei is linked to libgl (which is not recommended, because it's not portable).

  • TAISEI_GL_EXT_OVERRIDES (default: unset): Space-separated list of OpenGL extensions that are assumed to be supported, even if the driver says they aren't. Prefix an extension with - to invert this behaviour. Might be used to work around bugs in some weird/ancient/broken drivers, but your chances are slim. Also note that Taisei assumes many extensions to be available on any sane OpenGL 2.1+ implementation and doesn't test for them, so you can't disable code that uses those this way.

Logging

Taisei's logging system currently has four basic levels and works by dispatching messages to a few output handlers. Each handler has a level filter, which is configured by a separate environment variable. All of those variables work the same way: their value looks like an IRC mode string, and represents a modification of the handler's default settings. If this doesn't make sense, take a look at the Examples section.

The levels

  • Debug (d) is the most verbose level. It contains random information about internal workings of the game and is disabled for release builds at source level.
  • Info (i) logs some events that are expected to occur during normal operation, for example when a spell is unlocked or a screenshot is taken.
  • Warning (w) alerts of non-critical errors, for example a missing optional resource, corrupted progress data, or failure to save a replay due to insufficient storage space or privileges.
  • Fatal Error (e) is an irrecoverable failure condition. Such an event most likely signifies a programming error or a broken installation. The game will immediately crash after writing a message with this log level. On some platforms, it will also display a graphical message box.
  • All (a): this is not a real log level, but a shortcut directive representing all possible log levels. See Examples for usage.

The variables

  • TAISEI_LOGLVLS_CONSOLE: controls what goes to the console, both stdout and stderr. Defaults to All (+a). This is a master switch for the two variables below:

    • TAISEI_LOGLVLS_STDOUT: controls what goes to standard output. Defaults to Debug and Info (+di).
    • TAISEI_LOGLVLS_STDERR: controls what goes to standard error. Defaults to Warning and Fatal Error (+we).
  • TAISEI_LOGLVLS_FILE: controls what goes into the log file ({storage directory}/log.txt). Defaults to All (+a).

  • TAISEI_LOGLVLS_BACKTRACE: affects all outputs and controls which log levels produce a call stack trace upon printing a message. Only supported in Debug builds with glibc. Defaults to Fatal Error (+e).

Examples

  • In release builds: print Info messages to stdout, in addition to Warnings and Fatal Errors as per default:

    TAISEI_LOGLVLS_STDOUT=+i
    
  • In Debug builds: remove Debug and Info output from the console:

    TAISEI_LOGLVLS_STDOUT=-di
    

    OR:

    TAISEI_LOGLVLS_CONSOLE=-di
    
  • Don't save anything to the log file:

    TAISEI_LOGLVLS_FILE=-a
    
  • Don't print anything to the console:

    TAISEI_LOGLVLS_CONSOLE=-a
    
  • Don't save anything to the log file, except for Warnings:

    TAISEI_LOGLVLS_FILE=-a+w
    
  • Print everything except Debug to stderr, nothing to stdout:

    TAISEI_LOGLVLS_STDOUT=-a
    TAISEI_LOGLVLS_STDERR=+a-d
    
  • In Debug builds: produce a stack trace for every Warning message, in addition to Fatal Errors as per default:

    TAISEI_LOGLVLS_BACKTRACE=+w