lovr.conf

Edit

The lovr.conf callback lets you configure default settings for LÖVR. It is called once right before the game starts. Make sure you put lovr.conf in a file called conf.lua, a special file that's loaded before the rest of the framework initializes.

function lovr.conf(t)
  -- your code here
end

Arguments

NameTypeDescription
ttable The table to edit the configuration settings on.
.versionstring The version of LÖVR this project targets (not used yet).
.identitystring A unique label for this project.
.saveprecedenceboolean Whether the files in the save directory should have precedence over files in the source archive.
.modulestable The set of enabled modules to use.
.audioboolean Whether the audio module should be enabled.
.databoolean Whether the data module should be enabled.
.eventboolean Whether the event module should be enabled.
.graphicsboolean Whether the graphics module should be enabled.
.headsetboolean Whether the headset module should be enabled.
.mathboolean Whether the math module should be enabled.
.physicsboolean Whether the physics module should be enabled.
.systemboolean Whether the system module should be enabled.
.threadboolean Whether the thread module should be enabled.
.timerboolean Whether the timer module should be enabled.
.audiotable Configuration for the audio module.
.spatializerstring An audio spatializer to use (simple, oculus, or phonon). If nil, all of them are attempted.
.sampleratenumber The sample rate to use for audio playback.
.startboolean Whether the playback device should be automatically started.
.graphicstable Configuration for the graphics module.
.debugboolean Whether debug messages from the GPU should get sent to lovr.log.
.vsyncboolean Whether vsync is enabled (forced off when VR is active).
.stencilboolean Whether the desktop window should have a stencil buffer.
.antialiasboolean Whether the desktop window rendering should be antialiased.
.shadercacheboolean Whether the shader cache should be loaded and saved to disk.
.headsettable Configuration for the headset.
.driverstable An ordered list of preferred headset drivers.
.supersamplenumber A scaling factor to apply to the headset texture. Can be any positive floating point number, which gets multiplied by the default texture resolution. A value greater than 1 improves visual quality but reduces performance. Can also be a boolean, where "true" means "2.0".
.seatedboolean Whether seated mode should be used instead of standing, changing the headset coordinate space to place y=0 at eye level.
.antialiasboolean Whether headset rendering should be antialiased.
.stencilboolean Whether headset rendering should have a stencil buffer.
.submitdepthboolean Whether the depth buffer should be sent to the VR runtime (improves reprojection).
.overlayboolean Whether the project should run as an overlay. Can also be a number to control sort order against other overlays (default is zero, higher numbers go on top). Requires the overlay headset feature to be supported, see lovr.headset.getFeatures.
.mathtable Configuration for the math module.
.globalsboolean Whether vector object functions should be added to the global scope.
.threadtable Configuration for the thread module.
.workersnumber The number of worker threads to spawn. Can be negative, which will be added to the number of cores in the system.
.windowtable Configuration for the window.
.widthnumber The width of the window (or 0 to use the monitor width).
.heightnumber The height of the window (or 0 to use the monitor height) .
.fullscreenboolean Whether the window is fullscreen.
.resizableboolean Whether the window is resizable.
.titlestring The window title.
.iconstring The path to the window icon file.

Returns

Nothing

Notes

Disabling unused modules can improve startup time.

t.window can be set to nil to avoid creating the window. The window can later be opened manually using lovr.system.openWindow.

Enabling the t.graphics.debug flag will add additional error checks and will send messages from the GPU driver to the lovr.log callback. This will decrease performance but can help provide information on performance problems or other bugs. It will also cause lovr.graphics.newShader to embed debugging information in shaders which allows inspecting variables and stepping through shaders line-by-line in tools like RenderDoc.

t.graphics.debug can also be enabled using the --graphics-debug command line option.

Example

A noop conf.lua that sets all configuration settings to their defaults:

function lovr.conf(t)

  -- Set the project version and identity
  t.version = '0.18.0'
  t.identity = 'default'

  -- Set save directory precedence
  t.saveprecedence = true

  -- Enable or disable different modules
  t.modules.audio = true
  t.modules.data = true
  t.modules.event = true
  t.modules.graphics = true
  t.modules.headset = true
  t.modules.math = true
  t.modules.physics = true
  t.modules.system = true
  t.modules.thread = true
  t.modules.timer = true

  -- Audio
  t.audio.spatializer = nil
  t.audio.samplerate = 48000
  t.audio.start = true

  -- Graphics
  t.graphics.debug = false
  t.graphics.vsync = true
  t.graphics.stencil = false
  t.graphics.antialias = true
  t.graphics.shadercache = true

  -- Headset settings
  t.headset.drivers = { 'openxr', 'simulator' }
  t.headset.supersample = false
  t.headset.seated = false
  t.headset.antialias = true
  t.headset.stencil = false
  t.headset.submitdepth = true
  t.headset.overlay = false

  -- Math settings
  t.math.globals = true

  -- Thread settings
  t.thread.workers = -1

  -- Configure the desktop window
  t.window.width = 1080
  t.window.height = 600
  t.window.fullscreen = false
  t.window.resizable = false
  t.window.title = 'LÖVR'
  t.window.icon = nil
end

See also