All work

Data

Moving 100M+ players onto real-time stats

Replacing CubeCraft's end-of-game stats with stats saved as they're earned, and migrating more than 100 million players' stats onto the new system.

Ziax · CubeCraft and Rocket · 2026

The problem

CubeCraft’s old stats system only saved a player’s stats when their game ended. If the game crashed, those stats were gone. Leaderboards only refreshed every 10 minutes or so, and newer features like achievements and progression need to know about a stat the moment it’s earned.

What I built

The first pass migrated more than 99% of players cleanly. The rest, about 1%, failed for ordinary reasons like lag, bad old data or a crash at the wrong moment. At this scale that was still more than a million people, so the re-processing mattered as much as the main run.

  1. Old statssaved at game end
  2. Migrateevery player, in batches
  3. Drift checkflag big differences
  4. Re-runfailed and drifted players
  5. Livestats in ~30 s

The migration, as a sketch

A sketch of the idea, not the production code.

for batch in players.in_batches():
    for player in batch:
        try:
            old = legacy_stats.load(player)
            new = convert(old)
            stats.write(player, new)
            if drift(old, new) > THRESHOLD:        # "I lost thousands of wins"
                retry_queue.add(player, reason = "drift")
        except error:
            retry_queue.add(player, reason = error)

for player in retry_queue:                         # ~1% of players, still over a million people
    reprocess(player)

# afterwards, live
on stat_earned(player, stat, amount):
    stats.increment(player, stat, amount)          # saved now, not at game end
    leaderboards.reflect(player, stat)             # visible in about 30 seconds

Why it matters

Players don’t lose progress when a game crashes, leaderboards keep up with what’s happening, and achievements and progression finally have stats they can react to as they happen.

Stack