Roblox opens beta for playing from Chrome without installing the app

Roblox opens beta for playing from Chrome without installing the app

Roblox has begun rolling out a public beta that lets users play from Chrome without downloading the app, on both computers and Android devices. Anyone with an account can open a link to a Roblox game and run it in the browser; the company plans to expand compatibility to other browsers over the coming months.

Roblox’s post, written by principal software engineer Fatih Bakir, explains that bringing the engine to the web required revisiting several components: networking, rendering, and content delivery. The most complex obstacle was adapting concurrent programming, a part of the engine built on two decades of C++ code.

Playing in the browser, with limitations

The browser-play option appears on Roblox’s website, according to 9to5Google. The beta is intended for Chrome versions on desktop and Android. Roblox did not announce a specific date for its arrival in other browsers, only saying that it will begin becoming available in them over the coming months.

Compatibility also depends on the device. 9to5Google lists as minimum requirements Windows and Mac computers with a 5th-generation Intel Core i5 or later, as well as Macs with Apple Silicon. For Android, it mentions devices such as the Redmi A5, Galaxy A15 5G, Galaxy S10, or Pixel 6, or similar models. Roblox’s post does not detail these hardware requirements.

PlatformRequirements mentioned
Windows5th-generation Intel Core i5 or later
Mac with Intel processor5th-generation Intel Core i5 or later
MacApple Silicon
AndroidDevices such as the Redmi A5, Galaxy A15 5G, Galaxy S10, or Pixel 6, or similar

The list of unavailable features includes voice chat and conversations with friends or in groups. Video playback within games and video ads are also unavailable, as are image capture or Moments, haptic support, changing avatars in-game, and remote MicroProfiler captures. Dynamic Heads avatars through Self View are also excluded.

There are also known issues. Background music may stop playing, and some games may freeze; entering new areas or viewing content for the first time can cause stuttering. Roblox Web may use more memory than the native client. On Windows computers with both integrated and dedicated GPUs, Chrome selects the integrated one; the top bar and player list may fail to load, and some interface elements may appear blurry or incorrectly sized.

The engine needed to learn how to wait

The technical problem stems from a difference between the Roblox engine and the browser’s execution model. On traditional operating systems, the engine can use threads and wait for a network response to arrive or a lock to be released. The operating system suspends one thread and switches to another; each switch has a CPU cost, which can add up when many tasks are running simultaneously.

Roblox uses fibers, or lightweight threads, which the program itself can create and schedule without asking the operating system to switch threads. If a fiber has to wait, the engine suspends it and switches to another. The switch saves the CPU registers, changes the stack pointer, and restores the registers of the fiber that resumes. The company describes the operation as roughly two dozen lines of assembly per CPU architecture.

But JavaScript and WebAssembly (Wasm) usually run until the current function completes. In the browser, an asynchronous request returns a Promise, and the code continues later through a callback function. That wait propagates through the functions that depend on it: a function that needs to wait returns a Promise, and its callers must also be adapted.

The Roblox engine, by contrast, contains 20 years of C++ code that waits for responses. During startup, it requests configuration parameters over HTTP and waits to receive them. In the first Wasm test, the engine got stuck: the browser could not deliver the response until it regained control, but the engine would not give up control until it received the response. Rewriting the entire engine so that it never blocks was not an option, Bakir explains.

Roblox abre la beta para jugar desde Chrome sin instalar la app
© Roblox

JSPI replaces real threads

Roblox first tried Asyncify, an Emscripten tool that rewrites program functions so they can be paused and resumed. According to the company, it worked with small programs, but the size of the engine caused too much code overhead and a slowdown it could not overcome.

The next attempt turned each fiber into a real thread using Web Workers, the JavaScript feature that enables work with threads. The technique made it as far as joining a game on a high-end MacBook, but ran out of memory on Android.

The solution was JavaScript Promise Integration (JSPI), a Wasm feature Roblox had been waiting for that arrived in Chrome. JSPI allows Wasm to call a JavaScript function that returns a Promise. The browser sets aside the Wasm call stack, returns control to the code that invoked it, and resumes execution where it stopped when the Promise resolves.

For C++ code, that call can look like a regular call, without having to write an explicit wait operation or a Promise. Roblox used this primitive to build context switching between fibers. JavaScript retains the functions that resolve the Promises of paused fibers, while C++ receives an index to locate the fiber that should resume.

Wasm does not expose a stack pointer of the kind the engine expects to manage. Roblox works around this difference with a second stack, a regular in-memory structure that the compiler maintains for C++ local variables. Each fiber has its own stack of this kind, and the engine changes the global variable __stack_pointer when switching from one to another.

Creating fibers also required an adjustment. The browser API that provides a new call stack immediately runs the associated function. Roblox wanted the fiber to remain stopped until the engine explicitly resumed it, so it wrapped it in a trampoline function that first switches to another fiber. The new fiber is suspended from the outset and ready to run when its turn comes.

The cost of a stack that was not released

Early tests with JSPI worked, but the tab began using more and more memory even though the number of fibers remained stable. Roblox observed crashes on Android and, later, a kernel panic on a Mac running macOS Tahoe after the page table entries ran out.

After investigating for weeks, the team attributed the problem to Chromium: it kept a suspended JSPI stack active even when nothing could resume it. Creating fibers requested new pages from the operating system, and those pages were not returned when the fibers were destroyed. The leak was 17 KB for every destroyed fiber.

The solution forces the fiber that is about to disappear to unwind its stack back to JavaScript, at which point the browser can release it and return the memory to the operating system. Roblox activates it one last time with a signal to destroy it. Instead of using a regular C++ exception, which a catch (...) block could catch, the engine uses a Wasm instruction that C++ code cannot catch and forces the unwind.

In tests published by Roblox, JSPI significantly reduces costs compared with thread-based fibers:

OperationWith threadsWith JSPIDifference reported
Context switch~2.6 µs~0.18 µs~14 times faster
Create a fiber~5 ms~20 µs~250 times faster
Destroy a fiber~50 µs~1.3 µs~35 times faster
Memory per fiber~3.1 MB~44 KB~70 times less

Roblox maintains that without JSPI, the web client would not have worked. Implementing the basic fiber operations—creating, context switching, and destroying—requires a few dozen lines of JavaScript, but the engine still needs to be adapted to their quirks. The public beta already lets users try this work in Chrome, with the feature limitations and performance issues that Roblox Web still needs to address.

“Making this possible on the web, for Chrome browsers, meant rethinking several of the assumptions that have been baked into the Roblox engine, including networking, rendering, and content delivery.”

— Fatih Bakır, Roblox principal software engineer

Sources: Roblox, 9to5Google, PocketGamer