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
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 ← → .
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.
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()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.
All results, 1,000 to 50,000 sprites
| Sprites | Ollin | Pixi ParticleContainer | Pixi Sprites | Phaser GPU layer | Phaser Image |
|---|---|---|---|---|---|
| 1,000 | 0.03 ms | 0.04 ms | 0.18 ms | 0.17 ms | 0.24 ms |
| 5,000 | 0.09 ms | 0.12 ms | 1.16 ms | 0.95 ms | 1.64 ms |
| 10,000 | 0.14 ms | 0.23 ms | 2.48 ms | 1.9 ms | 2.83 ms |
| 20,000 | 0.47 ms | 0.62 ms | 6.48 ms | 3.87 ms | 6.77 ms |
| 50,000 | 1.32 ms | 1.58 ms | 18.7 ms | 10.59 ms | 23.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.
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.
