Multiplayer physics games in the browser, with no game server.
Cars and character controllers built in. TypeScript end to end.
Live demos • Quickstart • Multiplayer • When to use it • Packages • Architecture • API docs • Roadmap
GG Web Engine is an open-source TypeScript game engine for the browser. Its strongest case is one the usual browser engines leave to you: 2-8 players share one physics world over WebRTC, peer to peer, with ownership, late join, reconnection and replica correction built in - no game server to write or host (how). It also ships the parts that driving and character games take longest to get right: a car model with engine, torque curve and gearbox, raycast vehicles, and first-person, third-person and 2D platformer character controllers.
It does not reinvent rendering or physics. A small, strictly typed core - worlds, entities, clocks, input, levels, networking - drives battle-tested libraries plugged in behind it: Three.js or Pixi.js for rendering, Rapier, Ammo.js or Matter.js for physics. Your game code talks to the core, so switching to another backend of the same dimension takes one line and, apart from a few documented gaps, needs no gameplay-code changes. Each backend keeps its own simulation behavior, so expect to retune physics (what differs). The native objects stay one property away whenever you need them.
|
Built for 2-8 players sharing one physics world over WebRTC, in 2D or 3D, on any physics adapter. Ownership, possession, late join, reconnection and replica correction are built in (how it works). |
Character controllers (2D and 3D, first/third person), raycast vehicles and a full car model with engine and gearbox, triggers, grabbable props, cameras, animators, positional audio (full list). |
|
Describe a scene as JSON, register your own entity classes, wire events to behavior with blueprint graphs, serialize live entities back. Author 3D scenes in Blender with the bundled exporter add-on. |
One visual adapter + one physics adapter of matching dimensionality on top of the core. Switch from Ammo.js to Rapier by replacing a single constructor: your code keeps compiling and running. Feel and tuning (friction, restitution, vehicles, character sliding) differ per backend. |
|
In-game console with custom commands, physics debug view, stats and per-entity performance
profiling. Use |
Ships a Claude Code skill that teaches a coding agent the engine's mental model, API and common pitfalls, so it guesses less (install it). |
More of what is in the box:
- 2D and 3D worlds sharing one set of concepts -
Gg2dWorldandGg3dWorld. - Automatic physics ↔ rendering sync: an entity binds a display object to a rigid body and keeps them aligned every tick.
- Hierarchical pausable clocks, time scale, optional fixed physics timestep, optional auto-pause when the tab is hidden (
pauseWhenHidden). - Screens and loading:
ScreenManagerruns menu, game and pause screens as a stack of DOM layers;LoadingScreen.show()/hide()covers startup or a level load with the built-in loading screen, or with your own. - Streaming large maps:
MapGraph3dEntityloads and disposes map chunks by proximity. - Reactive API on RxJS: ticks, input, collisions and world events are observables.
- Strict TypeScript throughout; annotate the world as
TypedGg3dWorld/TypedGg2dWorldto get the native types of whichever libraries you plugged in (how).
The fastest start is a starter template: a Vite + TypeScript project with a level, controls and a camera already wired, ready to grow into a game.
npx degit AndyGura/gg-web-engine/templates/3d-character my-game # or 2d-platformer, multiplayer-cars
cd my-game && npm install && npm run devSee templates/ for what each one contains. To add the engine to an existing
project instead:
npm install @gg-web-engine/core @gg-web-engine/three @gg-web-engine/rapier3dAdd a canvas to the page (<canvas id="gg"></canvas>, and body { margin: 0; }), then:
import { Gg3dWorld, Pnt3, Qtrn, TypedGg3dWorld } from '@gg-web-engine/core';
import { ThreeGgWorld, ThreeSceneComponent } from '@gg-web-engine/three';
import { Rapier3dGgWorld, Rapier3dWorldComponent } from '@gg-web-engine/rapier3d';
// one world = clock + visual scene + physics world
const world: TypedGg3dWorld<ThreeGgWorld, Rapier3dGgWorld> = new Gg3dWorld({
visualScene: new ThreeSceneComponent(),
physicsWorld: new Rapier3dWorldComponent(), // or: new AmmoWorldComponent()
});
await world.init();
// viewport and camera
const renderer = world.addRenderer(
world.visualScene.factory.createPerspectiveCamera(),
document.getElementById('gg')! as HTMLCanvasElement,
);
renderer.position = { x: 12, y: 12, z: 12 };
renderer.rotation = Qtrn.lookAt(renderer.camera.position, Pnt3.O);
// static floor
world.addPrimitiveRigidBody({
shape: { shape: 'BOX', dimensions: { x: 7, y: 7, z: 1 } },
body: { bodyType: 'static' },
});
// drop a 1 kg cube twice a second
const spawnTimer = world.createClock(true);
spawnTimer.tickRateLimit = 2;
spawnTimer.tick$.subscribe(() => {
const cube = world.addPrimitiveRigidBody({
shape: { shape: 'BOX', dimensions: { x: 1, y: 1, z: 1 } },
body: { mass: 1 },
});
cube.position = { x: Math.random() * 5 - 2.5, y: Math.random() * 5 - 2.5, z: 10 };
setTimeout(() => world.removeEntity(cube, true), 30000);
});
world.start();3D worlds are always Z-up:
{x, y}is the ground plane,+Zpoints to the sky.
Levels can be plain JSON, loaded with the world's LevelLoader. Built-in classes cover primitives,
triggers, cameras, lights, environment, players, GLB models, cars, map graphs and sounds; your own
classes join through world.loader.registerClass(...).
import { LevelJson } from '@gg-web-engine/core';
const level: LevelJson = {
entities: [
{
class: 'Primitive',
shape: 'BOX',
name: 'Floor',
config: { dimensions: { x: 7, y: 7, z: 1 }, body: { bodyType: 'static' } },
},
{
class: 'Trigger',
name: 'KillFloor',
position: { x: 0, y: 0, z: -15 },
config: { dimensions: { x: 1000, y: 1000, z: 1 } },
// event wired to a built-in blueprint node, no code needed
events: { onEntityEntered: { type: 'RemoveEntity', settings: { dispose: true } } },
},
{ class: 'Camera', name: 'MainCamera', position: { x: 9, y: 12, z: 9 } },
],
};
const levelGroup = await world.loader.loadLevel(level, 'MainLevel');@gg-web-engine/multiplayer turns a single-player world into a
shared one. Peers connect directly to each other over WebRTC data channels; the only backend is a
signaling channel (Firebase Realtime Database on its free plan - or none at all between tabs of one
browser).
import {
FirebaseSignaling,
getRoomIdFromUrl,
Network3dController,
WebRtcMeshTransport,
} from '@gg-web-engine/multiplayer';
const signaling = new FirebaseSignaling();
const roomId = getRoomIdFromUrl() ?? (await signaling.createRoom());
const net = new Network3dController({ transport: new WebRtcMeshTransport({ signaling, roomId }) });
world.addEntity(net);
await net.loadSharedLevel(levelJson, 'level', 'level.json'); // every peer builds the level itself
await net.connect();
const player = (await world.loader.createEntity({ class: 'Player', position: spawnPoint }))!;
world.addEntity(player); // spawned at runtime: replicated to every peer automatically
net.possess(player); // local input drives it; state and input are broadcastThe rest of the game stays single-player code. What you get:
- Every peer simulates everything; ownership decides whose state wins. Each entity has one owner whose state is broadcast, and every other copy is smoothly corrected toward it. A player owns what they possess (a character, a car); free objects belong to whoever is near them.
- Works with what you already have: rigid bodies, cars and character controllers are networked out of the box, in 2D and 3D, on every supported physics library.
- Late join, reconnection and takeover of entities whose owner left or hid the tab.
- Gameplay authority:
net.hasAuthority(...)picks the one peer that runs a collision or trigger consequence (the owner of the entity involved), so leveleventsbindings fire once per room. - Zoning for bigger worlds: peers only connect to and stream state for the grid cells around them.
- Testable: an in-process loopback transport with simulated latency, jitter and packet loss, plus
net_*console commands for live inspection.
Try it: open the Car race (3D) or Coin run (2D) demo and share the room link.
A short, honest guide. Every option below is a fine choice for the right game.
Pick GG Web Engine when
- Several players should share one physics world in the browser (co-op, party, racing, physics sandbox) and you don't want to write netcode or run a game server. This is the case it was built for.
- The game is a driving or character game: a car with an engine and gearbox, raycast vehicles, a first/third-person or 2D platformer controller are already there, on every physics backend.
- Levels are data: generated, edited by tools or written by an AI agent as JSON, with your own entity classes and blueprint-wired events.
- You want to write against an engine API but keep Three.js, Pixi.js, Rapier, Ammo.js or Matter.js underneath, with their native objects one property away.
Pick something else when
- Raw Three.js + Rapier (or Pixi.js + Matter.js): one scene, full control over the render loop and the newest library release on day one. GG pins exact versions of the libraries it wraps and adds a layer you may not need for a product viewer or a single physics toy.
- Babylon.js: a rendering-heavy 3D game or an XR experience. It has a mature PBR pipeline, WebGPU, WebXR, an inspector and node editors, a large community and a long record of stable releases. GG has no WebXR support and its 3D rendering is whatever Three.js gives.
- Phaser: a classic 2D game (tilemaps, sprite animation, arcade physics, scenes) with a huge library of tutorials. Choose GG for 2D only if you need shared multiplayer physics or one codebase across 2D and 3D.
- Godot (web export): you want a visual editor, or desktop and mobile builds from the same project. Expect a large WebAssembly download, and multi-threaded exports need cross-origin isolation (COOP/COEP) headers on the host.
- You need long-term API stability today. GG is at
0.0.Nwith one maintainer; the API can change between releases (see Project status). Babylon.js, Phaser and Godot have versioning policies and large teams behind them.
Every package is published at the same version. Pick the core, one renderer and one physics engine of the same dimensionality; audio, multiplayer and mobile controls are optional.
| Package | Role | Built on |
|---|---|---|
@gg-web-engine/core |
Worlds, entities, clocks, input, level loader, dev console | RxJS |
@gg-web-engine/three |
3D rendering | Three.js |
@gg-web-engine/pixi |
2D rendering | Pixi.js |
@gg-web-engine/rapier3d |
3D physics | Rapier |
@gg-web-engine/ammo |
3D physics | Ammo.js (Bullet) |
@gg-web-engine/rapier2d |
2D physics | Rapier |
@gg-web-engine/matter |
2D physics | Matter.js |
@gg-web-engine/audio |
2D/3D positional audio | Web Audio API |
@gg-web-engine/multiplayer |
P2P shared-world multiplayer | WebRTC, Firebase signaling |
@gg-web-engine/mobile-controls |
On-screen touch controls: sticks, buttons, d-pads, tilt steering | DOM, Pointer Events |
Measured for 0.0.92 by etc/bundle_sizes.mjs: minified with esbuild, then gzipped. A package's own
size keeps every export and leaves out its dependencies; the library it wraps is listed separately. Apps
import less than everything, so their bundles tree-shake below these sums.
| Package | Own code (gzip) | Wrapped library (gzip) |
|---|---|---|
@gg-web-engine/core |
88.9 kB | - |
@gg-web-engine/three |
25.2 kB | 185.6 kB three |
@gg-web-engine/pixi |
8.7 kB | 259.8 kB pixi.js |
@gg-web-engine/rapier3d |
13.3 kB | 1.57 MB @dimforge/rapier3d-compat, WebAssembly inlined as base64 |
@gg-web-engine/ammo |
652.0 kB | Bullet, compiled to WebAssembly, ships inside the package |
@gg-web-engine/rapier2d |
10.0 kB | 1.22 MB @dimforge/rapier2d-compat, WebAssembly inlined as base64 |
@gg-web-engine/matter |
9.1 kB | 27.1 kB matter-js |
@gg-web-engine/audio |
13.5 kB | - |
@gg-web-engine/multiplayer |
34.4 kB | - |
@gg-web-engine/mobile-controls |
29.3 kB | - |
Core without the dev console (GgStatic, left out of an app that never imports it) is 82.7 kB.
Core's own dependency, rxjs, is 18.1 kB if imported whole.
The starter templates, bundled as complete apps (engine, libraries and game code):
| Template | Stack | Whole app (gzip) |
|---|---|---|
3d-character |
rapier3d + three | 1.84 MB |
2d-platformer |
mobile-controls + pixi + rapier2d | 1.50 MB |
multiplayer-cars |
multiplayer + rapier3d + three | 1.94 MB |
Also in this repo: the GG Web Engine Exporter Blender add-on, which
exports a scene as .glb + .meta (meshes, rigid bodies, splines, empties) for the 3D loader.
Browse all interactive demos → Every demo runs on
each physics backend of its dimension (switch it in place), and each opens in StackBlitz with one
click; the source lives under
examples/2d and examples/3d.
| Demo | Shows |
|---|---|
| Car race | A complete multiplayer racing game: share the link, race three laps |
| Tower climb | A complete third-person game: title, pause, win and game over screens |
| Platformer | A complete 2D platformer: lives, checkpoints, enemies, a goal flag |
| Prompt to level | A level an AI agent wrote as JSON from a prompt; paste your own |
| Fly city | Driving through a streamed city: cars, map graph, audio, multiplayer |
| Coin run | 2D multiplayer platformer rounds |
| Portal room | First-person character, grabbable props, positional sound |
| Player character | Animated character controllers, in 3D and 2D |
| Shooter | Free-fly camera shooting balls through a textured physics scene |
| Procedural sky | Shader-drawn sky with live sliders: time of day, haze, clouds up to full overcast, stars and moon |
| Backdrops | Miniature coastline and mountain ring drawn behind the world, Source-style 3D skybox |
| Primitives | A level built from JSON, in 3D and 2D, on every physics backend |
Built with the engine: The Need For Speed Web, a browser remake of the 1994 classic and the project this engine grew out of.
The repo ships a Claude Code skill,
gg-engine-app-development, covering the
engine's concepts, bootstrap pattern, available shapes, controllers and loaders, and common
pitfalls. Install it into your own project with npx skills:
npx skills add AndyGura/gg-web-engine --skill gg-engine-app-development -yOther agents (Cursor, Codex, Copilot, ...) get the same guide with no extra step: it ships inside
the core package as node_modules/@gg-web-engine/core/AGENTS.md, so point your agent there or
copy it into your project's own AGENTS.md.
Agents deciding whether to use the engine can read it in one request: the docs site serves
llms.txt (an index) and
llms-full.txt (pitch, install lines,
the full guide and one complete game per dimension).
Then ask your agent to build the scene or game. Add
gg-engine-level-json the same way if you author
levels as JSON. The remaining skills under .claude/skills are for working on the
engine itself - see CLAUDE.md.
flowchart TB
w{"3D World<br/>(core)"} --> cn0["controller<br/>(core)"]
w --> rb0["rigid body entity<br/>(core)"]
w --> rb1["3D model entity<br/>(core)"]
w --> rb2["trigger entity<br/>(core)"]
rb0 --> c0("mesh component<br/>(three)")
rb0 --> c1("body component<br/>(rapier3d)")
rb1 --> c2("mesh component<br/>(three)")
rb2 --> c3("trigger component<br/>(rapier3d)")
Three concepts carry the whole engine:
- World -
Gg2dWorldorGg3dWorld. Owns the clock, the visual scene, the physics world, keyboard input and the list of spawned entities, and propagates ticks to them in order. A page can run several worlds at once. - Entity - anything that lives in a world and can react to ticks: a rigid body, a trigger, a renderer, a controller. Entities are implemented in the core and know nothing about the libraries underneath.
- Component - the part an adapter package implements: a mesh, a sprite, a rigid body, a camera, a physics world. An entity uses zero or more components.
Supporting pieces:
- Clocks form a hierarchy rooted at the
requestAnimationFrame-drivenGgGlobalClock. Each world has aPausableClock; pausing a clock pauses its children, so in-game timers stop with the world. - Inputs -
KeyboardInput(key bindings asObservable<boolean>),MouseInput(deltas, pointer lock),DirectionInput(WASD/arrows plus analog sources) andGamepadInput(buttons, triggers and sticks by index, feeding the other inputs; rumble) - are created and consumed by controller entities. - Factories (2D, 3D) create primitive display objects and rigid bodies from a shape descriptor.
- Loaders:
LevelLoaderbuilds entities from level JSON; the 3D GLB loader reads.glb+.metascenes exported from Blender.
Built-in entities
- Entity2d / Entity3d - a display object (sprite or mesh) plus a rigid body, kept in sync every tick
- Trigger2dEntity / Trigger3dEntity - a physics volume that emits events when another entity enters or leaves it
- CharacterController2dEntity / CharacterController3dEntity - a capsule-bodied, physics-driven character: walk, run, crouch, jump, gravity
- PlayerCharacterController2d / PlayerCharacterController - keyboard/mouse control and a following camera for a character; first- and third-person modes with camera-collision avoidance in 3D
- RaycastVehicle3dEntity - a raycast vehicle with chassis and wheel meshes bound to it
- GgCarEntity - a four-wheel car simulating an engine with a torque table, a gearbox and more, with GgCarHandlingController (throttle, steering, gears, handbrake) to drive it
- Grabbable3dEntity - a prop that can be picked up, carried and thrown, paired with ObjectGrabController
- MapGraph3dEntity - loads the nearby parts of a big map and disposes the far ones
- ParticleSystem2dEntity / ParticleSystem3dEntity - sprite particles (sparks, smoke, dust, fire; camera-facing in 3D) simulated in core, emitted by the app or at a rate, optionally attached to another entity, with a fixed step for old-school effects
- SurfaceFollowingEntity - keeps colliders on a smooth surface given as a function (position and normal) by moving a plane under each one every tick; Ammo.js only, since Rapier 3D has no plane collider
- Renderer - renders the scene and manages canvas size (fullscreen by default)
- FreeCameraController - fly a camera with WASD + mouse
- AnimationMixer - smooth transitions between animation functions, with Entity2dPositioningAnimator / Entity3dPositioningAnimator for entities and Camera3dAnimator for cameras
- createInlineTickController - a tick callback added to the world in one line
Components an adapter implements
- IVisualScene2dComponent / IVisualScene3dComponent - the visual scene or display object container
- IDisplayObject2dComponent / IDisplayObject3dComponent - a sprite or mesh
- IRenderer2dComponent / IRenderer3dComponent - the renderer
- IPhysicsWorld2dComponent / IPhysicsWorld3dComponent - the physics world
- IRigidBody2dComponent / IRigidBody3dComponent - a rigid body
- ITrigger2dComponent / ITrigger3dComponent - a physics object that only detects overlaps
- IParticleSystem2dComponent / IParticleSystem3dComponent - draws a particle system's sprites
- ICameraComponent - a camera (3D)
- IRaycastVehicleComponent - a raycast vehicle (3D)
Enable it with GgStatic.instance.devConsoleEnabled = true and press </kbd> at runtime. Register your own commands with GgStatic.instance.registerConsoleCommand`.
Built-in commands
| Command | Arguments | Description |
|---|---|---|
commands |
- | Print all available commands: global ones and those of the currently selected world |
help |
string |
Print the doc string of a command |
worlds |
- | Print all currently available worlds, with the rendering/physics/audio backend each one runs on |
world |
string? |
Select a world by name (optional), then print the selected one: name, backends, clock state, time scale, fps limit, physics step, entity and renderer counts |
stats_panel |
0|1? |
Turn the stats panel on/off; skip the argument to toggle |
debug_panel |
0|1? |
Turn the debug panel on/off; skip the argument to toggle |
bind_key |
string, ...string |
Bind a keyboard key (by code) to a console command |
unbind_key |
string |
Unbind a keyboard key from a console command |
| Command | Arguments | Description |
|---|---|---|
timescale |
float? |
Get or set the time scale of the world clock. Default is 1.0 |
fps_limit |
int? |
Get or set the tick rate limit of the world clock. 0 means no limit |
renderers |
- | Print all renderers in the world |
debug_view |
0|1?, string? |
Turn the physics debug view on/off; skip the first argument to toggle. The second argument is a renderer name (first renderer by default) |
performance |
int?, avg|peak? |
Measure time spent per entity. Arguments: number of samples (20 by default) and avg (sort by average time) or peak (record the highest value per entity) |
| Command | Arguments | Description |
|---|---|---|
gravity |
?float, ?float |
Get or set the gravity vector. One argument sets {x: 0, y: value}, two set the whole vector. Default is 0 9.82 |
player_spawn |
float, float |
Spawn a default player character (capsule body, left/right/jump/run keys) at the given coordinates, controlling the first renderer's camera |
| Command | Arguments | Description |
|---|---|---|
gravity |
?float, ?float, ?float |
Get or set the gravity vector. One argument sets {x: 0, y: 0, z: -value}, three set the whole vector. Default is 0 0 -9.82 |
player_spawn |
float, float, float |
Spawn a default player character (capsule body, WASD/arrows movement, mouse-look) at the given coordinates, controlling the first renderer's camera |
player_mode |
string, first-person|third-person |
Switch a named PlayerCharacterController (as returned by player_spawn) between first- and third-person view |
The multiplayer package adds net_status, net_panel, net_owners, net_tuning and net_lag.
Do all physics backends behave the same?
No. Every backend of one dimension honors the same API contract: the same calls succeed (apart from
the Rapier 3D plane gap below), the same events fire, units match, and 3D is Z-up everywhere. A
shared contract test suite checks this for every backend in CI (packages/core/test/contract). The
simulation underneath is the library's own, so switching backends keeps your code running but
changes how things move. Expect to retune masses, friction, vehicles and character settings after a
switch. Known differences:
3D: Rapier vs Ammo.js
- Character controller. Rapier's own kinematic character controller does the stepping, ground snapping and pushing of dynamic bodies. On Ammo the adapter sweeps the capsule itself, with its own step-up, slope-sliding and push logic. Ledges, steep slopes and walking into props feel different.
- Raycast vehicles. Rapier's vehicle controller is a port of Bullet's, but suspension, tyre
friction and braking still differ, so the same wheel options drive differently.
rollInfluenceonly exists on Ammo andsideFrictionStiffnessonly on Rapier. Tune aGgCarEntityor raycast vehicle on the backend you ship. - No plane collider in Rapier 3D. A
PLANEbody (a primitive, a level-JSONPrimitiveor thespawnconsole command) throws on Rapier; use a large thinBOX.SurfaceFollowingEntityis built on planes, so it runs on Ammo only. - Continuous collision detection. Rapier sweeps the body's real shape; Ammo sweeps an approximating sphere, so fast bodies hitting thin geometry behave differently.
- Kinematic bodies. Rapier has native position- and velocity-driven kinematic bodies. Ammo has one
kinematic flag; the adapter emulates
kinematic_velby moving the body once per tick. - Sleeping. Both put resting bodies to sleep automatically, with their own thresholds and timing.
2D: Rapier vs Matter.js
- No CCD in Matter.
ccd: truelogs a warning and has no effect; fast bodies can tunnel through thin walls. - No kinematic bodies in Matter.
kinematic_pos/kinematic_vellog a warning and fall back to static bodies, which don't push or carry what rests on them when moved. - Sleeping. Matter bodies never fall asleep on their own (
sleep()/wakeUp()still work), and setting the position or velocity of a sleeping Matter body does not wake it. Rapier sleeps resting bodies automatically and wakes a body you move. - Character controller. Rapier's native controller vs, on Matter, one built from overlap queries over short substeps.
- Settling. Matter's solver is not substepped: round bodies on a slope under weak gravity can roll for a long time before they come to rest.
Rapier supports every BodyOptions feature natively in both dimensions.
How do I reach the native Three.js / Pixi / physics objects?
Every component keeps a reference to the native object it wraps:
nativeScene- 3D visual scenenativeContainer- 2D visual containernativeMesh- 3D display objectnativeSprite- 2D display objectnativeWorld- Rapier 2D/3D physics world (Ammo.js:dynamicAmmoWorld; Matter.js:matterEngineandmatterWorld)nativeBody- 2D/3D physics body
For instance, ThreeSceneComponent.nativeScene is the THREE.Scene once world.init() has run (null before).
TypeScript does not know the native types of my world. How do I fix that?
The engine is strictly typed and works abstractly over whichever adapters are plugged in, so TypeScript cannot always infer adapter-specific types from the constructor alone:
const world = new Gg3dWorld({
visualScene: new ThreeSceneComponent(),
physicsWorld: new AmmoWorldComponent(),
});
const box = world.addPrimitiveRigidBody(...);
box.object3D!.scale = { x: 2, y: 2, z: 2 }; // ok
box.object3D!.nativeMesh.castShadow = true; // TypeScript errorAnnotate the world explicitly:
const world: TypedGg3dWorld<ThreeGgWorld, AmmoGgWorld> = new Gg3dWorld({
visualScene: new ThreeSceneComponent(),
physicsWorld: new AmmoWorldComponent(),
});
const box = world.addPrimitiveRigidBody(...);
box.object3D!.nativeMesh.castShadow = true; // works: a THREE.Object3D
box.objectBody!.nativeBody.applyTorque(new Ammo.btVector3(0, 0, 1)); // works tooEvery adapter exports a [ModuleName]GgWorld type. const world: ThreeGgWorld = new Gg3dWorld(...)
types the visual side for Three.js and leaves physics abstract; TypedGg3dWorld<Visual, Physics>
welds a visual and a physics world type together (TypedGg2dWorld does the same in 2D).
The audio world type is an optional third parameter, in that order - visual, physics, audio. Leave
it out and world.audioScene is typed as the abstract audio scene; pass it to get the native types
of the audio adapter as well:
import { WebAudioGgWorld3D, WebAudioScene3dComponent } from '@gg-web-engine/audio';
const world: TypedGg3dWorld<ThreeGgWorld, AmmoGgWorld, WebAudioGgWorld3D> = new Gg3dWorld({
visualScene: new ThreeSceneComponent(),
physicsWorld: new AmmoWorldComponent(),
audioScene: new WebAudioScene3dComponent(),
});Can I use it with React, Angular, Vue or Svelte?
Yes - the engine only needs a <canvas>. Create the world in a lifecycle hook once the canvas
exists (useEffect, ngOnInit, onMounted), and call world.dispose() on teardown.
Why is the viewport off-center or blurry on mobile/retina displays?
Add this meta tag to your <head>:
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1, maximum-scale=1">The engine is young and still changing. Releases so far are 0.0.N, and the public API can change
between any two of them. Starting with 0.1.0, releases follow this versioning policy:
- Breaking changes come only in a minor release (
0.1.xto0.2.0). A patch release (0.1.0to0.1.1) only fixes bugs and adds backwards-compatible API, so^0.1.0inpackage.jsontakes only safe updates. - Every breaking change is listed in
CHANGELOG.mdwith a migration note: what to change in app code, or what to retune. - A change in how a physics backend simulates (sleep thresholds, contact tuning, solver settings) that a game would have to retune counts as breaking.
- The public API is what the packages export and document. The dev console (
GgStatic) and the wrapped libraries' native objects (nativeWorld,nativeBodyand the like) are outside it: a library upgrade is listed in the CHANGELOG, but its own API changes are that library's. - All
@gg-web-engine/*packages share one version. Upgrade them together; each adapter requires the exact core version it was released with.
The engine began as the foundation of The Need For Speed Web, where the physics backend was swapped more than once - which is where the library-agnostic architecture comes from.
CHANGELOG.md- what changed in each releasemilestones.md- the public roadmap and known gaps
Bug reports, feature requests and pull requests are welcome.
- Open an issue for a bug or an idea.
- Read
CONTRIBUTING.mdfor the build, test and release process.
Local setup in short - packages/* is an npm workspace, so one install links every adapter to the
local core:
npm install # link the packages/* workspace
npm run build # full build of every package
npm run build:watch # rebuild core + adapters on every saveTo see your changes live in an example app:
bash etc/switch_example_to_local_gg.sh examples/3d/<example-dir>
cd examples/3d/<example-dir> && npm startUndo the link with bash etc/restore_example_from_local_gg.sh examples/3d/<example-dir> before
committing.
If the engine is useful to you, a ⭐ on the repo helps others find it.

