Roblox has started a public beta for technology that lets people with a Roblox account click a link and play games in a browser, without downloading the app first. In a December 1 post, principal software engineer Fatih Bakır said the feature is beginning on Chrome desktop and Android browsers, and that support for more browsers will follow over the next few months.
The company said making Roblox run on the web meant reworking several assumptions built into the engine, including networking, rendering and content delivery. Bakır wrote that the biggest challenge was concurrency: getting older C++ engine code to work inside the browser’s tighter execution model.
Why the browser build kept stalling
Bakır compared the browser port with native execution by explaining how operating systems schedule threads and how the browser handles JavaScript and WebAssembly. On a normal system, the OS controls when threads run, suspends them when they block, and resumes them later. In the browser, code is expected to run to completion, which makes blocking behavior much harder to preserve.
Roblox ran into that problem immediately when it first tried the Wasm build of the engine. Bakır said it “froze almost immediately” because startup code requests configuration flags over HTTP and waits for the reply. That reply cannot arrive until the browser gets control back, but the engine cannot return control until it has the reply. The result was a deadlock.
Rewriting the entire engine to avoid blocking was not realistic, according to the post. Roblox said it first tried Asyncify, an Emscripten pass that rewrites functions so they can pause and resume themselves. The company said Asyncify worked for smaller programs, but the Roblox engine was too large, with too much code bloat and slowdown.
The second attempt was to turn every fiber into a real thread using Web Workers. Roblox said that approach brought the client all the way to game join on a high-end MacBook, but it ran out of memory quickly on Android. That left the team looking for something that could preserve the engine’s existing assumptions without turning every wait into a browser-wide stall.
JSPI gave Roblox a way to pause Wasm
The turning point, according to Roblox, came when JSPI shipped in Chrome. JSPI lets WebAssembly call a JavaScript function that returns a Promise and then suspends the Wasm code until the Promise resolves. From C++’s point of view, the call still looks ordinary, but the browser can park the stack and resume it later.
That mattered because Roblox already had a large body of code built around blocking calls. JSPI let the company keep that style while shifting the suspension and resumption work into the browser. Bakır described JSPI as the core primitive the rest of the system could be built on.
Roblox’s write-up then laid out how it built a fiber system on top of that primitive. In its model, a fiber that needs to wait is suspended until another part of the engine resumes it. A switch works as “wake target, then pause,” rather than a direct handoff. The browser still decides when execution continues, but Roblox can control the structure of the pause and resume points.
To connect C++ code to JavaScript promises, Roblox stores the Promise resolve functions in a JavaScript array and gives C++ an index to the right one. The engine also swaps a shadow stack pointer in memory, which the compiler uses to track local variables in Wasm. Bakır said the compiler keeps a second stack in regular memory, tracked by a global called __stack_pointer, and each fiber gets its own copy.
Creating a fiber required another workaround. Roblox uses a browser API that starts a fresh call stack and runs the supplied function right away, but the company wanted the fiber to begin suspended. Its solution was a trampoline that pauses immediately, making the fiber behave as if it had started in a waiting state.
Bakır wrote that, from the caller’s side, this looks native: the code receives a suspended fiber that has not really run yet and can be switched to when needed. He added that the browser is doing the low-level work, but the engine is orchestrating it to get the behavior it wants.
Roblox said the gains were large enough to decide whether the web client could exist at all. JSPI fibers switch 14 times faster, start hundreds of times faster and use one-seventieth the memory of threads, according to the post. Roblox said those numbers showed the web client would not have worked without JSPI.
- 14x faster switching
- hundreds of times faster startup
- 1/70th the memory of threads
Bakır summarized the result by saying,
“JSPI allows a few dozen lines of JavaScript to implement the core fiber API: create, swap_context, and destroy.”
He added that twenty years of engine code can still wait on the web page.
Memory leaks forced Roblox to unwind dead fibers
The first working version was not the final one. Roblox said its tab memory kept growing even when the number of fibers stayed stable, and the problem first showed up as Android crashes. Later, a Mac running macOS Tahoe kernel-panicked after running out of page table entries.
Roblox traced the leak to Chromium keeping a suspended JSPI stack alive even when nothing could resume it. Every fiber the company created claimed fresh pages from the operating system, and those pages were not being returned. According to the post, each destroyed fiber leaked 17 KB of memory.
The only reliable fix, Roblox said, was to make the browser release the stack by unwinding all the way back to JavaScript. Threading a shutdown signal through every function call would have meant rewriting too much of the engine and would have hurt performance, so the company used an exception-based approach instead. To destroy a fiber, the engine wakes it one last time with an argument that tells it to self-destruct.
Bakır explained that the code then uses an unreachable instruction in Wasm to force the stack to unwind. The post said a regular C++ throw was not suitable because a catch(…) elsewhere in the engine could swallow it. By using the trap path, Roblox gets the unwind it needs, the browser releases the stack, and the memory returns to the OS.
Roblox framed the system as a way to keep long-standing engine behavior intact while matching browser rules. The company said the browser client now uses a few dozen lines of JavaScript to implement the core fiber API, while the rest of the engine can continue relying on blocking behavior that would normally break in a web environment.
The public beta is starting with Chrome desktop and Android, and Roblox says more browsers will be added over the next few months. The company signed off by inviting people who enjoy that kind of technical problem-solving to join the team.
do you reckon this actually makes Roblox easier to try for new players, or is Chrome just gonna be the usual beta pain with logins and loading weirdness?
no, it just means more loading screens
maybe, but less friction still matters
android will be the bottleneck
I think desktop will matter more first. Most people trying this on phone are already fine with the app, but a browser link on PC is a nice shortcut.
maybe for older players, yeah, but android is where the awkward hardware shows up fastest. if it survives there, desktop is the easy part.
17 KB per dead fiber is nasty
17 KB sounds tiny until they start leaking it over and over, then suddenly Android is doing the full meltdown routine. The part that got me is the Mac kernel panic from page table entries, because that is a very specific way to discover your test case went off the rails. Roblox really turned “one more browser feature” into a memory horror story.
the fact they had to use JSPI because Asyncify was too bloated is wild. feels like every time a platform says “just run it in browser” the memory bill shows up anyway.
my laptop fans already know this pain
“just in browser” – famous last words, apparently
I get why they used JSPI, but this also sounds like the kind of thing that works great until the browser changes one detail and half the fiber tricks need patching. Keeping old C++ assumptions alive in a web sandbox is clever, yet it also means they are permanently fighting the browser model instead of really adapting to it. That is impressive engineering, but not exactly comforting for players who just want the game to boot.
chrome only for now lol
better than nothing mate
my phone says no way xD
yeah, that is what worries me too. if Android is supported first, i hope they keep the low-end phones in mind and not just the newer ones.
this is bigger than the app