GAMA

three.js renders. GAMA makes it a game.

Steering agents · flocking · navmesh pathfinding · behavior trees ·
cameras · input · collisions · tweens · optional rapier physics & React bindings

npm install gama3d three

Everything three.js leaves out

MotionAgent · 12 behaviors

Motion agents

Composable steering: seek, flee, arrive, pursue, evade, wander, flocking, path-following, obstacle avoidance — weighted and swappable at runtime.

NavMesh · generateNavMesh · goTo()

Navigation

A* + funnel pathfinding over triangle meshes — hand-authored or baked straight from your level geometry with slope, step and agent-radius rules.

BehaviorTree · StateMachine

AI that scales

Reactive behavior trees with interruption built in, plus finite state machines for simple modal logic. Actions swap steering behaviors; conditions read the world.

Game · World · GameObject · Component

A real game loop

Variable + fixed timestep, entities that are Object3Ds, typed events, object pooling, and safe mid-frame destruction.

Input · ActionMap · 3 camera rigs

Feel

Keyboard/gamepad input with named rebindable actions, character controllers, and follow/orbit/shoulder cameras with smoothing and occlusion.

gama3d/rapier · gama3d/react

Optional power-ups

A rapier adapter (rigid bodies + a stair-climbing character controller) and react-three-fiber bindings — separate entry points, zero cost if unused.

DebugOverlay · F3

See what agents think

Velocity and steering-force arrows on every agent, collider wireframes, and an FPS/entity/draw-call panel. Steering bugs stop being invisible.

Catalog · Level · Editor

Levels you can edit

A level file is placements, not geometry — so it round-trips exactly, keeps kinds your build has never heard of, and loads by running your factories again. The editor on top is a real one: palette, inspector, grid snapping and undo.

423 tests · ESM + CJS + d.ts

Small & honest

Zero dependencies beyond three. A GameObject is a THREE.Object3D — the whole three.js ecosystem works unchanged.

Ten lines to a chase

import { Game, MotionAgent, Seek, CharacterController, FollowCamera } from 'gama3d';

const game = new Game();
const player = game.world.spawn('player');
player.addComponent(new CharacterController(game.input, { speed: 8 }));

const enemy = game.world.spawn('enemy');
enemy.position.set(10, 0, 10);
enemy.addComponent(new MotionAgent({ maxSpeed: 5, planar: true }))
     .addBehavior(new Seek(player.position));

game.start();

Run something like it in the playground →