conf—game configuration

This is a settings.DummySettingsManager instance used for configuration. Changes to many of these settings should occur before the engine is initialised to take effect.

GAME = None

The current game.Game instance.

IDENT = 'game'

Game identifier, used in some filenames.

DEBUG = False

Just a debug flag to establish convention; doesn’t get used by anything in the engine.

Timing

FPS

Frames per second to aim for, as a { World.id : fps} defaultdict, with default value 60.

DROP_FRAMES = True

Whether to allow dropping frames if the game cannot run at full speed. This only affects the draw rate, not the world update rate.

MIN_FPS

If DROP_FRAMES is True, this gives the minimum frames per second allowed, as a { World.id : fps} defaultdict, with default value 25. (That is, frames are not dropped if the real draw rate would fall below this number.)

FPS_AVERAGE_RATIO = .3

This determines how frames are averaged to handle slowdown and determine the framerate. It’s a rolling average, so that each frame, we do:

average = (1 - FPS_AVERAGE_RATIO) * average + FPS_AVERAGE_RATIO * frame_time

Paths

CONF

File in which settings to be saved are stored. Defaults to ~/.config/<IDENT>/conf or %APPDATA\<IDENT>\conf.

EVT_DIR = 'evt/'

Directory to load event configuration files from.

IMG_DIR = 'img/'

Directory to load images from.

SOUND_DIR = 'sound/'

Directory to load sounds from.

MUSIC_DIR = 'music/'

Directory to load music from.

FONT_DIR = 'font/'

Directory to load fonts from.

Display

WINDOW_ICON = None

Path to image to use for the window icon.

WINDOW_TITLE = ''
MOUSE_VISIBLE

Whether the mouse is visible when inside the game window. This is a { World.id : visible} defaultdict, with default value False.

FLAGS = 0

Extra flags to pass to pygame.display.set_mode.

FULLSCREEN = False

Whether to start the window in fullscreen mode.

RESIZABLE = False

Whether the window can be freel resized (also determines whether fullscreen mode can be toggled).

RES_W = (960, 540)

Window resolution.

RES_F = None

Fullscreen resolution; if None, the first value in the return value of pygame.display.list_modes is used.

RES

Current game resolution, no matter the display mode. Only exists if the game has been run.

MIN_RES_W = (320, 180)

Minimum windowed resolution, if the window can be resized.

ASPECT_RATIO = None

Floating-point aspect ratio to fix the window at, if it can be resized.

Input

GRAB_EVENTS

Whether to grab all input events (in which case operating system and window manager shortcuts like alt-tab will not work). This is a { World.id : grab} defaultdict, with default value False.

GAME_EVENTS

An event configuration string loaded into each world’s event handler.

Audio

VOLUME_SCALING = 2

Used in default audio volume scaling (see World.scale_volume).

MUSIC

Automatically generated {dir: filenames} dict for files present in MUSIC_DIR and subdirectories (only one level deep). dir is the empty string for the root directory, and is always a name, not necessarily a path. filenames is a list of paths relative to the working directory at startup, and may be empty.

MUSIC_AUTOPLAY

If False, music is loaded, but initially paused. This is a { World.id : volume} defaultdict, with default value False.

MUSIC_VOLUME

{ World.id : volume} defaultdict, with default value 0.5

SOUNDS

Automatically generated {sound_id: num_sounds} dict for sounds present in SOUND_DIR. Finds sound files of the form <sound_id><number>.ogg for integer numbers starting from 0 with no gaps.

SOUND_VOLUME

{ World.id : volume} defaultdict, with default value 0.5.

SOUND_VOLUMES

{sound_id: volume} defaultdict, with default value 1, for sound_id in SOUNDS.

MAX_SOUNDS = {}

{sound_id: num} dict giving limits on the number of simultaneously playing instances of sounds, for sound_id in SOUNDS.

SOUND_ALIASES = {}

An {alias: sound_id} mapping for sound_id in SOUNDS to allow using alias as a sound base ID when playing a sound, with its own value in SOUND_VOLUMES, etc..

Resources

DEFAULT_RESOURCE_POOL = 'global'

Default ResourceManager resource pool name. Resources cached in this pool are never dropped while the game is still running.

TEXT_RENDERERS

text.TextRenderer definitions to make available in Game.text_renderers, as a { World.id : renderers} defaultdict with default value {}. renderers is {name: renderer}, where renderer is a TextRenderer, (font, options) as taken by TextRenderer, or just font.