ALPHA / WIP

Gearbox2D

Web-First Physics & AI Engine powered by WebAssembly

Engine DNA

Web-First Core

C++ core compiled to WASM. Engineered for zero-copy memory sharing with TypeScript, eliminating the JS-bridge bottleneck for massive object counts.

Server Sync Stability

Designed for authoritative server architectures. High stability during real-time state injections, perfect for multiplayer rollback and state sync.

AI & Pathfinding

Built-in support for NavMeshes, RVO/ORCA, and A* pathfinding running at native speeds within the physics loop.

Data-Oriented Design

Contiguous memory layouts and BVH spatial partitioning ensure maximum cache hits and sub-millisecond query times.

Live HUD Preview

Real-time physics calculation at sub-millisecond speeds.

EXPLORE FULL SUITE

Ready to build?

Integration is simple and unopinionated. Start building high-performance physics simulations with a developer experience that prioritizes clarity and speed.

import gearbox from 'gearbox2d';

async function start() {
    // Initialize the WASM core and prepare shared memory. Call this once.
    await gearbox.init();

    const world = gearbox.makeWorld();

    // Add a ground box
    const ground = world.makeBody(1, {
        x: 0, y: 10,
        type: gearbox.bodyTypes.FIXED_OBJECT
    });
    ground.addFixture(1, {
        width: 20, height: 1,
        shape: gearbox.shapes.BOX,
    });

    // Basic simulation loop
    let lastTime = performance.now();
    let accumulator = 0;
    const physicsStep = 1/60;

    function loop(now) {
        let dt = (now - lastTime) / 1000;
        lastTime = now;
        if (dt > 0.25) dt = 0.25;
        accumulator += dt;

        while (accumulator >= physicsStep) {
            world.step();
            accumulator -= physicsStep;
        }
        world.interpolationAlpha = accumulator / physicsStep;
        requestAnimationFrame(loop);
    }
    requestAnimationFrame(loop);
}

start();
View API Reference npm install gearbox2d

Engine Specs

Optimized for modern browser environments with SharedArrayBuffer and multi-threaded potential.

(Benchmarks coming soon...)

Open Source Core

Gearbox2D is community-driven. Explore the source and contribute to the physics revolution.

Repository