lovr.conf

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. Improves visual quality but reduces performance. Can also be a boolean.
.offsetnumber The vertical offset for seated experiences.
.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.
.mathtable Configuration for the math module.
.globalsboolean Whether vector object functions should be added to the global scope.
.windowtable Configuration for the window.
.widthnumber The width of the window.
.heightnumber The height of the window.
.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.

The headset.offset field is a vertical offset applied to the scene for headsets that do not center their tracking origin on the floor. This can be thought of as a "default user height". Setting this offset makes it easier to design experiences that work in both seated and standing VR configurations.

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.16.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', 'desktop' }
  t.headset.supersample = false
  t.headset.offset = 1.7
  t.headset.antialias = true
  t.headset.submitdepth = true
  t.headset.overlay = false

  -- Math settings
  t.math.globals = true

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

See also