Bablo ResourcesDocs

Map Streaming & Sync

Everything the editor builds is stored on the server and drawn by each player’s own game. The server sends the maps to the players, and every game spawns the props near the player, hides the erased GTA props and draws the lights. No files are streamed, and the props are not networked entities.


Which maps a player gets

MapWho gets it
Switched on, Live in the WorkshopEvery player
Switched off, Draft in the WorkshopEditors who show maps that are off, and the editor whose working map it is

A player’s game asks the server for the maps once, half a second to two seconds after the player has loaded in. The server answers with every prop, erased GTA prop and light of the maps that are switched on.

Editors also get the maps that are off, already when they join and while the editor is closed. An editor who turns off Show maps that are off in the Workshop’s Maps tab no longer gets them, except their working map: Off: maps you switch off unload for you too, except the map you’re working on. Players never see maps that are off. That choice is saved in the editor’s own game.

When an editor switches a map on, the server sends the whole map to every player at once. When a map is switched off, it is removed for every player who no longer gets it: its props disappear, its erased GTA props come back and its lights go out. See Map Workshop.

When the resource stops, every game removes the props and lights and brings the erased GTA props back. After the next start, every game asks for the maps again.


Streaming around the player

LUA
Config.StreamCellSize = 150.0
Config.StreamRadius = 300.0
Config.StreamInterval = 750

Each game keeps the list of every prop it got, but only spawns the props near the player:

  1. The world is split into squares of Config.StreamCellSize (150 metres).
  2. Every Config.StreamInterval (750 ms), the game picks the squares that reach within Config.StreamRadius (300 metres) of the player in every direction, and spawns the props in them.
  3. Props in squares farther away are removed.

While the editor is open with the flying camera, the camera takes the place of the character, so props stream in wherever you fly. Props you have selected stay spawned when you fly away from them.

SettingWhat it does
Config.StreamCellSizeThe size of the squares, in metres.
Config.StreamRadiusHow far from the player props are spawned, in metres. Maps without their own load distance use it.
Config.StreamIntervalHow often the game checks, in milliseconds.

A spawned prop is drawn up to its own Render Distance: 400 metres unless an editor changed it (lod in Config.ObjectDefaults, kept between 1 and 1000 by Config.LodRange). A model that does not load within Config.ModelLoadTimeoutMs (3000 ms) is skipped, and the game tries it again 30 seconds later. See Streaming, Object defaults and Models.

A map published as its own resource streams by itself and does not use these settings or the map’s load distance. It spawns its props in squares of 150 metres whose centre is within 300 metres of the player, and removes them past 350 metres. See Import, Export & Publish.


Load distance per map

Each map can have its own load distance, set in the Load distance column of the Workshop’s Maps tab. An empty field shows default: the map uses Config.StreamRadius.

LUA
Config.Studio = {
    -- ...
    loadDistanceMin = 50.0, -- smallest per-map load distance (m)
    loadDistanceMax = 2000.0, -- largest per-map load distance (m); unset map = Config.StreamRadius
    -- ...
}

A map with its own load distance:

  • spawns its props within that distance of the player, measured flat, so height doesn’t count,
  • removes them again once the player is 50 metres farther away than that,
  • can load less far or farther than Config.StreamRadius. A larger distance makes the game check more squares.

The server takes 50 to 2000 metres (loadDistanceMin and loadDistanceMax) and refuses other values with Load distance must be 50 to 2000 meters. Clear the field to go back to default. A new load distance reaches the players at once: every player for a map that is on, the editors for a map that is off.

The Load distance field keeps what you type between 50 and 2000, whatever loadDistanceMin and loadDistanceMax say, and the message above names these numbers as well. If you change the two settings, keep them inside 50 to 2000.

See Workshop.


Live sync

Every change an editor makes is saved in the database at once and sent straight to the players who get that map. Other editors see it happen, and players see new props appear without a restart. While changes are on their way to the server, the top bar of the editor shows Saving….

ChangeWho gets it
Props placed, adopted, moved, changed, labelled or brought back, GTA props erased or restored, lights placed or changedEvery player when the map is on, otherwise the editors who see that map
Props or lights deletedEvery player when the map is on, otherwise every editor
Props sent to another mapThe players who get the new map. Players who don’t get it lose the props.

Erased GTA props

LUA
-- Hidden map props (Delete mode and the right-click erase options).
Config.Hides = {
    radius = 10.0, -- "Erase matching nearby" hides every prop of the same model within this distance (m)
    sweepMs = 5000, -- how often copies of hidden props that stream back in are removed again (ms)
}

An erased GTA prop is saved as a model, a spot and a radius. Every game that gets its map:

  • hides that model within the radius around the spot, with GTA’s own model hide,
  • every sweepMs (5000 ms) deletes copies of that model within the radius that streamed back in, unless a script owns them or they were placed with the editor.

So the prop stays gone for every player while the map is on. See Delete Mode and Hidden map props.


Lights

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
    -- ...
}

Lights are not entities. Every game that gets the map draws its lights itself, each frame, from where the camera is:

  • A light is drawn while the camera is within drawDistance (120 metres), or within the light’s own range when that is larger. Near that limit it fades out.
  • The nearest lights are drawn first, with at most drawBudget (256) light draw calls per frame.
  • While no light is in range, the game looks again every idleWait (500 ms).

See Lights and the light settings.


Schedules

LUA
Config.Schedule = {
    tickSeconds = 20, -- how often the server checks whether a rule window opened or closed
    maxRules = 60, -- most rules that can be saved
}

A schedule rule switches maps on and off the same way the Enabled switch of the Maps tab does, so players get or lose the map as described above. While the schedule is live, the server checks the rules every tickSeconds (20 seconds), and right away when an editor saves, pauses or deletes a rule or switches the schedule on. See Schedules.