# 🎮 Marble3: a small open-source TypeScript engine for 3D games in the browser

All Today · published 2026-12-03T15:10:00Z · https://all-today.com/product/0f6b11db-b27f-4815-b333-1abc57520402?lang=en

- 🎮 Marble3 is a TypeScript engine for 3D browser games: Three.js draws, Bullet physics runs as WebAssembly.
- It comes with a first-person player for desktop and touch screens, voxel terrain and a simple HUD built from DOM elements.
- One npm package, MIT licence, about 4,000 lines of code; examples and docs are online.

Marble3 is an open-source engine for small 3D games that run in a web page. According to its project page, it combines Three.js for rendering with the Bullet physics engine compiled to WebAssembly. A game is a function that returns an HTML element, which can be mounted anywhere on a page and removed again with one call. The engine includes a player with mouse-and-keyboard controls on desktop and a stick with swipe-look on phones, terrain generated from noise, and on-screen elements such as score lines and dialogs. It installs with `npm install marble3` and is licensed under MIT. 🧱

**What it is for.** The maker, who publishes the code on GitHub as [bhirbec/marble3](https://github.com/bhirbec/marble3), describes Marble3 as about 4,000 lines of TypeScript in one npm package. Three.js is installed with it and the Bullet WebAssembly build ships inside it, so there are no CSS files and no assets to copy. The [project page](https://marble3.dev) shows a short example: create an `FPS` object, add lights, a grid, a box and a `Player`, and call `start(player)` to get back a container element. `disposeGame(el)` tears everything down again, physics included.

🧪 **Physics.** Collisions and movement come from Bullet, the C++ engine, which reaches the browser through Bullet TS, a companion project by the same author: Bullet's source compiled to WebAssembly with Emscripten, with generated TypeScript declarations. Marble3 adds dynamic bodies, a velocity-based character controller, raycasts and collision callbacks, and supports boxes, spheres, convex hulls and static meshes. The underlying `btDiscreteDynamicsWorld` stays accessible for anything the wrappers do not cover. Bullet is under the zlib licence; Bullet TS and Marble3 are MIT.

**Controls and terrain.** On desktop the player uses pointer lock with WASD; on phones there is a stick, swipe-look and a jump button, and the `Player` picks the right controller by itself. Terrain uses simplex-noise heightmaps with greedy block merging, and physics is streamed in around moving entities instead of building the whole map at once. The screen chrome, such as score lines, bars, hints, banners, buttons and dialogs, is plain DOM, styled inline and removed with the game. The page also runs an Asteroid world example on the engine, and further examples are linked there.

📦 **Getting it and limits.** The package is ESM-only and meant for use with a bundler. Vite 8 needs no configuration; Vite 7 or older needs two settings, listed in the getting-started guide. The repository states that three.js 0.163 is installed with it and that pnpm users should add `three@0.163` so only one copy exists. Marble3 was published as `wasmotion` until version 0.2.0; that package stays on npm but gets no new releases, and moving over means changing the import name. The repository also notes that 0.x minor versions may break. It is a thin layer on top of Three.js, not an editor-based engine, so it suits developers who want to write small games in code.

## Sources

- [bhirbec/marble3 repository](https://github.com/bhirbec/marble3)
- [Marble3 project page and docs](https://marble3.dev/)

---
This post was selected, researched, written and rated by AI. The AI can be wrong: check the sources.
