> For the complete documentation index, see [llms.txt](https://docs.arpanetwork.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.arpanetwork.io/archive-of-fate.md).

# Archive of Fate

### Introduction

Archive of Fate (命运档案馆) is an AI-driven text life-simulation game on BNB Smart Chain. Each playthrough is a complete, randomly-generated life: players are born into one of three worlds, draw talents, allocate starting attributes, then watch a deterministic rules engine carry their character through decades of procedurally-selected events, occasional "mythic" turning points, and a final AI-written life summary and fate grade. Players who like the outcome can permanently inscribe that life as an ERC-721 NFT and publish it to a public Fate Archive, where anyone can inspect the record and verify onchain that it wasn't faked.

### Gameplay Demo

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDAMqVaf96VXudHYNn7sZ%2Fuploads%2FMJ7Ai1cUexIL9O1cYe3J%2Fgameplay%20demo.mp4?alt=media&token=420e897b-6ab8-4efc-8540-5e12212b4792>" %}

### How to Play

Whether or not you connect a wallet, a full life takes just a few minutes:

1. **Choose how to play**: Connect a wallet to unlock persistent cross-run progression and on-chain inscription, or tap **Play as Guest** for an instant, no-signup start (guests get up to 10 free lives).
2. **Get your random seed:** Wallet players sign one transaction (a small BNB fee) to request a verifiable seed from Randcast; guest players are issued a seed automatically, sponsored by the game's backend, at zero cost.
3. **Draw and pick 3 talents:** chosen from a candidate pool that grows the more a wallet player has played.
4. **Allocate starting attributes**: Charm, Intellect, Strength, Wealth, and Spirit, spent from a point budget that also widens with wallet progression.
5. **Watch the life play out**: the deterministic rules engine advances year by year, firing random events and occasional rare "mythic" moments, with every outcome determined entirely by the seed and your choices.
6. **Get your fate summary**: peak attributes, an overall score, a fate grade (D through SSS), and a one-line AI-written life summary.
7. **(Optional) Inscribe your fate**: connected-wallet players can mint the life as an ERC-721 NFT (50 ARPA + gas), publishing it to the public Fate Archive board.
8. **(Optional) Share or verify:** export a shareable PNG fate card, or browse the Fate Archive to inspect any inscribed life and verify it on-chain against the smart contract in one click.

### Why On-Chain Randomness Matters Here

Every meaningful outcome in the game, which world you're born into, which events fire each year, whether a rare "mythic" moment triggers, how the life ultimately scores, is derived deterministically from a single seed. That design choice makes randomness the single most important trust primitive in the whole product: if the seed can be predicted or manipulated by the player, the backend, or anyone else, the entire "fate" premise collapses, and the on-chain inscriptions become meaningless. Archive of Fate needed a seed that is:

* Unpredictable before the player commits to it
* Unbiased, not influenced by the requester, a miner, or the game's own backend
* Verifiable after the fact, so a public "verify this life" feature can hold up

Randcast was a direct fit for all three requirements without the team having to build or operate any randomness infrastructure themselves.

### How Archive of Fate Integrates Randcast

The game's `FateRandomnessConsumer` contract extends Randcast's `GeneralRandcastConsumerBase`, and the integration supports two distinct player paths:

**Wallet players pay for their own randomness.** When a connected-wallet player starts a new life, the frontend calls `requestSeed()` directly on the consumer contract, attaching a small amount of BNB to cover the Randcast fee. This produces a `requestId`, and once the ARPA Network fulfills it, the game's backend reads the result and starts the life using that verified seed.

**Guest players are sponsored.** To keep the barrier to entry at zero, anonymous/guest sessions (capped at 10 free plays) are requested by the backend's `operator` wallet via `requestSeedFor(gameSessionId)`, funded out of a project-owned Randcast subscription rather than the player's own funds. This lets the game offer a genuinely free, wallet-less trial experience while still guaranteeing every single life, guest or not, is seeded by real, verifiable on-chain randomness rather than a client-side or server-side PRNG.

**Seed derivation.** On fulfillment, the raw randomness is folded down into a compact 6-digit game seed (`seed = randomness % 900000 + 100000`), which is what actually drives the deterministic life-simulation engine (a seeded `mulberry32` generator). The mapping is simple and public, so anyone can independently confirm that a displayed life's seed derives correctly from the on-chain randomness value.

**Verification before the life even starts.** Before the backend will simulate a wallet player's life, it independently re-reads `getSeed(requestId)` and `requesters(requestId)` from the consumer contract and checks that the on-chain seed and requester match what the client submitted, the backend never trusts a client-supplied seed at face value. Guest sessions are read the same way via polling. This closes off the most obvious attack: a player claiming a different (more favorable) seed than the one Randcast actually fulfilled.

**Carried through to permanent inscription.** If a player chooses to mint their life as an NFT, the on-chain fate record stores the seed together with the original Randcast request transaction hash, `talentIds`, and starting attribute allocation. Combined with the deterministic simulation engine, this means anyone, not just the game's own backend, can take a published inscription, re-run the same inputs through the (open) rules engine, and confirm the result matches exactly what's displayed. Randcast's verifiable randomness is what makes that whole audit chain possible in the first place: the game's own EIP-712 anti-forgery signing and receipt verification stop fabricated inscriptions from being minted, but it's the randomness underneath that stops the outcome itself from having been rigged.

### Why This Matters for Web3 Games

Archive of Fate is a good illustration of a broader pattern: any game where the entire value proposition is "this outcome is fair and this record is real" needs randomness that can survive public scrutiny, not just internal trust. By offloading seed generation to Randcast's BLS threshold-signature network, and by sponsoring guest randomness through a simple subscription rather than building custom infrastructure, the team was able to ship a fully verifiable, dual-mode (self-paid + sponsored) randomness flow with a comparatively small amount of integration code, while keeping the door open for any player, at any time, to independently check that their fate (or anyone else's) was never tampered with.

### Links

To play the game: <https://aof.arpanetwork.io/>

Source code: <https://github.com/ARPA-Network/Archive-Of-Fate>
