DEV Community

Cover image for Launching a browser game Beta with no save wipes and 2,000 free copies
IdleCultivation
IdleCultivation

Posted on

Launching a browser game Beta with no save wipes and 2,000 free copies

Myriad Immortal Sect opens its Beta today. It is a free idle RPG about cultivation, the xianxia kind, where you start as a mortal and climb through ten great realms, and it is a browser game through and through: a Phaser 4 canvas for the world map, React for everything around it. This Beta doesn't wipe anything. People who signed up before it keep every realm and every item, and so does everyone who starts today.

Myriad Immortal Sect, the game this devlog is about. Play it free in the browser

That one decision changed more of the engineering than any feature did, so this post is about the constraints a no-wipe Beta puts on a small web game, and, at the end, about a launch giveaway that needed the same care.

Browser game saves that only move forward

Cultivate screen hero card: realm, cultivation bar, stats grid and the cultivation-rate breakdown of every multiplier

Before real players, a change to the save shape could be handled by throwing old saves away. After real players, every change to what the game persists carries a version bump and a forward-only upgrade step that turns yesterday's save into today's. There are no shims that keep two shapes alive side by side; there is one current shape and a path to it from every older one.

The rule that matters most is about loss. An upgrade step may merge, rename or reshape, but it never destroys a player's items, even when a new rule says a stack should be smaller. An over-sized stack left behind by a rule change becomes read-only, never deleted. An upgrade that looks tidy can still drop an item, and nobody notices until a player writes in.

The screen above is a good test case. The cultivation rate is a product of a dozen multipliers, and each one is shown by name. When the formula for one changes, an old save has to land on the new number without a jump the player can see.

Guest play first, an account later

Most players never want to register before they know whether they like a game, so the Beta starts as a guest. That creates a second problem the day the guest decides to sign in: the progress they made anonymously has to fold into the account without duplicating or losing anything, including things they bought or earned while anonymous. The fold moves everything the guest owns onto the account in one step, and the account is the only identity from then on.

A client-side idle loop with a backend that decides

The Market Isles General Store in Japanese: counter tabs, pill cards with descriptions, prices and the sect discount

An idle game runs its loop on the client, because players expect the numbers to move instantly and to keep moving offline. The trade-off is that anything touching the shared economy, buying, selling, trading, is done online and recomputed on the backend, which stays the source of truth. The client predicts and the backend decides. Keeping the two in agreement means the formulas exist in both places and are tested for parity, and big numbers are carried as strings end to end so neither side rounds them differently.

The same split applies to rapid actions. A player tapping Buy ten times is normal behaviour, so the shop applies purchases locally at once and sends them as one batch after a short pause, instead of ten requests.

The screenshot above is the Japanese build, one of eleven languages. The English edition is written as an original for English readers, with English character names and no leftover transliteration, while Simplified Chinese is the source the other nine languages translate from. Translations drift whenever the English changes, so a check flags every line whose English moved after its translation was written.

A Phaser 4 world map with a load budget

The player standing behind the waterfall cliff and drawn as a pale silhouette through it, level and bars still showing

In a browser game the map shares the tab with everything else, so it has a hard budget: ready within three seconds, never freezing the page, and never slowing other tabs. Two things hold it. Props are culled per object, since Phaser does not cull a plain Image and a dense chunk would otherwise submit every sprite every frame. And chunk assembly is spread across frames with a per-frame time budget, nearest chunks first, because building a whole screenful at once on arrival is exactly the kind of long main-thread task the budget forbids. Heavy terrain work is kept off the main thread.

Small visual touches have to fit inside the same budget, like the silhouette in the screenshot, which draws the player through a tall prop standing in front of them so you never lose track of your character behind a cliff.

Giving away exactly 2,000 copies without a race

The profile screen with text size, music, language and account settings

The Beta comes with a giveaway: from September 27 to October 10, the first 2,000 players who verify an email get the Complete Edition free and keep it. That is the $9.99 unlock for the second half of the game, the realms from Void Refinement to Ascension, plus the full companion novel as an EPUB and a bigger bag.

A capped giveaway looks like a counter and an if statement. The catch is that the thing that triggers it, a player verifying an email, can happen for many people in the same second, and a race there means copy 2,001 and copy 2,002 go out.

So the gift is minted inside the same database transaction as the verification, and before counting, that transaction takes an advisory lock keyed on the giveaway's id. Two verifications arriving together queue on that lock, the second one sees the first one's row, and the count can never pass the cap. The per-account rule needs no extra table: a code row for this giveaway and this player already means the player has one.

Two more details keep it from slowing anyone else down. The mint runs in a savepoint, so if it fails for any reason the email verification still goes through and the rule is simply tried again on the account's next read. And once a process has seen the cap reached, it remembers that, so after the 2,000th copy a verified player does not wait on the lock just to be told no.

The code is not applied silently. It shows up under Profile, Complete Edition with a Claim button and has a week to be claimed. While the window is open, the website checkout offers that Claim button to a verified player instead of a payment form, so nobody pays $9.99 for something a verified email would have given them. No paid listing goes on sale anywhere until the gift window closes. After that, the edition is $4.99 until October 31 and $9.99 from November 1.

If you want to see how it all holds up, the Beta of this browser game is free to play, and there may still be a free Complete Edition waiting for your verified email. Our Discord is open for questions about any of this.

Myriad Immortal Sect, the game this devlog is about. Play it free in the browser

Top comments (0)