BLIT386BLIT386

BLIT386

A palette-first retro game engine for the web. Change what a color means, and everything drawn in it changes at once.

BLIT386

A palette-first retro game engine for the web. Change what a color means, and everything drawn in it changes at once.

Get startedDocumentation

BLIT386 is a palette-first retro game engine for the web. Palette-first means you draw with numbered colors rather than RGBA pixels, so changing what color 3 means recolors everything drawn in it at once: a few bytes of palette upload, and water flows or the sky goes dark without a single pixel being redrawn. TypeScript throughout, WebGPU where the browser has it, an automatic Canvas 2D fallback where it does not. The design takes its cue from RetroBlit by Martin Cietwierkowski (@daafu).

Features

Quick start

The fastest way to begin is the scaffolder. It works with npm, pnpm, yarn, or bun and generates a ready-to-run Vite project with the engine installed, a starter game, and local docs:

npm create blit386@latest my-game

Prefer to wire it up by hand or add it to an existing project? Install the package and call bootstrap():

npm install blit386
import { , , , type IBTDemo,  } from 'blit386';

class  implements IBTDemo {
  async (): <boolean> {
    // paletteCreate() returns a palette; paletteSet() installs it.
    const  = .(16);

    .(1, new (32, 0, 128));
    .(2, new (255, 220, 90));

    .();

    return true;
  }

  (): void {}

  (): void {
    .(1);
    .(new (10, 10, 40, 24), 2);
  }
}

void ();

Where to go next

The engine source lives in the blit386 repository on GitHub.

Join the community

On this page