Dev Log: How the Arcade High Score Boards Work

Few things in gaming feel as good as seeing your name near the top of a high score list. Every game in the KaeIce Games Arcade now has a global top-10 board next to it. This post explains how those boards work, from the moment you finish a run to the moment your name appears, and what I do to keep them fair and friendly.

Two kinds of high scores

There are actually two layers of high scores in the Arcade.

The first is your personal best. Every game remembers your best score in your own browser, using local storage. It shows up on each game card on the Arcade page and in the toolbar while you play, and the game-over screen shows your score next to your best, with a “New best!” highlight when you beat it. This works even if you’re offline, and it never leaves your device.

The second is the global top 10. When you open a game, a panel beside it loads that game’s current leaderboard. On a big screen it sits to the right of the game, and on a phone it appears just below. Your personal best always stays in place as a backup, so if the leaderboard can’t be reached for any reason, the game keeps working and the panel simply shows your best on that device.

What counts as a score

Most games rank the highest score. A few are special:

  • Color Sort ranks the highest level reached.
  • Neon Flap counts the number of gaps you fly through.
  • Daily Word has a separate board for each day. It ranks players by the fewest guesses, so a two-guess solve beats a four-guess one. Only a puzzle you actually solved in that session can be submitted.

When two players tie, the one who submitted first stays ahead.

Entering your name

When a run ends, the game checks whether your score would make the current top 10. If it would, the game-over screen tells you where you’d land, for example “You’d be #3 on the board!”, and shows a name box with a Submit button. On a computer, the box is ready for typing right away. On a phone, it waits for your tap so the keyboard doesn’t cover the screen. If your score falls short of a full board, you’ll see the score the top 10 starts at, so you know what to aim for, and you can jump straight back in with Play again.

A few simple rules apply to names:

  • They must be 3 to 12 characters long.
  • They can use letters and numbers only, with no spaces or symbols.
  • The game remembers the last name you used on that device, so you don’t have to retype it every time.

Each name gets one spot per board, and it holds that player’s best score. If you submit a lower score later, your better score stays. Please don’t use your real name or anything personal, since names on the board are public. After you submit, the board refreshes, highlights your entry and tells you your rank.

The name filter

Public leaderboards need a way to keep out offensive names. The Arcade checks every name against a list of words I don’t allow, and it does the same check on the player’s side and again on the server.

People who want to sneak a bad word through tend to use tricks, so the filter looks past them. It reads numbers as the letters they often stand in for, like a 0 used as an O or a 3 used as an E. It collapses repeated letters, and it catches a few common spelling swaps. Some short words are only blocked when they’re the entire name, which avoids flagging innocent names that happen to contain them. There’s also a short list of real words and place names that are always allowed, to avoid the classic problem where an ordinary name gets blocked because a rude word is hidden inside it.

If a name doesn’t pass, you’ll see a friendly “Please pick a different name” message, and you can try another.

Keeping the boards fair

A leaderboard is only fun if the scores are real, so the server double-checks every submission:

  • When you start a game, the server hands your browser a signed session ticket. A score can only be submitted with a valid ticket for that game.
  • Every game has sensible limits based on its actual rules, like the highest score possible and how fast points can realistically be earned. Scores that go beyond them are turned away. These limits are generous on purpose, because the aim is to stop impossible scores, not to punish skilled players.
  • For Daily Word, the server checks that your guesses are real words, that the last one is that day’s answer, and that the number of guesses matches your score.
  • Submissions are rate limited to one every ten seconds and thirty per hour for each game. The server doesn’t store your IP address itself, only a scrambled, one-way version of it, and only for rate limiting.

Where the scores live

The boards run on a small Netlify function and are stored with Netlify Blobs. Each board keeps the best 50 entries behind the scenes and shows the top 10. If you ever want an entry removed, reach me through the contact form on the About page, and I’ll take it off the boards.

Good luck, and I’ll see you on the leaderboard!

Want to play? Head to the Arcade.