Map the book event game type onto the frontend's vocabulary - #38
Open
soulrap wants to merge 1 commit into
Open
Conversation
math-sdk names its game types basegame / freegame - `Config.freegame_type` in src/config/config.py - while this game's config names them basegame / freeSpins: `GameType` is `keyof typeof config.paddingReels`, and those keys are `basegame` and `freeSpins`. The reveal handler assigned `bookEvent.gameType` straight through, so during a feature round `stateGame.gameType` sat at 'freegame'. Background.svelte shows the base scene when it is 'basegame' and the feature scene when it is 'freeSpins', so neither branch matched: both FadeContainers stayed hidden and the entire feature played on a black screen. freeSpinTrigger does set 'freeSpins', but the next reveal overwrote it, and freeSpinEnd sets 'basegame' - which is why the scene reappears the moment the round ends, and why this reads as "the background comes back at the end". Measured against the published books for 0_0_scatter: 4060 reveal events in books_bonus carry gameType 'freegame', 400 in books_base carry 'basegame'. 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
The whole free spins feature plays on a black screen: no background at all,
base or feature. The scene reappears the instant the round ends.
Background.sveltepicks the scene fromstateGame.gameType:bookEventHandlerMap.tsassigns that value straight from the book event:But the two SDKs do not agree on the vocabulary:
Configinsrc/config/config.pybasegamefreegameconfig.paddingReels, which is whatGameTypeis derived frombasegamefreeSpinsSo during a feature round
gameTypeis'freegame', which matches neitherbranch. Both
FadeContainers stay hidden and what shows through is the blackRectanglebehind them.freeSpinTriggerdoes set the correct value:…but the next
revealimmediately overwrites it. AndfreeSpinEndsets'basegame', which is exactly why the background comes back the moment theround finishes — the scene that returns is the base one, not the feature one,
so the feature scene is never seen at all.
Measured against the published books for
0_0_scatter:GameTypecannot catch this: the book event is parsed from JSON, so the rawstring flows in untyped.
Change
Map the incoming value onto the frontend's vocabulary at the point of
assignment:
Nothing else changes —
freeSpinTriggerandfreeSpinEndalready assign theright literals directly.
Scope
This is not specific to one game.
basegame/freegameare the math-sdkdefaults, so any game whose frontend config names the feature
freeSpinshasthe same silent failure. The other samples in this repo are worth a look; I
only had
scatterset up against a live RGS session to confirm it.If you would rather fix it the other way — rename the config key to
freegameso the two SDKs agree — that works too, but it changes
GameTypeand every'freeSpins'literal in the app, so I went with the narrower change.