Files
pinball-duel/README.md
aevgarik dc53623001 Phase 0-2: Vite/Phaser 4/TS boilerplate + Platform Adapter + core match (vs 4 AI personalities)
Phase 0 (foundation):
- package.json, tsconfig.json (strict), vite.config.ts (base: './'), .eslintrc.cjs
- index.html, src/main.ts (Phaser game init + platform detection)
- src/config/defaults.ts (Remote Config defaults, palette, constants)
- src/types/index.ts (все schemas из data-contracts: SaveState, MatchResult, RemoteConfig, etc.)
- src/platform/: PlatformAdapter interface + MockPlatformAdapter + YgPlatformAdapter

Phase 1 (core mechanics):
- src/scenes/: Boot, Preload, MainMenu (Quick Match selector), Setup, Match, Result
- src/game/: Table (геометрия + walls + ворота), Ball (last-touch + color tracking), Flipper (player + AI, swing + cooldown), Bumper (4 типа: standard/slingshot/curve/turbo)
- src/scoring/: MatchTracker (last-touch + bumper points), calculateScores (unified scoring pipeline per data-contracts v3.8 requirement)
- src/ai/: AIPlayer interface + DefensiveAI Easy/Medium

Phase 2 (setup + AI personalities):
- src/scenes/SetupScene (5 active slots, click-cycle bumper types, 30s timer)
- src/ai/personalities/: AggressiveAI, TricksterAI, GhostAI (Easy/Medium; Hard cradle-aim = Phase 3)
- src/ai/factory.ts (createAIPlayer)
- MainMenuScene: выбор AI-личности + сложности
- MatchScene использует factory вместо хардкода

Anti-A2W enforcement: calculateScores применяет penalty per v3.5 model
(Continue × 0.5, Campaign Skip × 0.7, +1 заряд × 0.9, реролл × 0.85,
Boost active × 0.7; ×2 sezon очки только в local).

Что НЕ в этом commit'е (следующие фазы):
- Phase 3: бустер «Захват» (cradle + slow-mo), Hard AI (cradle-aim solver), Ghost adaptation, YG Player API cloud-save, achievements
- Phase 4: Campaign (12 матчей), Tournament (8/16 bracket), шейдеры (CRT + bloom + chromatic aberration), 29 AI-арт ассетов, музыка
- Phase 5: реальная YG SDK интеграция (ads + payments), Remote Config Nakama RPC
- Phase 6: YG submission

Pre-greenlit concept-пакет — ~/Knowledge/Projects/pinball-duel/ (19 файлов, 10 audit-раундов).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 03:25:17 +03:00

3.6 KiB
Raw Blame History

Pinball-Duel

Single-player пинбол vs 4 AI-личности (head-to-head формат, Williams Joust 1983).

Stack: Phaser 4 (beta) + TypeScript + Vite + Matter.js (bundled). Capacitor добавляется в Phase 1.5.

Platforms:

  • MVP: Yandex Games (web only)
  • Phase 1.5 (post-MVP-launch): Google Play + RuStore (Android, через Capacitor)
  • Post-Phase 2: iOS (если PMF подтвердится)

Status: Phase 0 (pre-production) в процессе. Концепт-пакет — ~/Knowledge/Projects/pinball-duel/ (19 файлов, 10 audit-раундов).

Development

Requirements

  • Node.js 20+
  • npm

Setup

npm install
npm run dev          # localhost:5173

Build & checks

npm run build        # type-check + production build → dist/
npm run preview      # serve build locally
npm run typecheck    # tsc --noEmit
npm run lint         # ESLint
npm run test         # Vitest

Architecture

Game stack

  • Phaser 4 — game engine + Matter.js physics (bundled)
  • TypeScript strict — все типы из src/types/index.ts (схемы из data-contracts.md)
  • Vite — bundler + dev server (с base: './' для YG)

Platform Adapter

Game-код не знает о платформе через PlatformAdapter interface (src/platform/). Реализации:

  • MockPlatformAdapter — local dev и unit tests
  • YgPlatformAdapter — Yandex Games SDK (MVP)
  • CapacitorAdmobAdapter — Phase 1.5 (Play)
  • RuStorePlatformAdapter — Phase 1.5 (RuStore)

Detection и factory в PlatformAdapter.ts::createPlatformAdapter().

Структура папок

src/
  config/      Remote Config defaults, палитра, константы
  types/       SaveState, MatchResult, RemoteConfig, etc.
  platform/    PlatformAdapter interface + 4 реализации
  scenes/      Phaser scenes (Boot, Preload, MainMenu, Setup, Match, Result)
  game/        Game objects (Ball, Flipper, Bumper, Table, Match orchestration)
  ai/          AI personalities (Defensive, Aggressive, Trickster, Ghost) + heuristics
  scoring/     calculateScores + MatchTracker (last-touch + bumper points)

Фазовый план

Phase Содержание
0 ( в работе) Vite + Phaser 4 + TS boilerplate; Platform Adapter
1 Core mechanics: матч, флипперы, мяч, last-touch, fixed bumpers, Defensive Easy AI
2 Setup-фаза, 4 BumperType, 4 AI-личности × 3 сложности
3 Бустер «Захват» (cradle), Hard AI, cloud-save, achievements
4 Campaign + Tournament + визуальный polish (шейдеры), ассеты
5 YG SDK ads + payments + Remote Config
6 YG polish + submission + soft launch
1.5 (post-MVP launch) Capacitor: Google Play + RuStore mobile native

Документация (концепт-пакет)

~/Knowledge/Projects/pinball-duel/ — 19 файлов:

  • index.md — overview + decision-history (10 audit-раундов)
  • concepts/scope-lock.md — что в каждой фазе (single source of truth)
  • concepts/data-contracts.md — все schema'ы (Remote Config, MatchResult, SaveState, leaderboard formula)
  • concepts/definition-of-done.md — DoD per фаза
  • concepts/telemetry-spec.md — event map
  • concepts/development-roadmap.md — план разработки
  • concepts/monetization.md — IAP + Anti-A2W правило
  • concepts/bot-ai-design.md — 4 AI-личности
  • player-guide.md — narrative-руководство игрока

License

Proprietary, all rights reserved.