Files
fool-cardgame/docs/PLAN.md
T
ftcandClaude Opus 5 51117a698c M3: модуль сохранения
По ARCHITECTURE.md: реестр независимых секций, JSON с ключом на секцию.
Ключи — явные строковые константы, а не имена классов: релизная сборка
минифицирует имена и молча потеряла бы все сохранения.

- ISaveSection, SaveManager, IStorage + MemoryStorage
- CocosStorage: единственный файл модуля, знающий про движок;
  при отказе хранилища уходит в память, а не роняет игру
- StatsSection: сыграно/побед/поражений/ничьих, текущая и лучшая серия
- терпимая загрузка: битый JSON, чужая версия, сломанная секция
  или отвалившееся хранилище не ломают остальное
- проверка чистоты расширена на modules/ со списком адаптеров

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 10:45:52 +03:00

98 lines
4.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Development plan
Living document. Updated as work progresses — each milestone is committed to
`master` together with the update to this file.
**Legend:** `[ ]` not started · `[~]` in progress · `[x]` done
Source specs this plan implements: [GAMEPLAY.md](GAMEPLAY.md),
[ARCHITECTURE.md](ARCHITECTURE.md), [LOBBY.md](LOBBY.md), [UI.md](UI.md),
[ART.md](ART.md). Autonomous choices are logged in [DECISIONS.md](DECISIONS.md);
the resulting structure is described in [TECHNICAL.md](TECHNICAL.md).
## Iteration 1 scope
Single-player match of *podkidnoy durak* against a bot, 1v1, no transferring
(*perevod*). Lobby → match → result → lobby. Savegame framework in place with a
statistics section only (no currency, no levels yet). Portrait mobile UI,
targets: Web, Android, iOS.
## Guiding principle
The rules live in a **pure TypeScript core with no `cc` imports**, driven as a
deterministic state machine. That makes the whole game logic testable headlessly
with `npm test` — no editor, no device — which is what allows unattended
progress. The Cocos layer only renders state and turns taps into actions.
## Milestones
### M0 — Foundation `[x]`
- [x] Read specs, confirm open questions with the user
- [x] `docs/PLAN.md`, `docs/TECHNICAL.md`, `docs/DECISIONS.md`
- [x] Asset folder skeleton under `assets/`
- [x] Project settings: design resolution 1080×1920, fit-width
- [x] Headless test harness (vitest) wired to `assets/scripts/core`, plus a
`core` purity guard and a strict typecheck
### M1 — Rules core `[x]`
- [x] Seeded RNG and shuffle
- [x] `Suit`, `Rank`, `Card`, 36-card deck
- [x] `GameState`: hands, deck, trump, table slots, discard, phase, turn order
- [x] First-attacker selection per GAMEPLAY.md (lowest trump → lowest card → random)
- [x] Legal action generation: `Attack`, `Defend`, `Take`, `Pass`
- [x] Turn resolution: beat-all / take, discard, draw order, player elimination
- [x] End conditions and loser ("fool") determination
- [x] Unit tests covering every rule clause, including the add-card limits
### M2 — Bot and headless match runner `[x]`
- [x] `PlayerView` projection — a bot sees only what a player legitimately sees
- [x] `BasicBot` exactly per GAMEPLAY.md "Basic bot"
- [x] `MatchRunner` driving a full headless match
- [x] Soak test: thousands of seeded self-play matches finish with no illegal state
### M3 — Savegame module `[x]`
- [x] `ISaveSection` contract, `SaveManager` registry, JSON keyed by section name
- [x] Storage backend over `sys.localStorage` (works on web and native)
- [x] `StatsSection`: games played / won / lost, current and best win streak
- [x] Versioning + tolerant load (unknown or missing sections do not break a load)
- [x] Tests for save/load round-trip and corrupted-payload recovery
### M4 — Art pipeline `[ ]`
- [ ] Pick the 36 needed faces from `local/`, downscale to the 1080-wide budget
- [ ] Author the missing pieces: card back, table background, UI panels/buttons
- [ ] Import into `assets/art/`, configure sprite frames and atlasing
- [ ] Remove consumed source art from `local/`, record attribution/licence
### M5 — Scenes and bootstrap `[ ]`
- [ ] `loader` scene: module initialisation, then transition to `lobby`
- [ ] `lobby` scene: New Game button, statistics readout
- [ ] Canvas / resolution policy and a reusable safe-area-aware layout root
### M6 — Game screen `[ ]`
- [ ] `Card` prefab, face/back flipping, sizing
- [ ] Hand layout (fan), table layout (attack/defence pairs), deck and trump display
- [ ] Deal, attack, defend, take and discard animations driven by core events
- [ ] Tap/drag input producing core actions; illegal moves visibly rejected
- [ ] Bot acts with human-readable pacing
### M7 — Match flow `[ ]`
- [ ] Result overlay (win / lose), stats written through the savegame module
- [ ] Return to lobby; start another match without a scene leak
- [ ] Optional: surrender / leave match
### M8 — Responsive and touch pass `[ ]`
- [ ] Verify layout from 4:3 to 21:9, portrait
- [ ] All interactive elements meet a minimum tap size
- [ ] Editor preview screenshots at the extreme aspect ratios
### M9 — Build verification and hand-off `[ ]`
- [ ] Web-mobile build runs end to end
- [ ] Android/iOS build settings documented (ASTC per ART.md)
- [ ] README / TECHNICAL.md final pass
## Deliberately out of scope for iteration 1
Multiplayer or networking, more than two players at the table (the core is
written for N players, but only 1v1 is exercised), transferring (*perevod*),
smarter bots, currency, levels, shop, sound design, localisation.