StianØyna

Software developer, Norway

Projects / 2026

mini2d

A tiny TypeScript 2D game engine, and the games built on it.

Open projectView source

A dependency-free 2D game engine for the browser in about 600 lines of TypeScript, and a small arcade of games made with it. So far that’s Snake, Pong, Starfall (a vertical space shooter), Coastline (a road racer in the style of the arcade classics), Chomp (a Pac-Man-style maze game) and Blockdrop (Tetris-style falling blocks), with more to come.

  • Fixed logical resolution: games draw in their own units (360 × 600 here); the engine scales that to any screen, letterboxes the rest, and stays sharp on high-density displays.
  • Fixed timestep: game logic runs at a steady 60 steps a second whatever the display does, so it plays the same everywhere.
  • Scene stack: menus, games and pause screens are scenes; a pause screen lets the game show through underneath.
  • Input and sound: keyboard, mouse and touch (including swipes) are polled once per step, and sound effects come from a tiny Web Audio synth, so there are no assets at all.

Play with the arrow keys or WASD, or by swiping and dragging on a phone. P or Space pauses, Esc goes back to the menu, and each game has its own link: Snake, Pong, Starfall. Pong plays against the computer on easy, medium or hard, or two people on one keyboard or screen (bottom on the arrows, top on A and D), or two people on their own devices: one starts an online match and shares a link, and each sees their own paddle at the bottom. In Starfall the ship fires on its own: steer it with the keys, or drag below it with a finger. Each level is a few waves and a boss, and every level brings tougher enemies, with a new kind in each of the first four. Destroyed enemies drop power-ups: a stronger gun, homing missiles, a shield and extra lives. It has easy, medium and hard settings, and online co-op: one phone starts a game and shares a link, and the two ships fly together, each phone steering its own while the starting phone runs the game and streams it to the other through a relay on the site’s Worker.

Coastline races the clock along a pseudo-3D road: five stages from a pyramid of fifteen, picking left or right where the road splits, past traffic, through bends that need a lift at full speed.

Chomp follows the arcade original closely: the same maze and dot count, four ghosts that each hunt in their own way, scatter and chase waves, power pellets, fruit, and speeds that rise level by level. Swipe or use the arrow keys; a turn asked for early is taken at the next opening.

Blockdrop is falling blocks in the modern style: a fair bag of seven pieces, wall kicks, hold, a ghost piece and a short grace period before a piece locks. The well can stand upright, or lie sideways with the pieces travelling left to right to fill a landscape screen. Easy, medium and hard start at different speeds, and hard shows only the next piece and no ghost. Drag to move, tap to turn, flick to drop; on a keyboard, the arrows, Space and C.

The music is original too, and just as asset-free: tunes written as note patterns and played by the engine’s own synthesiser, with a song for every game, a radio to choose from in Coastline and a boss theme in Starfall. Coastline’s engine is synthesised as well, its pitch following the revs through the gears.

The engine lives in libs/mini2d and the games in apps/mini2d, both tested with Vitest.