lovr.conf
EditThe lovr.conf callback lets you configure default settings for LÖVR. It is called once right before the game starts.
function lovr.conf(t)
-- your code here
endArguments
| 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. |
| .debug | boolean | Enables extra log messages from the audio engine. |
| .samplerate | number | The sample rate to use for audio playback. |
| .start | boolean | Whether the default playback device should start automatically when a source is first played. |
| .reverb | table | Reverb settings. |
| .type | ReverbType | Which type of reverb to use. |
| .rays | number | The number of rays used to simulate reverb. More rays will make the reverb more realistic, but increase CPU usage. |
| .bounces | number | The number of times each ray can bounce during reverb simulation. More bounces will make the reverb more realistic, but increase CPU usage. |
| .duration | number | The max reverb duration, in seconds. Longer reverb times increase CPU cost, but may be necessary for large, echoey spaces. |
| .rate | number | How often reverb is simulated, in seconds. Shorter rates will make the reverb more responsive, but increase CPU usage. |
| .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. |
| .hdr | boolean |
Whether the (super experimental) HDR mode should be enabled. See lovr.graphics.isHDR.
|
| .shadercache | boolean | Whether the shader cache should be loaded and saved to disk. |
| .headset | table | Configuration for the headset. |
| .connect | boolean | Whether LÖVR should try to connect to VR hardware at startup. |
| .start | boolean | Whether a VR session should begin at startup. |
| .supersample | number | 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". |
| .seated | boolean | Whether seated mode should be used instead of standing, changing the headset coordinate space to place y=0 at eye level. |
| .mask | boolean | Enable or disable the headset mask. This is an optimization that skips rendering pixels on the edges of the headset texture that can't be seen while in the headset due to lens distortion. When enabled, at the beginning of the frame, the edges of the headset texture will be filled in with black (and depth = 1). |
| .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. 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.
|
| .math | table | Configuration for the math module. |
| .globals | boolean | Whether vector object functions should be added to the global scope. |
| .thread | table | Configuration for the thread module. |
| .workers | number | The number of worker threads to spawn. Can be negative, which will be added to the number of cores in the system. |
| .window | table | Configuration for the window. |
| .width | number | The width of the window. |
| .height | number | The height of the window. |
| .centered | boolean | Whether the window is centered. |
| .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. 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.19.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.debug = false
t.audio.samplerate = 48000
t.audio.start = true
t.audio.reverb.type = 'convolution'
t.audio.reverb.rays = 4096
t.audio.reverb.bounces = 4
t.audio.reverb.duration = 2
t.audio.reverb.rate = .1
-- 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.connect = true
t.headset.start = true
t.headset.supersample = false
t.headset.seated = false
t.headset.mask = true
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.centered = true
t.window.fullscreen = false
t.window.resizable = false
t.window.title = 'LÖVR'
t.window.icon = nil
end