Making ZigZag a Country Challenge
zigzagdevlog

Making ZigZag a Country Challenge

How we turned an open-source ZigZag game into a country challenge, from a scoring loophole to saved runs and a stubborn leaderboard cache.

We wanted a game you could open, play, and use to challenge another country's score without creating an account or choosing a nickname. A flag and one good run would be enough.

ZigZag looked like a good starting point. Michael Kolesidis's open-source game already had an easy-to-understand idea: a ball moves along a narrow blue path, and each tap changes its direction. We adapted that game for Slope Game Box. The original project and the source for our edition are linked on our source page.

Adding a country label was straightforward. Deciding what a score meant, keeping it through a failed connection, and getting the same result onto the homepage took considerably more work.

100 points without leaving the platform

Our first scoring check changed the project. In the original build, turning added a point. We could send 100 turns while the ball was still on the starting platform and get a score of 100.

For a personal score counter, that was an oddity. For a country competition, it would make tapping more valuable than surviving the course.

An early test of the original ZigZag shows 100 points while the ball remains on the wide starting platform.
The original build during our scoring check. The counter reached 100 without a run down the narrow path.

We changed the scoring to follow progress: one point for reaching a new path tile and one for collecting a gem. Turning alone earns nothing. Crossing the same tile again does not earn another point either.

That made the risk easier to understand. A gem can help, but reaching the next stretch of path is still worth something. The score now follows the run you can see.

One run for a country to beat

We considered adding every player's scores together, using a country's top ten runs, or calculating an average. Each choice creates a different competition. A total rewards repeated play and a large group; an average raises awkward questions about which attempts belong in it.

We chose the highest verified single run for each country. A better run replaces that country's record. Repeating a lower score does not add points to the board.

That gave the game a clear target. You can work on your personal best, and a strong enough attempt can move your country up the standings. You do not need to assemble a team or keep playing simply to contribute more attempts.

A record we could replay

The server needed more than a number sent by the browser. We wanted to check whether the reported run could actually produce that score under the game's rules.

This meant separating the rules from the picture on screen. The original game mixed movement, scoring, and other behaviour into its display code. We rebuilt the rules so the browser and server could run the same calculation.

Each run has a seed that lets us recreate its course. We also record when the turns happen. Put those together, and the server can replay the ball's route, count its tiles and gems, and check where the run ended.

Timing mattered here. A screen drawing 144 frames a second should not change the result compared with one drawing 30. We gave the game rules a fixed clock and checked that the same recorded turns produced the same outcome at different display rates.

A finished run still had to reach the board

Then we deliberately broke the connection. We finished runs offline, refreshed the page with a result waiting, and tested failures while a result was being saved.

The awkward case was a run the server had already accepted when the reply failed to reach the browser. From the player's side, it looked unfinished. Sending it again needed to confirm the same result, without creating another one.

We gave each run its own identifier and made repeat submissions return the existing result. The browser also keeps a pending run locally and offers a retry after the connection returns. In our checks, the pending result survived a page refresh and was accepted after we reconnected.

A local mobile test shows a saved run waiting to send, with a Retry saved scores button below the game.
A pending result in the mobile prototype, with a button to retry once the connection returned.

The last surprise was an old leaderboard

During launch checks, we submitted a test record and then restored the board. A fresh request showed the restored standings, but an ordinary visit to the homepage could still show the test leader.

The scores in storage were correct. The browser was allowed to reuse a leaderboard response for four hours. That was long enough for the homepage and a newly checked result to tell different stories.

The country leaderboard during launch testing, with Japan at 47 points and the United States at 43.
A launch-day check using test scores. Removing this result exposed the stale response on the homepage.

We stopped the browser from storing that response and kept only a short, 60-second cache on the server. The board can still take a moment to catch up, but it should not keep an old test state around for hours.

The finished experience is simple: tap to turn, stay on the path, and see whether your run beats the country's best. Getting there meant changing what earned a point, rebuilding how a run could be checked, and handling the gap between finishing a game and seeing its result.

Play our ZigZag country challenge.

By Harry · Published on November 17, 2026
Copyright © 2026 Slope Game Box. All rights reserved.