lovr.conf
EditThe 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
Name | Type | Description |
t | table | The table to edit the configuration settings on. |
.version | string | The version of LÖVR this project targets (not used yet). |
.identity | string | A unique label for this project. |
.saveprecedence | boolean | Whether the files in the save directory should have precedence over files in the source archive. |
.modules | table | The set of enabled modules to use. |
.audio | boolean | Whether the audio module should be enabled. |
.data | boolean | Whether the data module should be enabled. |
.event | boolean | Whether the event module should be enabled. |
.graphics | boolean | Whether the graphics module should be enabled. |
.headset | boolean | Whether the headset module should be enabled. |
.math | boolean | Whether the math module should be enabled. |
.physics | boolean | Whether the physics module should be enabled. |
.system | boolean | Whether the system module should be enabled. |
.thread | boolean | Whether the thread module should be enabled. |
.timer | boolean | Whether the timer module should be enabled. |
.audio | table | Configuration for the audio module. |
.spatializer | string |
An audio spatializer to use (simple , oculus , or phonon ). If nil , all of them are attempted.
|
.samplerate | number | The sample rate to use for audio playback. |
.start | boolean | Whether the playback device should be automatically started. |
.graphics | table | Configuration for the graphics module. |
.debug | boolean | Whether debug messages from the GPU should get sent to lovr.log. |
.vsync | boolean | Whether vsync is enabled (forced off when VR is active). |
.stencil | boolean | Whether the desktop window should have a stencil buffer. |
.antialias | boolean | Whether the desktop window rendering should be antialiased. |
.shadercache | boolean | Whether the shader cache should be loaded and saved to disk. |
.headset | table | Configuration for the headset. |
.drivers | table | An ordered list of preferred headset drivers. |
.supersample | number | A scaling factor to apply to the headset texture. Improves visual quality but reduces performance. Can also be a boolean. |
.offset | number | The vertical offset for seated experiences. |
.antialias | boolean | Whether headset rendering should be antialiased. |
.stencil | boolean | Whether headset rendering should have a stencil buffer. |
.submitdepth | boolean | Whether the depth buffer should be sent to the VR runtime (improves reprojection). |
.overlay | boolean | Whether the project should run as an overlay. |
.math | table | Configuration for the math module. |
.globals | boolean | Whether vector object functions should be added to the global scope. |
.window | table | Configuration for the window. |
.width | number | The width of the window. |
.height | number | The height of the window. |
.fullscreen | boolean | Whether the window is fullscreen. |
.resizable | boolean | Whether the window is resizable. |
.title | string | The window title. |
.icon | string | 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
lovr.load