Reactive 2D game engine · built on PixiJS

Build 2D games from ready-made components.

CanvasEngine is more than a renderer. Describe your game as reactive .ce components, then plug in the systems it needs: tilemaps, cameras, controls, day & night, weather, particles, shadows, sound and UI.

$npx degit RSamaium/CanvasEngine/starter my-game
DayNightCycle · SpriteShadows · Weather
DayNightCycle · SpriteShadows · Weather
Fx · limitBurst
Fx · limitBurst
Weather · light rays
Weather · light rays
GroundEffects · Footprints
GroundEffects · Footprints
  • 20+components
  • 55FX presets
  • 39weather presets
  • 15+directives

A scene is a component

A living world in a few lines

No render loop to write, no manual syncing between state and pixels. Each system is a component you place in the scene, configured with props that can be plain values or signals. Change the hour, the world follows.

  • Declarative .ce templates with @if / @for
  • Signals everywhere: props, positions, weather, time
  • Directives for behavior: controls, drag, sound, shake
  • Plain Vite + TypeScript, hot reload included
town.ce
<Canvas>
  <Viewport worldWidth={1920} worldHeight={1440}>
    <Sprite image="town.webp" />
    <SpriteShadows ambientLight={sun} lights={lamps} />

    <Sprite image="hero.png" x={x} y={y}
      controls={keys} viewportFollow shadowCaster />

    <DayNightCycle time={clock.time} lights={lamps} />
  </Viewport>
  <Weather preset="autumnGust" />
</Canvas>

<script>
  const clock = useGameClock({ time: 18, speed: 10 })
  const sun = computed(() => sunShadowAt(clock.time()))
</script>
Result: a town at dusk with falling leaves, walking characters and shadows

From primitives to game systems

Three layers, use as much as you need

Start low-level with reactive primitives, or build a whole RPG world from presets. Every layer is made of the same reusable components, so your own become first-class too.

Where it fits

A game engine that feels like modern web development

Compared to PixiJS alone

Same fast WebGL renderer underneath. CanvasEngine adds the missing layer: a component model, reactivity, input, audio, cameras and ready-made game systems.

Compared to classic JS game frameworks

Scenes are declarative components instead of imperative update code: state lives in signals, the screen follows. Presets bring RPG-grade visuals out of the box.

Compared to full editors

No editor, no export step: it lives in your Vite + npm stack, mixes freely with HTML UI, and ships as a regular web app.

PixiJS v8 renderingTypeScriptVite & HMRTiled mapsKeyboard · gamepad · touchCanvas + HTML UIMIT license

Try it now

Play, then read the code

A complete mini-game in one component. Use the arrow keys, then switch to the code view and change anything.

Crystal Rush

A playable CanvasEngine mini-game.

Preview

Works great with AI

Your coding agent knows the engine

Install the CanvasEngine skill and your assistant writes idiomatic .ce scenes, controls, tilemaps and presets instead of guessing.

$npx skills add https://github.com/RSamaium/CanvasEngine

“Create a top-down RPG village at dusk with a playable knight.”

Start with a scene. Grow it into a game.