fix!: --fast corrupts deck order after a Tarot/Spectral pack closes — every later deal silently wrong
- Dominant language
- Python
- Stars
- 72
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
## Description
Under `--fast` (10× speed), SMODS deal events race. When an Arcana or Spectral
pack's dealt targeting hand returns to the deck at pack close, the live deck
order ends up permuted relative to vanilla. From that point on, **every
subsequent deal in the run is silently wrong** — no error, no visible glitch,
just different cards drawn than the seed should produce.
We caught this with a differential harness replaying identical action traces on
a vanilla-faithful simulator: divergence always appeared at the first re-deal
after a pack close, and the same traces replay byte-exact at normal speed. A
cosmetic form of the same race also shows up as scrambled pack *display* order
(contents correct as a multiset, order permuted).
Note the corruption usually hides: the game's seeded shuffles re-sort by
`sort_id` before shuffling (`misc_functions.lua:209` in the vanilla dump), which
heals most deck-order drift — so the bug only bites between pack close and the
next full shuffle, which is exactly when it's hardest to notice.
## Impact
Any run made with `--fast` stops being vanilla-faithful at its first tarot or
spectral pack: draws after the pack differ from what the seed produces at normal
speed, so results are not comparable across speed settings and not reproducible
against the real game. For benchmark data this is a silent validity problem.
We retired `--fast` entirely for validation work and run `--no-audio` only.
## Suggested Fix
Sequence the pack-close hand-return like vanilla regardless of `G.SETTINGS.GAMESPEED`
(the return events need to complete in deck order before control returns), or —
as a stopgap — document that `--fast` is not seed-faithful once a Tarot/Spectral
pack has been opened.
Contributor guide
Research direction
Reproduce the issue with the differential harness described in the report, comparing identical action traces at normal speed and with --fast. Inspect the pack-close hand-return sequence and compare its ordering with the vanilla reference at misc_functions.lua:209. Done means later deals remain seed-faithful after Tarot or Spectral packs, and pack display order is not scrambled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, python
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100