KAZIK/docs/native-tables.md
Игорь Федосеев eaac8b861e feat: rework artifacts and tower relics
Extend profiles from 280 to 312 bytes with legacy compatibility.
Keep tower relics run-local and share the profile bankroll.
2026-10-30 23:22:19 +03:00

89 lines
4.9 KiB
Markdown

# Native Card Tables
## Implemented
The existing BLACKJACK, POKER and DURAK interaction targets now open native card
tables in the same raycaster window. Neither table allocates a console or
launches Python. Existing hall coordinates, camera, textures and legacy
console game procedures are preserved.
Both tables use a shuffled 52-card deck, fixed card identities, a shared
bitmap felt/dealer scene, animated dealing and card flips. Poker also moves
chips into the pot. Actions are edge-triggered, and mouse positions account
for the 4:3 viewport and its black bars. During a paid hand ESC opens a frozen
exit confirmation; after settlement ESC returns to the hall. Closing the game forfeits an
unfinished hand: the deducted stake is saved, not refunded or replayed.
Poker is heads-up no-limit Texas Hold'em against one dealer AI. It includes
alternating button/blinds, the big blind's option, flop/turn/river with burn
cards, check/call/raise/fold/all-in, minimum raises, unmatched all-in refunds,
automatic board runout, and exact five-card ranking with kickers and ties.
The opponent uses its own cards and the exposed board only. Its strategy is
a deliberately lightweight heuristic, not an optimal poker solver.
Blackjack uses one deck per hand, dealer stands on soft/hard 17, naturals
pay 3:2, tied naturals push, and a player can double on the first two cards.
Splitting and insurance are not implemented in this native version.
Durak uses a 36-card deck against one AI, with podkidnoy/perevodnoy variants,
fixed bout limits, taking, transfers, discard and attacker-first refills.
See [Native Durak](native-durak.md) for rules, controls and verification.
## Controls
- Tables: click the displayed buttons; +/- adjusts the next stake.
- Poker: Space or C check/call, R raise, A all-in, F fold, Up/Down amount.
- Blackjack: Space deal, H hit, S stand, D double, Up/Down next stake.
- Durak: Left/Right select, Enter play, B take, T transfer, D finish attack;
Page Up/Down changes the eight-card hand page; T switches variant when ready.
- ESC exit confirmation/return; F11 toggles fullscreen without changing the table layout.
## Modules
- `src_graphics/card_tables_data.inc`: card IDs, states and UI data.
- `card_table_assets.inc`: loaders, shuffle and shared physical card/chip drawing.
- `poker_evaluator.inc`: native prime-product lookup and best five of seven.
- `native_poker.inc`: betting state machine and information-limited AI.
- `native_blackjack.inc`: blackjack state machine and ace scoring.
- `native_durak_data.inc`, `native_durak.inc`, `durak_render.inc`: native
two-player Durak state, rules, asynchronous AI and animated presentation.
- `card_tables_render.inc`: presentation only; no RNG or payouts.
- `card_table_input.inc`: mouse commands and mode-specific paid-hand guards.
## Offline Assets
`tools/generators/pack_card_tables.py` compiles the table artwork and the
[Treys](https://github.com/ihendley/treys) 0.1.8 ranking tables to binary assets.
Install the pinned offline dependency into `tools/vendor` with
`python -m pip install --target tools/vendor --no-deps -r tools/generators/requirements-poker.txt`.
The shipped game reads only `card-table.bin` and `poker-ranks.bin`.
Include `docs/licenses/treys.txt` in future distributions.
Rules reference: [PokerStars Hold'em](https://www.pokerstars.com/poker/games/texas-holdem/).
Artwork: generated with the imagegen tool, stored as
`assets/sprites/tables/card-table-v1.png`. Prompt: full 4:3 seated-player view
of an emerald casino card table, burgundy padded near rail, brass trim,
adult male dealer in white shirt/black vest at the far rail, blank felt for
runtime cards/chips, crisp 1990s PC-game painted scene, no cards, chips,
text or HUD in the artwork. The binary loader permits a simple felt fallback
if the artwork is missing; missing rank data blocks poker rather than
silently launching the console version.
## Verification And Remaining Work
`tools/tests/test_casino_actions.ps1` executes the actual assembly renderer
and handlers: 9021 five/six/seven-card rank vectors against Treys, 500 complete
poker hands, 500 blackjack hands, money conservation, all-in runout/refund,
odd-chip ties, dealer information boundaries, mouse coordinate mapping,
duplicate rejection and render side-effect checks. Tests cannot write user
saves. `check_card_table_frames.py` exports eight actual framebuffer images.
Existing fullscreen, startup, audio, dice and 2000 roulette-round checks remain.
This is not a completed migration of the whole casino. The implemented
graphical games include the three card tables, Russian roulette, Buckshot,
multi-bet casino roulette, coin, dice, skulls, skill checks and billiards.
777, CloverPit, tower, terminal and observer subsequently received native
implementations. Only online roulette and Umamusume still show unavailable
panels. See `ARTIFACTS_AND_TOWER.md` for artifact and tower rules.
Native profile data remains separate from legacy console
account saves. The old installer is not refreshed by this change.