Derive bet modes from the RGS instead of the placeholder table - #36
Open
soulrap wants to merge 1 commit into
Open
Derive bet modes from the RGS instead of the placeholder table#36soulrap wants to merge 1 commit into
soulrap wants to merge 1 commit into
Conversation
`stateMeta.betModeMeta` defaults to a placeholder table (ANTE / SUPERANTE / SUPERSPIN / BONUS / SUPER) that describes no particular game, and nothing overrides it - none of the sample games do. Two things follow: - Modes the published math does not have are offered in the buy/activate dialog. Playing one is rejected by the RGS with ERR_VAL "invalid amount". - BONUS is declared at costMultiplier 100. A game whose bonus costs 200x shows the wrong price before the request is ever sent. /wallet/authenticate already returns the authoritative list as config.gameModes, and Authenticate.svelte already consumes config for betLevels and jurisdiction - it just ignores gameModes. Reconcile against it there: server modes win on identity and cost, presentation a game has set (assets, copy, type) is kept for the modes that survive. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
stateMeta.betModeMetadefaults toDEFAULT_BET_MODE_METAinstate-shared/src/constants.ts:That table describes no particular game, and nothing overrides it — none of
the six sample apps assign
betModeMeta. So every game ships the same six modesin its buy/activate dialog regardless of what its math actually published.
Reproduced with the
scattersample against a live RGS session. Its mathdeclares exactly two modes (
basecost 1.0,bonuscost 200), but the dialogoffered six. Pressing a buy option returned:
Two distinct failures are folded together here:
this game's math. The RGS rejects them.
BONUSis declared at 100x, while the publishedmath has it at 200x. Even for a real mode, the dialog shows the wrong price
before any request is sent.
The fix
/wallet/authenticatealready returns the authoritative list:Authenticate.sveltealready consumesconfigforbetLevelsandjurisdiction— it just ignoresgameModes. This reconciles against it in thesame place:
reconcileBetModeMeta(new, instate-shared) keeps only the modes the serverreports, takes
costMultiplierfrom the server, and preserves any presentationa game has already set — assets, copy, and
type— for the modes that survive.typeis only inferred (costMultiplier === 1 ? 'default' : 'buy') for aserver mode the game has not described itself.
Deriving from the server rather than from each game's local config means this
cannot drift from what the RGS will actually accept, and it fixes all six
samples without per-app wiring.
Verification
Against a live session,
scatter, with the buy dialog opened:ERR_VAL "invalid amount"A full bonus round then settled correctly end to end — $992.00 → $792.00 on the
buy, freespins with a global multiplier, → $842.40 on payout.
Note
The placeholder table is left in place as the pre-authentication default, so
nothing changes for a game that sets its own meta before this runs, and the
dialog still has something to render if
gameModesis absent. If you wouldrather the default table were dropped entirely, or that this live in a derived
value rather than an assignment, happy to redo it.