- gamepass.js: durable pass store, waiting orders fulfilled by the next $5 package, cap ledger (daily/total per Central day, progress deferral + next-day carry-forward, idempotent refs kept 90 days, void), weekly Pass Tournament (Monday 9 AM Central, marks.claim, prizes recorded for the game faucets), admin stats. Settings in site config, caps enforced only from capsStartDate (recorded before). - server.js: /api/partner/player, /api/partner/polgrant(+/void), /api/partner/tournament/pending|paid, /api/my/gamepass(+/buy), /api/admin/gamepass/stats|comp|tournament/run; gamePass claim on every sign-in hand-off token; purchase-event fulfilment inside the marks.claim block. - Members > Games: Game Pass card (Buy via IAP.confirmBox, deep link /my#games?pass=1), Overview nudge after a free-cap hit. Admin > Game Pass pane. Chatbot canned answer + FACTS, KNOWLEDGE_DATE 10-16. - qa/gamepass.mjs scripted test (bash qa/run.sh gamepass), Games tab card in qa/walk.mjs. - docs/GAME-PASS.md: 3a clarifications + Built section; docs/GAME-PASS-RELEASE.md draft (not sent). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
18 KiB
Game Pass: draft spec (2026-10-16)
Marty's direction (10-16): a $5 weekly Game Pass that covers all nine games and raises the daily POL cap; a tighter free cap so nobody farms the games all day for free. Pass = "more game", never pitched as payback. Free play keeps paying real POL (the "paid before they ever pay" funnel in the presentation, deck and guide).
1. What the games pay today (live settings, 7-day earnings to 2026-10-16)
Two kinds of POL rewards exist in every game:
- Progress rewards: one-time per account (first clear of a stage, boss, sector, rival, chapter, room). Finite.
- Daily play rewards: repeatable every day (finds, daily puzzle, patrol, gems, drips). This is the "all day" risk.
| Game | Progress rewards (one-time, POL) | Daily play rewards (repeatable) | Game cap/day | Players (7d) | Median / p90 / max per player-day | POL out / week |
|---|---|---|---|---|---|---|
| PolHunter | none | finds 0.05-1.00 (skewed small), 3 missions/day | 40 | 38 | 0.48 / 0.97 / 4.04 | 102.1 |
| Gem Kingdom | stages 0.02-0.15; bosses 0.25 / 0.5 / 2 / 5 / 7.5 / 10 | none | 40 | 25 | 0.46 / 11.35 / 25.49 | 101.4 |
| SpellWheel | levels 0.02-0.05; chapters 0.25-1 | daily puzzle 0.03, streak 0.15 | 20 | 102 | 0.04 / 0.16 / 1.50 | 17.6 |
| Spooky Doors (to Oct 31) | ladder 0.1 / 0.25 / 0.5 / 1 / 2 | none | 25 | 11 | 0.85 / 1.00 / 2.00 | 10.7 |
| PolyWarriors | rivals 0.02-0.10, ladder 0.5, elite 0.12-0.5, elite clear 2 | none (PvP pays Circuits) | 20 | 10 | 0.18 / 1.09 / 4.94 | 8.8 |
| ClutterHunt | per room: clear 0.05, 3-star 0.05, expert 0.15, expert stars 0.10 | none | 20 | 13 | 0.20 / 0.95 / 1.05 | 6.4 |
| PolyBreak | rounds 0.02 / 0.03 / 0.05 | gems 0.01-0.15, up to 0.5/day | 5 | 39 | 0.02 / 0.06 / 0.12 | 1.3 |
| Drip Runner | chapters | drips 0.05, items | 5 | 15 | 0.05 / 0.15 / 0.25 | 1.2 |
| Road Agent | sectors 0.05-1.00 (3.60 total) | patrol 0.03/day | 25 | 5 | 0.08 / 0.16 / 0.16 | 0.5 |
| All games |
PolHunter and Gem Kingdom are 81% of the burn. PolHunter is repeatable play (and every find is a delivered sponsor visit, so that burn delivers advertiser inventory). Gem Kingdom's burn is its boss amounts: one player took 25.5 POL in a single day. No other game pays more than 2 POL for any single reward.
2. The pass
- $5, 7 days, all nine games. One pass per account; buying while active extends by 7 days.
- Paid with purchased-grade credits only (500 credits = the $5 package), through the existing game-purchase path
(
ads.gamePurchasewithpurchasedOnly, the same rule as PolyWarriors mint passes). A $5 package bought while a pass order waits fulfils it (thepwpassespattern). Earned credits never buy a pass, or no money enters and the pass is just a free cap increase. - Money flow is the normal on-chain split of the $5 package: $2.50 sponsor, $1.00 level 2, $0.50 level 3, $1.00 company. The company's $1 is what funds the extra POL; the games' 30% pool-share rule is an allowance, not cash.
3. Caps (account-wide, across all nine games)
| Free | Pass | |
|---|---|---|
| Daily play rewards (repeatable) | 0.30 POL/day | 1.50 POL/day |
| Everything (progress + daily), paced | 2.0 POL/day | 5.0 POL/day |
| Progress rewards | unchanged amounts for everyone; excess over the daily total carries to the next day (never lost) | same |
Why these numbers:
- Free 0.30/day sits under PolHunter's median (0.48) and SpellWheel's p90 (0.16 stays free). The regular PolHunter hunter is the natural pass buyer; the casual SpellWheel player never notices.
- Pass 1.50/day is above today's p90 for every game, so a pass holder keeps everything they earn today and more. Max repeatable per pass week = 10.5 POL (~$0.98), so the pass can never pay for itself and multi-accounting can't win.
- The paced total cap stops the Gem Kingdom spike (25 POL in a day) without changing any reward amount: a 10 POL boss still pays 10 POL, over a few days.
- Company per pass: $1.00 in, at most $0.98 out if a holder maxes the repeatable cap every day. Realistic use (about half) nets about $0.50 a pass. Progress rewards were payable to free players already, so the pass adds no cost there.
DECIDED (Marty, 2026-10-16): Gem Kingdom's bosses stay at 5 / 7.5 / 10 POL. "We need one that pays out bigger like that anyway." The paced total cap spreads a big boss payout over a few days; the amounts do not change.
3a. API contract (both sides build to this)
Built 2026-10-16 (IAP side). Clarifications and additions to this contract, none of them breaking:
- Where the endpoints live.
GET /api/partner/playerexists today on each GAME (IAP reads the player's card line from it). The pass and caps version below is served by IAP (https://instantadpay.com/api/partner/player), so a game CALLS it; nothing changes on the game's own endpoint. Same forpolgrant,polgrant/voidandtournament/*: all on IAP.- Signature, spelled out. Each game signs with the shared secret it already holds (its
*_SSO_SECRET; PolHunter usesHUNT_SSO_SECRET). 10-minute window onts(ms).
GET /api/partner/player?game=<slug>&m=<memberId>&e=<email>&ts=<ms>&sig=<hex>withsig = HMAC-SHA256(secret, 'player:' + who + ':' + ts),who= memberId when > 0, else the lowercased email (the same string the games already compute for IAP's calls to them, withgameadded so IAP knows which secret to check).POSTendpoints: JSON body that includesgame: <slug>, headersX-Game-Ts: <ms>andX-Game-Sig: HMAC-SHA256(secret, ts + '\n' + rawBody)hex (sign the exact bytes you send).GET /api/partner/tournament/pending?game=<slug>&ts&sigwithwho = 'tournament'.memberId. Players who have not linked a wallet havememberId: 0in every hand-off token; send- Extra fields in answers (additive):
polgrantalso returnscarried(POL paid from an earlier day's deferral, already insideallowed),capHit('daily'|'total'|null),enforced(false beforecapsStartDate),repeat(true when the ref was already answered),voided.capsalso hasenforced,passandpending(POL deferred for this game, not yet paid).playeralso returnsmemberId, username, wallet, suspended, gamePassEnabled. A suspended account getsallowed: 0, suspended: trueand nothing is recorded (a cleared account can replay the ref).- Carry-forward counts against the later day's total cap (that is what "paced" means): a 10 POL boss on a 2 POL/day free account pays 1.7-2.0 a day until done, paid before that day's new grants. Carry-forward only happens on a LATER Central day than the deferral and only to the same game; the reply that carries it says
carried.voidreverses only that ref's own share (itsallowedon its day and whatever of its deferral is still queued). POL it already caused to be carried on a later day belongs to that later day and stays. The ref remains answered as voided.- Hand-off tokens carry the flag as
gamePass: { active, until }(notpass, which the in-game sign-in flow already uses for its session token). Apply perks from it at sign-in; refresh fromplayer/polgrantanswers.- Tournament prize payout seam. IAP records the winners and POL amounts; a game faucet (Road Agent pattern) pays them:
GET /api/partner/tournament/pendinglists{ week, place, email, memberId, wallet, pol }rows still unpaid, and the paying game callsPOST /api/partner/tournament/paid { game, week, place, tx }so the row leaves the list. Which faucet pays is a settings/ops decision, not yet wired: until it is, Admin > Game Pass shows the unpaid rows.- Not deviations, just dev conveniences (non-production only):
devDay: 'YYYY-MM-DD'onpolgrant/player/buyfakes the Central day;POST /api/dev/gamepass-purchasefakes a package event;devPaid: trueonbuyskips the credit charge.
IAP is the single source of truth for the pass and for the account-wide caps. Every game already signs partner calls
with its shared secret (the /api/partner/player pattern); the new calls use the same auth.
GET /api/partner/player?...(existing) additionally returnspass: { active: bool, until: ms|null }andcaps: { daily: n, total: n, used: { daily: n, total: n }, day: 'YYYY-MM-DD' }(Central day).POST /api/partner/polgrantbody{ memberId, game, kind: 'daily'|'progress', pol, ref }(ref = the game's own idempotency key, e.g.sector:3,find:<id>). Response{ allowed: n, deferred: n, pass: bool, day }.kind: 'daily':allowed = min(pol, dailyCapRemaining, totalCapRemaining), the rest is DROPPED (never deferred).kind: 'progress':allowed = min(pol, totalCapRemaining), the rest is DEFERRED: IAP stores it and the game's next call (any kind) on a later day gets it added toallowedfirst (carry-forward). Nothing is ever lost.- Same
reftwice = same answer (idempotent). Fail closed: if the game cannot reach IAP it grants nothing and retries the same ref later.
POST /api/partner/polgrant/void{ memberId, game, ref }when a game decides not to pay after all (rare).- Settings on IAP (Admin > Settings, no deploy):
gamePassEnabled,gamePassPriceCredits(500),gamePassDays(7),capFreeDaily0.30,capFreeTotal2.0,capPassDaily1.50,capPassTotal5.0,capsStartDate(the free caps apply only from this Central date; before it, the games' own caps stand, so the change can be announced a week ahead),passTournamentPct5. - Pass purchase:
POST /api/my/gamepass/buyspends 500 purchased-grade credits (ads.gamePurchasewithpurchasedOnly); a $5 package bought while a pass order waits fulfils it (thepwpassespattern). Buying while active extendsuntilby 7 days. The Games tab shows the card, the state, and the expiry. - Games get the pass flag at the sign-in hand-off and on every
polgrantresponse; apply perks locally.
4. Pass perks per game (more game, not more payback)
| Game | Pass perk (besides the higher caps) |
|---|---|
| PolHunter | 5 missions/day instead of 3; Ad Detective twice a day. Finds still require the sponsor visit. |
| Gem Kingdom | one free continue per day (small, so Crowns sales are not undercut) |
| SpellWheel | streak bonus 0.15 -> 0.30; one free hint a day |
| PolyWarriors | +1 daily mission; defense pay 15 -> 25 Circuits; Pass mark on the warrior card |
| Road Agent | 2 patrols/day; +25% scrap. Fuel stays a sponsor visit. |
| ClutterHunt | 2 free hints a day |
| PolyBreak | gem cap 0.5 -> 1.5/day; one extra paddle per round |
| Drip Runner | a shield at the start of every run |
| Spooky Doors | +1 door a day while the season runs |
| All games | Weekly Pass Tournament: cross-game leaderboard (finds, clears, wins), prizes from 5% of pass sales (25c per pass) in POL; Pass badge; gold profile frame |
Ad-visit mechanics (fuel, Crowns, hints, refuels) stay as they are. Those verified visits are what advertisers pay for.
5. Build outline
- IAP (central): durable
gamepassmap {email: {until, history}};GET /api/partner/playerreturnspass:{active, until}; newPOST /api/partner/polgrant{member, game, kind: progress|daily, pol} -> {allowed, deferred} enforcing the account-wide caps (fail closed when IAP is unreachable; games retry); Games tab card "Game Pass: $5 for 7 days, all games"; buy flow via purchased credits or the $5 package; admin: passes sold, POL out per pass, cap hits. - Each game: read the pass flag at the sign-in hand-off; call
polgrantbefore every POL grant (replaces each game's owndailyCapPolfor the account-wide rule; keep the local cap as a backstop); pace deferred progress rewards (queue, pays out next day); apply its perk; show "Pass" state and a "Get the Pass" nudge when the free cap is hit. - Tournament: weekly job on IAP ranks pass holders across games, pays prizes from the games' wallets, posts to the Game Achievements topic.
- Chatbot, release note, presentation games slide, and the guide's games section: say "free play pays; the Pass plays more" (never "earn more").
- QA: iap-qa plus a scripted run per game: free cap hit -> nudge; pass bought -> cap raised; progress reward over the cap -> paid the next day; pass expiry -> back to free caps.
6. Rollout
- Announce one week ahead (the free cap change affects today's PolHunter regulars). First week: pass at $5 with a launch tournament; watch passes sold, POL out per pass, free-tier burn, verified visits delivered.
- Review after 14 days against: company net per pass >= $0.40, free burn under 150 POL/week, no drop in visit deliveries.
Built (IAP side, 2026-10-16)
Everything below is on IAP, behind gamePassEnabled (default off). The caps are recorded from day one and ENFORCED only from
capsStartDate, so the change can be announced a week ahead and Admin can read what the caps would have done meanwhile.
Files
gamepass.js(new): pass store, waiting orders, cap ledger (DATA_DIR/gamepass-ledger.json, refs kept 90 days), tournament, admin stats, prune. Durable persisted mapsgamepass,gporders,gpprizes(added to the DURABLE set in server.js so a deploy never wipes them).server.js: settings defaults, init + hourly tournament tick + 6-hourly prune, purchase-event fulfilment (inside themarks.claimblock, so two app copies never double-fulfil), partner helpers (GP_SECRETS,gpPartnerCheck,gpResolve,gpDevNow),polUsdLive()(catalog rate, 10-minute cache),gpClaim(thegamePassclaim on every sign-in hand-off token, including PolHunter's), and the endpoints below.public/my.html+public/assets/my.js: the Game Pass card at the top of Members > Games (state, caps line, Buy/Extend withIAP.confirmBox, waiting state with a Buy-a-package button), deep link/my#games?pass=1(setPane now strips a?queryfrom the hash and highlights the card), the Overview nudge cardgpNudge(shown once a day per browser after a game reports a free-cap hit, never to pass holders). Asset tag bumped tomy.js?v=20261016a.public/admin.html+public/assets/admin.js: Admin > Game Pass pane (passes sold week/total, active, POL out per pass week, free/pass cap hits, deferred queue, tournament last run + unpaid prizes, "Settle last week now", comp a pass). Tagadmin.js?v=20261016gp.chatbot.js: canned answer + FACTS line,KNOWLEDGE_DATE2026-10-16.qa/gamepass.mjs(new,bash qa/run.sh gamepass),qa/walk.mjs(Games tab card on/off + admin pane),qa/run.sh.docs/GAME-PASS-RELEASE.md: the member-facing release note draft (not sent).
Settings (Admin > Settings > Site settings; all read live, no deploy): gamePassEnabled ('0'), gamePassPriceCredits (500),
gamePassDays (7), capFreeDaily (0.30), capFreeTotal (2.0), capPassDaily (1.50), capPassTotal (5.0), capsStartDate ('',
Central YYYY-MM-DD), passTournamentPct (5), telegramGamesTopicId ('661565'), telegramGamesChatId ('' = the shared echo chat).
Endpoints
- Members:
GET /api/my/gamepass->{ enabled, active, until, price, days, usd, waiting, bought, caps, capsStart, lastCapHit, tournament };POST /api/my/gamepass/buy->{ ok, active, until }or{ needPay: true, payUrl: '/my?from=gamepass#buy', order, price, need }. SpendsgamePassPriceCreditspurchased-grade credits throughads.gamePurchase(purchasedOnly)with the credit-log label "Game Pass (7 days)"; short = waiting order, fulfilled by the next $5+ package purchase event. - Games (signed, see 3a):
GET /api/partner/player,POST /api/partner/polgrant,POST /api/partner/polgrant/void,GET /api/partner/tournament/pending,POST /api/partner/tournament/paid. - Admin:
GET /api/admin/gamepass/stats,POST /api/admin/gamepass/comp { email, why },POST /api/admin/gamepass/tournament/run { week?, force? }.
Tournament job: hourly tick; once Monday 9 AM Central has passed and the closed week (Mon 00:00 to Mon 00:00 Central) has no
row, exactly one app copy (marks.claim('gamepass-tournament:<week>')) ranks the week's pass holders by grants reported through
polgrant (progress and daily weigh the same, one point per ref with pol > 0), pool = passTournamentPct of the week's pass sales
in USD at the live catalog POL rate, split 50/30/20, rows recorded in gpprizes as pending, top 3 posted to the Game Achievements
topic (telegramGamesTopicId, only when enabled), winners get an inbox notice (kind notice). Comps (/comp) are passes, not
sales. If the POL rate is unavailable the tick retries next hour.
Known limits / follow-ups
- The cap ledger is a JSON file on the volume (like the other IAP side stores), not a MySQL table: during the ~30 s deploy overlap
two app copies each hold their own copy and the last save wins. A grant answered by the copy that is about to stop could be
re-answered fresh by the other on retry. Move
refs/daysinto MySQL if the games report drift. qa/gamepass.mjsstubs the credit charge (devPaid) for the "buy -> active" step:ads.gamePurchase(purchasedOnly)needs a position with on-chain package credits, which a local copy without RPC cannot have. The "short -> waiting order -> package fulfils it" step runs the real path. The purchasedOnly charge itself is the live PolyWarriors mint path.- Prize POL is not sent by IAP (see 3a item 8); the Games pane lists unpaid rows until a faucet is wired.
- Settings pass through
/api/admin/sitelike every other site setting (that endpoint accepts any key; the defaults above make the Game Pass keys show in the Site settings form).