Bablo ResourcesDocs

Lights

The Light tool places lights that are saved with your map: street lamps, warm light in a window, a flickering fire, a blinking warning light or a spotlight on a sign. Lights are not props. Every player’s game draws them itself, every frame, wherever a map with lights is enabled. That is why they come with their own limits, see Limits and performance.

Pick Light in the top bar. The panel header shows how many lights your working map has out of Config.Lights.maxPerMap, for example 12 / 320. Esc goes back to the Select tool.


Placing a light

Left-click where the light should go. It is placed on the surface under the cursor, lifted Config.Lights.dropLift (1 metre) off it, and saved on your working map right away. When the cursor points at nothing, the light lands on the ground along your aim, or Config.Pointer.missDistance (20 metres) ahead of the camera.

A new light takes the values in the panel and is selected. While no light is selected, the panel shows The values here go to every new light you place, until you pick a light to edit. When you pick a light, its values become the values for the next new light as well.

The first lights use Config.Lights.defaults: a warm white point light with intensity 3 and a range of 10 metres, without shadows or effect.


Night preview

Placed lights barely show in daylight. When you open the Light tool while the in-game hour is between Config.Lights.dayStartHour (6) and dayEndHour (19), your clock is set to autoNightTime (00:30) and stops there: The clock is now set to night. Placed lights barely show up in daylight. Your normal time comes back once you close the editor.

  • Only your own game changes. Other players keep the server time.
  • The night stays until you close the editor, also when you switch to another tool.
  • When qb-weathersync or qbx_weathersync is started, the editor sends qb-weathersync:client:DisableSync to pause the time sync, and qb-weathersync:client:EnableSync when the editor closes.
  • Config.Lights.autoNight = false turns the night preview off.

Selecting and moving lights

Every light has a handle: a small orb in the light’s own colour. The handles show in every tool while the editor is open, up to Config.Lights.markerDistance (100 metres) away and at most markerMax (80) at once. Lights that are off are drawn faint.

  • Click a handle to select the light. With the Select tool, clicking a handle opens the Light tool with that light selected.
  • The selected light gets a larger handle and a circle that shows its range. A spot light also shows a line along its beam and a ring at the end of it.
  • Move the selected light with the move arrows of the gizmo, and turn it with the rotate rings (Move and Rotate in the top bar, or G). Turning only matters for spot lights: a new spot light points level, to the north, until you turn it.
  • X deselects the light.

Mouse wheel

With a light selected and the cursor over the world:

InputChanges
Mouse wheelRange, times or divided by 1.1 per notch (Config.Lights.tuning.wheelRangeFactor).
Shift + mouse wheelIntensity, 0.25 per notch (wheelIntensityStep).

Light settings

The panel changes the selected light, or the values for new lights when no light is selected. Changes are saved a moment after you make them. Every value stays inside Config.Lights.limits: the panel, the mouse wheel and the server all keep to them.

SettingWhat it doesDefaultRange
TypePoint glows all around. Spot shines one way.Point
ColourThe colour of the light, see below.warm white, 255, 212, 1700 to 255 per channel
RangeHow far the light reaches, in metres.100.5 to 250
IntensityHow bright the light is.30 to 25
Drop-offHow quickly a spot beam fades towards its reach. Greyed out for point lights: Drop-off only applies to spot lights20 to 25
Cast shadowsThe light casts shadows, see Limits and performance.off
EnabledOff: the light is not drawn, but stays in the map.on
NameOnly shown for a selected light. Up to 64 characters; an empty field shows Unnamed light. Press Enter or leave the field to save it.

Colour

Pick one of the seven colour temperature swatches, type a colour as #RRGGBB in the field next to the colour square and press Enter, or use the three sliders for red, green and blue. Hover a swatch to see its name:

SwatchTemperatureColour (r, g, b)
Candle flame1850 K255, 129, 0
Sodium street lamp2200 K255, 146, 39
Tungsten bulb2700 K255, 167, 87
Halogen3600 K255, 195, 146
Noon sun5000 K255, 228, 206
Overcast sky6500 K255, 254, 250
Clear blue sky10000 K202, 218, 255

Spot lights

These show up when Type is Spot:

SettingWhat it doesDefaultRange
Beam angle (from centre)How wide the beam opens, in degrees from its centre line.400.5 to 89.5
Hot spot (from centre)A brighter part in the middle of the beam, in degrees from the centre line. It is never wider than the beam.150 to 89
Rim sharpness0 gives a soft edge to the beam, 1 a crisp one.0.250 to 1

The hot spot is Config.Lights.tuning.hotSpotBoost (75%) brighter than the rest of the beam. The total amount of light stays the same.

Effects

EffectWhat the light does
SteadyStays at full brightness. This is the default.
GlowFades smoothly down and back up.
BlinkFull brightness for half a cycle, dimmed for the other half.
SputterJumps between random brightness levels, sputterRate (10) times per second at tempo 1.
EmberDrifts smoothly between random brightness levels.

For every effect but Steady, two more sliders show up:

  • Tempo: cycles per second. 1 is one glow or blink per second, from 0.02 to 24. Glow, Blink and Ember never run faster than fastestCycle (8 cycles per second), and Sputter never jumps more than twice as often.
  • Dimming: how much of the brightness the effect takes away at its lowest point, from 0 to 1 (default 0.5). At 0 the effect can’t be seen.

Every light starts at its own point of the cycle, so lights with the same effect don’t all pulse together. The effects follow the shared network clock, so all players see a light dim and brighten at the same moment.


The light menu

Right-click a light handle. The top of the menu shows the light’s name, or its number such as #12.

ItemWhat it does
Copy next to itPlaces a copy 1 metre along the X axis and 1 metre along the Y axis from it, and selects the copy. The copy has the same settings, but no name, and it is not turned: turn a copied spot light again.
Disable light / Enable lightSwitches the light off or on.
Remove this lightRemoves the light.

You can also remove the selected light with Delete or Remove selected light in the panel. Alt + click on any handle removes that light at once.


Placed lights

Below the settings, Placed lights lists the lights of your working map. A light without a name is listed with its type and number, for example Spot #12. The list shows up to 60 lights; with more, it says showing 60 of 75.

ButtonWhat it does
GoFlies the camera to 3 metres above the light and selects it: Loading the area…
DeleteRemoves that light.
Clear allRemoves every light of your working map.

Clear all has no confirmation. One undo brings all the lights back.


Limits and performance

Lights are not entities. Every player’s game draws the lights near its camera every frame, so lights cost a little performance for everybody, and the settings below keep that in check.

LimitDefaultWhat happens
maxPerMap320Most lights one map holds: This map has reached its light limit
maxTotal3000Most lights across all maps: The server has reached its light limit
drawDistance120 mA light is drawn up to this far from the camera, or as far as its own Range when that is larger. It fades out over the last tuning.fadeDistance (8 metres).
shadowDistance45 mShadows are only cast this close to the camera, and fade out before that.
maxShadows8Most lights that cast shadows at once, nearest first. The game has 8 slots, so this can’t go higher. When a shadow moves to another light, it fades over tuning.shadowFadeMs (250 ms).
tuning.drawBudget256Budget for the extra draw calls per frame that spot lights (one to three calls each) and fading shadows need. The nearest lights get them first. Once it is used up, every further light is still drawn, with one simpler call.
idleWait500 msHow often the game looks for lights again while none is in range.

All of them are in Config.Lights and Light tuning.


Lights for players

  • Lights are saved in the bablo_mapeditor_lights table and belong to the map they were placed on. Players see the lights of every enabled map. Switch a map off and its lights go out for players.
  • Light handles, the range circle and the beam line only show for editors while the editor is open.
  • A map published as its own resource draws its lights the same way, without the editor. It takes only the lights that are on, together with the Config.Lights values at the moment you publish: publish again after changing them. The JSON export keeps the lights too. The other export formats leave them out: Lights are not part of this format and will be dropped. See Import, Export & Publish.

Undo

Placing, copying, moving, changing, switching and removing a light are each one step in the undo history, and so is Clear all. See Undo & Redo.


Settings

LUA
Config.Lights = {
    maxPerMap = 320, -- lights a single map may hold
    maxTotal = 3000, -- lights across every map
    drawDistance = 120.0, -- a light stops drawing past this distance from the camera (m); a light whose own range reaches the camera stays lit
    shadowDistance = 45.0, -- shadow casting stops earlier than the light itself (m)
    maxShadows = 8, -- shadowed lights drawn at once, nearest first (the engine has 8 slots)
    idleWait = 500, -- how often the renderer looks for lights again while none is in range (ms)
    dropLift = 1.0, -- height (m) a new light is lifted off whatever you click on
    autoNight = true, -- entering the light tool in daylight flips the clock to night so lights read
    autoNightTime = { 0, 30 }, -- the clock (hour, minute) it switches to
    dayStartHour = 6, -- daylight window that triggers the flip (hours, inclusive start)
    dayEndHour = 19, -- ... exclusive end
    marker = { 168, 200, 255 }, -- editor chrome colour for an unselected light
    markerDistance = 100.0, -- how far the editor draws light handles (m)
    markerMax = 80, -- most light handles drawn at once
    markerSize = 0.18, -- handle radius (m)
    markerAlpha = 140, -- orb opacity; the wire rings on top stay solid
    -- ...
}
SettingWhat it does
maxPerMap, maxTotalLight limits per map and across all maps.
drawDistance, shadowDistance, maxShadows, idleWaitSee Limits and performance.
dropLiftHow high a new light is placed above the point you click.
autoNight, autoNightTime, dayStartHour, dayEndHourThe night preview.
markerColour of the rings around a handle that is not selected. The selected one uses Config.Selection.colorSelected.
markerDistance, markerMax, markerSize, markerAlphaHow far handles are drawn, how many at once, their size and the opacity of the orb.

The rest of Config.Lights is explained on the configuration page:

  • Light defaults: the values of new lights, and of saved lights that miss a value.
  • Light limits: the allowed range of every value.
  • Light tuning: how lights are drawn and how the mouse wheel changes them.