Glyft

Faster to write. Faster to run.

Less code. More sprites. A WebGL2 framework that moves work from your code to the GPU. Define rules instead of writing callbacks.

$ npm install glyft

Multi-room dungeon with NPCs, combat, projectiles, particles, and procedural audio. More demos →

The Idea

Most game code is boilerplate: animation state machines, collision callbacks, sound triggers. Glyft handles these declaratively so you can focus on what makes your game unique.

velocity-driven animation

A Different Approach

Traditional game code scatters logic across callbacks and update loops. Glyft consolidates it into declarative rules that the engine applies automatically.

Traditional: callbacks & state machines
Glyft: rules & velocity

Animation Without State Machines

Set velocity. The GPU picks direction, plays walk frames, returns to idle, remembers facing. No enums, no frame counters, no transition logic.

Rules Instead of Callbacks

Define what happens when things collide. No scattered onCollision handlers. No conditional chains. One place for all your game rules.

Sounds That Trigger Themselves

Player hits enemy? Sound plays. Player moving? Footsteps loop. No playSound() calls cluttering your code. Define patterns, engine handles timing.

5,000 Sprites at 60 FPS

One draw call per atlas. Animation, HP bars, labels, and particles all computed in GPU shaders. Zero per-frame allocations. 10K+ sprites still playable.

Your Game Loop Stays Clean

No animation updates. No collision checks. No sound triggers. No HP bar DOM elements. Just input, AI, and game-specific logic.

Zero Dependencies, Full TypeScript

Pure WebGL2. No runtime dependencies. Complete type definitions. Errors tell you what went wrong and how to fix it.

Complete Example

A playable game with collision, damage, knockback, sounds, and animation. Notice what's missing: no collision callbacks, no sound triggers, no animation code.

game.ts

Why It's Fast

Traditional engines update each sprite individually: advance frame, check collision, run callback. That's O(n) JavaScript work per frame.

Glyft batches everything. All sprites using the same atlas render in one draw call. Animation frames are computed in GPU shaders, not JavaScript. The CPU just uploads positions.

1
Draw Call
60
FPS @ 5K
30+
FPS @ 10K

Ready to Build?

Full TypeScript support. Errors that tell you how to fix them. Examples you can run in seconds.