Introducing Mothlight

Mothlight is a hedge-maze chase that runs in the browser, on a computer or a phone. Gather every dewdrop in a moonlit maze while four garden spiders hunt you, dazzle them with lantern blooms and escape with Flutter. It is now one of the games on this blog.

Some author5 min read

Mothlight is a maze chase that runs in your browser, with nothing to install. A moth gathers dewdrops through a moonlit hedge maze while four garden spiders hunt it, each with its own way of hunting. Lantern blooms dazzle the spiders for a while, and Flutter gives the moth a short burst of speed.

It joins the games here, alongside Hollow Core, Nova Pinball and Island Flight.

Play Mothlight

A night in progress: the lanterns have dazzled the spiders, which turn pale and drift away

Gather every dewdrop

A night is cleared when the last dewdrop is gone. Dew sits on almost every open tile of the maze, so the moth is always eating its way through the hedges. Each dewdrop is worth five points.

The maze has four lantern blooms, mirrored from left to right. Each one is worth 40 points, and eating one dazzles the spiders. A bloom you leave uneaten when the last dewdrop goes is worth 300 points more.

Nectar blossoms also appear during a night, two at most, after a short wait. A blossom is worth more on later nights, up to 1,600 points.

Four spiders, four styles

The title card introduces the spiders, and each one hunts differently:

The title card: the four spiders and what each one does

  • Tracker always knows the shortest path to the moth.
  • Cutter looks ahead along the moth's heading and heads for the next junction, to cut it off.
  • Sentry guards the richest quarter of the maze. It chases you within six tiles, and when less than a twelfth of the dew is left it goes back to its corner.
  • Skitter wanders at random until it sees the moth down a straight corridor. Then it crouches for a moment and lunges.

A night alternates between two phases. In a prowl the spiders go back to their corners. Skitter does too, though now and then it wanders instead. In a hunt Tracker and Cutter come after you, and Sentry chases you when you are close. Prowls get shorter and hunts get longer as the nights go by, and each change turns the roaming spiders round.

Lanterns and the dazzle

Eating a lantern bloom dazzles every spider except the ones you have already sent home. A dazzled spider flees, moves more slowly, and turns its eyes into crosses. The dazzle lasts seven seconds on the first night and gets shorter on each night after, down to two and a half seconds. As it runs out, the spiders flicker orange as a warning.

You can bump a dazzled spider to send it home. The first bump is worth 150 points, the next 350, then 600, and every bump after that is worth 1,000. A new lantern bloom starts the count again.

Flutter

Flutter is a burst of speed: the moth moves about 1.7 times faster for two-thirds of a second. It is ready again four seconds after you start it, so the next one is about three and a third seconds after the first ends. A press during the cooldown is dropped.

Lives and scoring

You start with three lives and can hold up to five. An extra life comes at 6,000 points, then at 20,000 and at 34,000.

A spider that is roaming, and not dazzled, can catch the moth. The moth freezes, spins, and loses one life. The dewdrops it has eaten and the score stay, and the spiders return to the nest. When the last life goes, a game-over card shows your score and your best. It says "New best" if you beat it. The card returns to the title screen by itself after about 25 seconds.

Controls

KeyAction
Arrows or W A S DFly. A tapped turn is remembered for a short time, until you reach a gap. A held key always turns you at the next gap
X, Shift or KFlutter
Space, Z or JFlutter during a run; start from the title or game-over card
EnterStart from the title or game-over card
P or EscPause and resume
MSound on or off

The game also pauses when the page is hidden or when focus leaves it during a run. It does not pause on the title screen.

Phones and tablets

On a phone or tablet the page shows on-screen controls. In portrait, a round pad sits at the lower left, with START and BOOST at the lower right. On a phone held sideways, the pad, the picture and the buttons sit side by side. Taller screens, such as a tablet held sideways, keep the picture on top with the controls below it.

Mothlight on a phone, with the pad at the lower left and the START and BOOST buttons at the lower right

Swipe on the picture to steer, and the moth keeps going in that direction until you lift your finger. Tap the picture to start. BOOST is Flutter during a run, and it also starts the game from the title card.

Saved in your browser

Your best score is kept in your browser. There is no server, so nothing leaves your computer. Sound starts with your first press or tap in the game, and the Sound button or M turns it off. That choice is not saved.

Every visit starts from a new random maze. If you want the same maze each time, add a number to the address, for example game_mothlight.html?seed=7.

How it's built

Mothlight is drawn on a small canvas, with no libraries. The sprites are small pixel maps painted by code, and the sounds are oscillators and filtered noise from the Web Audio API.

The game logic doesn't touch the page, so the tests run under plain Node. There are 141 of them. They check that the same seed and the same inputs always give the same game, that drawing never changes the game state, that every maze is connected with no dead ends, and that the spiders behave as described above. Two long tests play 20,000 frames each, one with the page's demo bot and one with random button presses, to make sure nothing breaks.

Mothlight's code lives in web/games/mothlight/ in this blog's repository.