search/
Start typing to search packages!
package_2
server-sync
By @dooougs
Roblox
Mirrored from WallyServerSync
A shared world store for Roblox experiences where many servers edit the same world at once. Extracted from Plant World, where it holds every plant in every city.
- Objects (written once, first copy wins) and updates (per field, newest timestamp wins), sharded into one DataStore key per region.
- Saves merge with
UpdateAsync(compare-and-swap), so servers never overwrite each other and nothing ever waits on a lock. - Old updates are compacted into versioned baselines under a try-once MemoryStore lease with a fencing check.
- Edits are broadcast live through MessagingService in batches sized for its 1 KB / per-minute limits; anything missed is caught by periodic re-reads.
- Budget-aware reads with jittered back-off, bounded region cache, Studio offline mode.
Install
[server-dependencies]
ServerSync = "dooougs/server-sync@0.1.0"
Use
local ServerSync = require(ServerScriptService.ServerPackages.ServerSync)
local store = ServerSync.newStore({ storeName = "MyWorld_v1" })
local sync = ServerSync.newBroadcaster(store, { topic = "MyWorldUpdates_v1" })
store.start()
sync.start()
store.createObject("3,4#1", { pos = { x = 10, z = 20 }, kind = "tree" })
store.set("3,4#1", "w", 0.5)
store.onChanged(function(id, field, value) print(id, field, value) end)
Entity ids start with their chunk, "cx,cz", by default; pass keys to map
ids to regions your own way.
Options
See src/Options.luau for every option and default.
Highlights:
| option | default | |
|---|---|---|
storeName | required | keep it identical to keep existing saves |
scope, leaseMapName | none, <storeName>_compact | |
keys | "cx,cz" ids, 8x8-chunk regions | custom id → region mapping |
flushInterval / refreshInterval | 30 / 120 s | |
refresh, eviction | true | turn re-reads or the region cache off |
compaction.enabled | true | plus lag, minUpdates, interval, lease, tombKeep |
forceOffline, studioProbe, bindToClose | false, true, true | |
broadcaster publish / subscribe | true | one-way sync, or none |
broadcaster publishInterval / messageBytes | 4 s / 900 |
The saved record layout (v = 3) is fixed so saves always load.
Package Details
Install command (Click to copy)
Version
0.1.0
License
MIT
Safe for commercial use
Automated license review — not legal advice.
