Games · Three.js · Testing

In Last Flame, time is your health, your fuel and your score. To keep nine levels fair, a bot plays every one of them with the game's own physics on every test run.

·3 min read·Appna Studio

Last Flame was made for a game jam with the theme Everything is Temporary. You play a small flame with only seconds to live. Your life drains one second at a time; every lamp you run through gives some back — a diya three seconds, a candle five, a lantern eight. Double-jumping and dashing each cost a second. Paper platforms catch fire under you, wax sinks, glass blinks out, wind and rain speed up the drain.

When time is health, fuel and score all at once, level design gets fragile. Move a lamp half a metre and a level that felt tense might become impossible. We did not want to find that out from players, so we made a bot play the game.

The bot plays the real game

The important decision was that the bot does not have its own simplified idea of the world. The game's rules and levels live in shared modules — the same code the browser runs — and the test drives a flame through each level with the game's own physics: the same gravity, jump heights, coyote time, lamp values and drain rates a player gets.

For every one of the nine levels, the test proves three things:

  1. The level can be finished before the flame burns out.
  2. It can be finished through its checkpoint, so the respawn point is never a trap.
  3. It can be finished with slack — the bot never squeaks through on its last tenth of a second, because a human will not be that precise.

If a change to a platform, a lamp or a rule breaks any of those, the test fails before the change ships.

The difficulty curve is a number

Because the bot reports the lowest life it reached in each level, difficulty stops being a feeling and becomes something we can read. On the first level the bot never drops below about eleven seconds of life. By levels eight and nine it gets down to about three. Gaps widen, platforms shrink and hazards stack up between those points — and we can see the curve rise smoothly instead of spiking.

The same idea keeps the hardest moment honest. In the final level, the route collapses behind you, one platform every 1.4 seconds. The bot survives that collapse even when it is sped up to one platform every 0.9 seconds, which tells us a determined player has real room to breathe.

Tests for the fun parts, too

The bot also checks the things that make a level worth replaying:

  • Bonus lanterns sit on platforms just off the main route. The test proves each one can be reached and left again — nobody wants a reward that is a dead end.
  • Par times for gold and silver medals are set from the bot's own time, at roughly 1.3× and 1.8×. The test checks that gold stays achievable whenever a level changes.

Watching the bot

The bot is not only a test. Adding ?level=3&auto to the game's address loads the third level and lets the bot play it in front of you, so you can watch the exact route it found. That turned out to be one of the most useful design tools we had: when a jump looked unfair, we could see whether the bot needed a pixel-perfect line to make it.

Why bother, for a game jam?

Because it made us faster. With the bot guarding fairness, we could tune lamps, platforms and hazards boldly and let the tests tell us when we had gone too far. The game shipped with nine levels, a ghost of your best run, medals, gamepad support and a single-file download that plays without a server — and every level had already been beaten before anyone else saw it.

We bring the same habit — automated proof instead of hoping — to every game and product we build. Play Last Flame, or tell us about your idea.

Free · 30 seconds · No sign-up

How fast is your website on a phone?

Get your score, what Google can’t read, and the three fixes that matter, as a PDF in your inbox.

Check my website →
06Contact

Tell us what you’re building. Every enquiry gets a considered reply with honest thoughts on scope, approach and timeline.

Need an official quote? Attach your RFQ (request for quotation) or project brief to the form, and we’ll reply with a formal, itemised quote.

I’m interested in