Tlapalli
Open source · by Tlapalli

Ollin

The 2D game engine that leaves the frame budget to your game.

A TypeScript engine for the web with a data-oriented core and a small, friendly API. Ollin (say OHL-leen) is Nahuatl for movement.

npm create ollin@latest my-game

MIT · @tlapalli/ollin 0.1 alpha · TypeScript

The Nahui Ollin glyph turning like a machine, with small sprites orbiting it
Try it

This is the game you start with

npm create ollin gives you this game in about 100 lines you can read in one sitting. It is running here on the published package.

Mouse or finger: hold where the xolo should go. Keyboard: click the game, then ← → .

Small API

Entities, components, systems. That's the whole idea.

An entity is a number. A component is a typed array you index by that number. A system is a function that runs every frame. Everything else (rendering, input, physics) comes from plugins that are plain functions too.

Read the guide →

import { createGame, defineComponent, f32, input, Position, Renderer, Sprite, webgl2 } from '@tlapalli/ollin'

const game = await createGame({ canvas, size: 'auto', plugins: [webgl2(), input()] })
const texture = await game.get(Renderer).loadTexture('xolo.png')
const Velocity = defineComponent({ x: f32, y: f32 })

game.world.spawn([Position, { x: 100, y: 100 }], [Velocity, { x: 60 }], [Sprite, { w: 32, h: 32, texture }])

const moving = game.world.query(Position, Velocity)
game.system((dt) => {
  for (const e of moving.entities) {
    Position.x[e] += Velocity.x[e] * dt
    Position.y[e] += Velocity.y[e] * dt
  }
})
game.start()
Performance

Faster than PixiJS and Phaser

Main-thread time per frame with 20,000 moving sprites, on a CPU throttled 4× to stand in for a mid-range phone. Lower is better; a 60 fps frame has 16.6 ms in total.

Milliseconds per frame at 20,000 sprites
Ollin0.47 ms
PixiJS 8 · ParticleContainer0.62 ms
Phaser 4 · GPU layer3.87 ms
PixiJS 8 · Sprites6.48 ms
Phaser 4 · Image objects6.77 ms
All results, 1,000 to 50,000 sprites
SpritesOllinPixi ParticleContainerPixi SpritesPhaser GPU layerPhaser Image
1,0000.03 ms0.04 ms0.18 ms0.17 ms0.24 ms
5,0000.09 ms0.12 ms1.16 ms0.95 ms1.64 ms
10,0000.14 ms0.23 ms2.48 ms1.9 ms2.83 ms
20,0000.47 ms0.62 ms6.48 ms3.87 ms6.77 ms
50,0001.32 ms1.58 ms18.7 ms10.59 ms23.93 ms

PixiJS 8.23 and Phaser 4.2.1. Pixi's ParticleContainer moves positions only; Ollin keeps per-sprite tint, alpha, flip, rotation and frame live. Chromium with vsync on, Apple M4 Max, CPU throttled 4×. Reproduce it with examples/bench in the engine repo.

Batteries included

Everything a 2D game needs, nothing it doesn't

  • Data-oriented ECS

    Components are typed arrays the shaders read as they are. No objects per sprite, no packing, no garbage per frame.

  • WebGL2 and WebGPU

    One renderer core, two backends with the same API and output. WebGPU falls back to WebGL2.

  • Smooth on 120 Hz

    A fixed-step simulation, drawn interpolated, so motion stays smooth on any display.

  • Rapier physics

    Dynamic, fixed and kinematic bodies through WASM, as an optional plugin.

  • 2.5D and Tiled

    z layers, y-sorted layers, and orthogonal or isometric maps from Tiled.

  • GPU particles

    Bursts computed entirely in the vertex shader: zero CPU work per frame. Additive layers make them glow.

  • Aseprite atlases

    Packed spritesheets from Aseprite or TexturePacker, trimmed frames included, with tags as ready animations.

  • Declare once

    List textures, sounds, fonts and maps in a .ollin file; the Vite plugin loads them typed and checks every path.

  • Text with accents

    Bitmap text from any web font, with á, ñ, ¿¡ and Nahuatl macron vowels.

  • Hot reload and devtools

    Save and the scene restarts in place. Inspect any sprite with one click.

  • Every input

    Keyboard, mouse, multi-touch and gamepads as plain state you read in your systems.

  • Tweens and timers

    Animate any component field with easing, or run code later, without callbacks to clean up.

Start a game in one command

npm create ollin@latest my-game
Follow the tutorial