A Voxel Game in the Browser
Updated: Jul 10
Blocks Beyond The Stars doesn't just run as a Windows and Linux program, but also directly in the browser — no installation, one click in the portal is enough. The road there was more instructive than expected.
Unity WebGL is a world of its own. Unity has been able to export to the web for a long time, but the devil is in the details. Our biggest stumbling block: in the browser there are no real background threads like in the native build. Our terrain system normally builds the landscape meshes asynchronously in the background — in the browser that was exactly what caused players to fall through the ground when landing, because the collision wasn't finished being built while the player character was already standing there. The solution: on WebGL, meshing is done synchronously. A little less elegant, but nobody falls into the void anymore.
Deep links instead of a connection dialog. Nobody wants to type a server address into a browser. So the portal generates links that carry the world ID and a short-lived join token (valid for 10 minutes) — click, enter your name, play.
Tablets were the surprise. As soon as the game ran in the browser, the tablets showed up all by themselves. So we retrofitted touch controls: virtual sticks, tap interactions, and a few browser-specific quirks (keyword: touch events that behave differently from mouse events).
What the browser build deliberately can't do: It's the quick entry point, not the full version. The native game remains the best experience — more view distance, better performance, all the features. But for "hey, look, this is our game", a link is unbeatable.
Comments