Ollin 0.1.0-alpha.4: the last breaking release before beta
We shipped Ollin 0.1.0-alpha.3 yesterday, and today we’re shipping alpha.4. That’s fast, but it’s on purpose: alpha.4 is the last release that breaks the API before beta.
Why break things now
Beta freezes the API as it stands after alpha.4. From then on it only grows: new functions and options are fine, but an existing one changes only to fix a bug, and that change gets documented. Before that freeze we went through every public export and asked whether a beginner could guess how it works from how the rest of the engine works. Where the answer was no, we changed it now, while few people build on it, instead of living with it for years.
The rules that came out of that review are short:
- Functions that act on the game take it first:
tween(game, ...),spawnText(game, ...),attach(game, ...),loadTilemap(game, ...). - Loaders are singular for one asset and plural for a typed manifest:
loadTexture/loadTextures,loadSound/loadSounds. - Colors are
0xRRGGBBnumbers everywhere, including the background:webgl2({ background: 0x120d17 }). - Lookups that find nothing return
-1. - The public API is exactly what the package’s index lists. Internals like the renderer backend interface are no longer exported, so they can keep improving.
Every breaking change has a one-line migration in the changelog.
What games asked for
We make small games with Ollin to find out what’s missing. These are the things they kept asking for:
camera.follow(player, { lerp: 0.1 }) // trails the player where it's drawncamera.bounds = { x: 0, y: 0, width: map.width, height: map.height }camera.shake(8)
const clicked = entityAt(game, input.pointer.x, input.pointer.y) // -1 if nothing is there
map.moveAndCollide(player, vx * dt, vy * dt, 'walls') // tile collision, no physics engineAnchorsets which point of a sprite sits on its position: feet for characters, the corner for UI. Collisions, picking and y-sorting use it too.- Shapes:
Circleturns a sprite into a smooth disc,spawnLinedraws lines, andrenderer.createTextureturns any Canvas 2D drawing into a texture. withProgresswaits for your loads likePromise.alland reports progress for a loading bar.- Music:
audio.playMusic(url)streams long tracks instead of decoding them whole, with separate music and sound volumes and stereo pan. pixelArt: truemakes every texture, atlas and font use nearest filtering, so pixel art games set it once.
Did it cost frames?
Benchmarks are our regression test: every change that touches the renderer gets measured against the previous release and against other engines. The new features add fields that the shaders read, so we checked they cost nothing when a game doesn’t use them. Against alpha.3, WebGL2 at 1,000 to 100,000 sprites didn’t change, and neither did WebGPU at 20,000 to 50,000. A y-sorted scene at 20,000 moving sprites stayed within 1–2%.
Here is main-thread work per frame for the same bouncing-sprite scene, in Chromium with the CPU throttled 4x to approximate a mid-range phone (median of 3 runs):
| Sprites | Ollin | PixiJS ParticleContainer | PixiJS Sprite | 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.90 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.70 ms | 10.59 ms | 23.93 ms |
Times under a millisecond are noisy, so we measure across sessions too. At 20,000 sprites, PixiJS’s ParticleContainer ranged from 0.41 to 0.95 ms between sessions, while Ollin stayed between 0.34 and 0.45 ms. And Ollin’s sprites keep tint, alpha, flip, rotation and animation frame free to change every frame, which the ParticleContainer gives up to be fast. The benchmark lives in examples/bench, so you can run it yourself.
Try it
npm create ollin@latest my-gameThe getting started guide walks through the code, and the guide covers the rest. Next is beta, plus testing on real phones and browsers: iOS Safari, Android and Firefox.
