No description
  • TypeScript 51.1%
  • HTML 48.3%
  • CSS 0.5%
  • Shell 0.1%
Find a file
oabrivard b02dd9be04 Add README with project overview and architecture
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 15:40:45 +02:00
design Add v3 polish spec, v2 feedback, and v3 design assets 2026-04-04 23:42:20 +02:00
docs Updated levels definition 2026-04-09 09:28:41 +02:00
e2e test: add integration tests for new scoring/power-ups and E2E for new UI 2026-04-08 12:41:26 +02:00
public Updated levels definition 2026-04-09 09:40:00 +02:00
src fix: clean up stray overlays between levels and fix move pluralization 2026-04-09 09:27:47 +02:00
test-results Updated levels 2026-04-08 19:50:12 +02:00
.gitignore Add design assets and update .gitignore 2026-04-04 13:29:23 +02:00
capacitor.config.ts feat: add Capacitor configuration for mobile deployment 2026-04-04 10:23:52 +02:00
CLAUDE.md docs: add CLAUDE.md with project guidance for Claude Code 2026-04-05 09:35:58 +02:00
deploy.sh Added deployement script 2026-04-05 22:30:34 +02:00
index.html feat: add SplashScreen, HomeScreen, BottomNav, and router integration 2026-04-04 10:15:12 +02:00
package-lock.json test: add Playwright E2E tests for navigation and UI screens 2026-04-04 11:34:36 +02:00
package.json test: add Playwright E2E tests for navigation and UI screens 2026-04-04 11:34:36 +02:00
playwright.config.ts test: add Playwright E2E tests for navigation and UI screens 2026-04-04 11:34:36 +02:00
README.md Add README with project overview and architecture 2026-04-11 15:40:45 +02:00
tsconfig.json feat: scaffold project with Vite + TypeScript + Tailwind + Phaser 2026-04-04 09:46:45 +02:00
vite.config.ts fix: exclude e2e/ from Vitest to avoid Playwright conflict 2026-04-08 12:10:47 +02:00

PegPop

A mobile puzzle game built with a hybrid DOM + Phaser 3 architecture. Jump pegs to pop, fuse and trigger power-ups across handcrafted levels.

Tech Stack

  • TypeScript + Vite — build tooling
  • Phaser 3 — canvas-based game board rendering
  • Tailwind CSS — shell UI styling ("Sugar Rush Gloss" theme)
  • Vitest + happy-dom — unit and integration tests
  • Playwright — end-to-end tests
  • Capacitor — mobile packaging

Getting Started

npm install
npm run dev

Then open the URL printed by Vite.

Scripts

npm run dev          # Vite dev server
npm run build        # TypeScript compile + Vite build
npm test             # Vitest watch mode
npm run test:ci      # Vitest single run
npm run test:e2e     # Playwright E2E tests

Run a single test file or pattern:

npx vitest run src/game/systems/Board.test.ts
npx vitest run -t "shuffle"

Architecture

PegPop uses a hybrid DOM + Phaser 3 architecture:

  • Shell UI (src/ui/) — menus, shop, overlays as vanilla DOM + Tailwind, managed by a hash-based router (src/router.ts). Each screen implements Route { mount, unmount }.
  • Game Board (src/game/scenes/BoardScene.ts) — the only Phaser Canvas scene, mounted when navigating to #game/{levelId} and destroyed on exit.
  • Event Bus (src/events.ts) — typed discriminated union GameEvent bridges Shell ↔ Phaser (GAME_WIN, GAME_DEFEAT, SCORE_UPDATE, …).

Game Systems

Pure TypeScript with no Phaser dependency, in src/game/systems/:

  • Board — grid data structure (Map-based), cell operations and shuffle()
  • MoveSystem — validates jumps, detects deadlock, determines power-ups from chain length (2→bomb, 3→ray, 4+→prism)
  • FusionSystem — executes jumps: different color pops, same color fuses (tier upgrade), cristal+cristal both disappear
  • ScoreSystem — points per action with chain multiplier (×1.5 per jump after first), star thresholds
  • ObjectiveSystem — tracks score, clear, color elimination and crystal fusion goals

Services (src/services/)

  • GameState — level completion, rank calculation, world unlocks
  • SaveManagerlocalStorage persistence (key: pegpop_save)
  • CurrencyManager — gems, lives (max 5, 20 min regen), power-up inventory
  • AudioManager + SfxSynth — Web Audio API synthesized sounds (no audio files)
  • LevelManager — fetches public/levels/level-{NNN}.json, caches in memory

Levels

Levels are JSON files in public/levels/level-{NNN}.json. Each defines board: Cell[], objectives, maxMoves and starThresholds.

Testing

  • Unit tests co-located with source (*.test.ts) — all game systems and services are covered
  • Integration tests in src/game/integration.test.ts — full gameplay scenarios using pure TS systems
  • E2E tests in e2e/navigation.spec.ts — Playwright navigation and UI

Phaser rendering, FX and audio are not unit tested (visual/audio only).

Design

"Sugar Rush Gloss" — warm rose palette, 3D glossy buttons, tonal separation over borders. Theme defined in src/style.css via @theme. Full reference in design/v3/sugar_rush_gloss/DESIGN.md.