Ember Isle build log - WordPad
✕
C:\ar9av\builds\EMBERISL.TXT
  1. Desktop
  2. Build Log
  3. Games

Build log · Games

How I built Ember Isle

An 8-bit island adventure in Phaser 3 where every pixel of art is drawn in code

Screenshot of Ember Isle running in the portfolio
Ember Isle, running on the desktop. Open it yourself →

1.Why I built it

I wanted a small Zelda-like top-down adventure on the desktop, set on one island that gets more dangerous as you climb from the beach to the volcano. The first version had five biomes, five weapons, kill quotas and a Magma King boss.

A later update brought it to eight levels with Desert Dunes, Murky Swamp and Crystal Caves. It also added a bow with piercing arrows, a frost staff that freezes foes and a war axe with a spin attack, plus bats that fly over walls and water, scorpions with a telegraphed lunge, and ghosts that fade out and become untouchable.

2.How it works

A self-hosted Phaser build in an iframe

Ember Isle is a standalone Phaser 3 game built separately and copied into public/ember-isle. The desktop opens it in a window as an iframe, the same pattern I use for SkiFree and Backrooms. That keeps Phaser's bundle and its global input handling out of the Next.js app.

Each level is a plain config object: name, biome, seed, liquid type (coast, river or lakes), grass ratio, kill goal, minimum live enemies, an enemy mix, the weapon you find there, prop lists, and rectangles for plateaus and mesas. The final level, The Crater, sets boss: "MAGMA KING" with a kill goal of one.

Terrain from noise, painted per pixel

Each map is 64 by 40 tiles of 16 px. Terrain comes from a seeded Mulberry32 PRNG, an integer hash, and smoothstep-interpolated value noise summed over two octaves. The plateau and mesa rectangles from the level config are raised over that.

The ground is not tiled. It is painted pixel by pixel into an ImageData buffer. Distance fields from the water and the cliffs decide where foam, sand edges, grass rims and cliff-face bands go, and a final pass scatters pebbles and grass tufts. The solid-tile grid for collision is then sampled from the centre of each 16 px tile of that painted map.

Sprites drawn from shape functions

There are no image files. A tiny sprite class holds a width, a height and an array of colours. Sprites are made in one of two ways. fill((x, y) => colour) evaluates a function per pixel, using ellipse equations or a point-in-polygon test, and fromGrid reads string rows against a palette. outline() then adds a dark one-pixel border around every filled region.

Biomes reuse the same art through palette maps. The desert, swamp and crystal biomes each have a table that swaps the base greens, pinks and oranges for their own colours, so one bush or rock definition covers every level.

Chiptune from square waves

The sound is a single helper that starts an oscillator with an exponential pitch slide and an exponential gain decay. Music is arrays of MIDI note numbers converted with 440 * 2^((n − 69) / 12) and scheduled one step at a time. Sound effects such as swing, hit and hurt are just different start and end frequencies and waveforms.

Mobile browsers only allow audio after a user gesture, so the host page wraps the AudioContext constructor to keep track of every context the game creates, and resumes them all on the first tap. Progress is saved to localStorage.

A gamepad that fakes key presses

The game only reads the keyboard, so it was unplayable on phones at first. The fix lives in the host HTML. On touch devices it shows a d-pad and A, B, weapon and mute buttons, and each one dispatches synthetic KeyboardEvents with the right keyCode. The d-pad tracks one finger, so you can slide between directions, including diagonals.

The layout has portrait and landscape variants. In landscape the game fills the screen and the controls float semi-transparent over the sides.

3.Try it

Arrow keys to move, Z to attack, X to dash, Q and E to switch weapons, M to mute; touch devices get an on-screen gamepad.

More from the build log

Ember Isle · 3 min readAll 29 builds