Sled Volt:如何為 Roblox 和瀏覽器打造同一款雪橇競速遊戲
How we built one sled racing game for Roblox and the browser
Sled Volt 團隊為 Roblox 和瀏覽器打造同一款雪橇競速遊戲,兩個版本共用確定性的 60 Hz 模擬,並以逐行移植的模擬程式維持一致。測試套件會用 400 個種子測試賽道可通行性,並逐個 tick 比對兩種語言的模擬結果。瀏覽器版由 Cloudflare Worker 重播玩家輸入驗證賽果;Roblox 版則由伺服器重播輸入並決定名次。
The game in one paragraph
Sled Volt is a three-lane sled runner down an endless snowy mountain: change lanes, jump, tuck, grind rails, fill a frost meter and double-tap for VOLT to smash through everything, while a snow beast called the Rimehorn chases you after a stumble. It ships twice: a free browser game (three.js) and a Roblox game with live races of up to 8 players.
One simulation, two languages
The whole game rule set is a deterministic 60 Hz simulation: core.js in the browser and Sim.luau on Roblox, ported line for line. Same seed and same inputs give the same course, the same collisions and the same score. A generated parity spec runs recorded inputs through both and compares every tick, so a change in one language that isn't mirrored in the other fails the build.
Fair by construction
The course generator always keeps one lane passable. Instead of trusting that, a bot plays 400 seeds to 9,000 m in the test suite and must clear all of them. If a generator change can produce an impossible row, a seed fails and the change doesn't ship.
Never trust the client's score
Because the sim is deterministic, neither server needs to trust a score. The browser posts its inputs and a Cloudflare Worker re-plays the run before it reaches the Daily Run board. On Roblox the server re-plays each racer's inputs with the same Luau sim and decides placements itself.
Races that always start
A lobby with 2 real players is a dead lobby, so the race gate runs a short countdown (shorter once all 8 slots fill) and CPU riders fill the empty slots with the same bot the fairness test uses. Racers sled parallel copies of the same seeded track side by side, so you can see who leads without anyone blocking a lane.
What we test outside Studio
- Sim unit tests and the 400-seed bot run (Node).
- The JS/Luau parity spec in a Luau VM.
- A Roblox API static check against the API dump, and a full smoke test of a solo run and a 2-player race in a strict engine mock.
- Playwright plays the real browser build end to end.
The mock can't measure real network timing across devices, so live races on Roblox stay the final check.
Controls, race tips and both versions: https://cybermaxtools.com/how/sled-volt-roblox-sled-racing-game/
Published automatically by CyberMax. Every number above comes from the linked public data; nothing is estimated.
來源:DEV Community · dev.to