Deathwalker boardgame for boardgamearena.com
  • PHP 76.3%
  • TypeScript 10.7%
  • JavaScript 10%
  • CSS 3%
Find a file
2026-04-26 20:39:42 +01:00
.vscode feat(actions): finish - actions per round 2026-04-11 16:33:35 +01:00
docs Delete issue-16-biome-street.md 2026-04-26 19:25:58 +01:00
img initial commit 2026-03-29 04:27:19 +01:00
misc docs: move 2026-04-04 22:06:41 +01:00
modules fix(biome-street): return feature value for already-flipped tiles 2026-04-26 20:34:49 +01:00
src fix(biome-street): show feature token on move/flee notifications 2026-04-26 20:17:18 +01:00
.gitignore Update .gitignore 2026-04-03 22:36:32 +01:00
_ide_helper.php chore: update bga files 2026-04-24 22:10:27 +01:00
AGENTS.md docs: add UserException pattern to AGENTS.md 2026-04-24 22:47:42 +01:00
bga-framework.d.ts chore: update bga files 2026-04-24 22:10:27 +01:00
dbmodel.sql feat(biome-street): step 1 - add tile_feature column to tiles table 2026-04-26 18:12:56 +01:00
deathwalker.css fix: center feature token on tile like walker token 2026-04-26 20:18:57 +01:00
gameinfos.inc.php chore: game info self publish 2026-03-31 12:32:16 +01:00
gameoptions.json initial commit 2026-03-29 04:27:19 +01:00
gamepreferences.json initial commit 2026-03-29 04:27:19 +01:00
LICENCE_BGA initial commit 2026-03-29 04:27:19 +01:00
package-lock.json feat: add ts, auto highlight 2026-04-03 22:43:36 +01:00
package.json refactor: move and create helper 2026-04-11 23:29:51 +01:00
README.md Update README.md 2026-04-19 21:15:05 +01:00
stats.json initial commit 2026-03-29 04:27:19 +01:00
tsconfig.json feat: add ts, auto highlight 2026-04-03 22:43:36 +01:00

Deathwalker

A cooperative zombie RPG turn-based board game running on Board Game Arena (BGA).

Project Status: Early Development (template-based start)

Game Overview

Deathwalker is a cooperative board game inspired by pen & paper RPGs like Dungeons & Dragons. Players work together to survive zombie outbreaks in a post-apocalyptic world. The game features:

  • 2-4 players (configurable, with potential for 6)
  • 30-60 minute missions
  • Easy-to-learn rules with RPG elements
  • Theme: Post-apocalyptic zombie survival

Project Structure

deathwalker/                  # Root synced to BGA Studio via SFTP
├── _ide_helper.php           # PHP IDE type hints (local only, not synced)
├── bga-framework.d.ts        # TypeScript definitions (local only, not synced)
├── gameinfos.inc.php         # Game metadata (name, players, duration, colors)
├── dbmodel.sql               # Database schema extensions
├── gameoptions.json          # Game options configuration (empty = defaults)
├── gamepreferences.json      # Player preferences (empty = defaults)
├── stats.json                # Statistics configuration (empty = defaults)
├── deathwalker.css           # Game UI styling
├── modules/
│   ├── php/
│   │   ├── Game.php          # Main game logic
│   │   └── States/           # State machine implementations
│   │       ├── PlayerTurn.php
│   │       ├── NextPlayer.php
│   │       └── EndScore.php
│   └── js/                   # Compiled output (generated from src/)
│       └── Game.js           # Frontend game UI (built from TypeScript)
├── src/                      # TypeScript source files
│   ├── Game.ts               # Main UI controller
│   ├── PlayerTurn.ts         # PlayerTurn state handler
│   └── types.d.ts            # TypeScript type definitions
├── img/                      # Game artwork (not committed to git)
├── misc/                     # Dev notes (local only, not synced to BGA)
├── docs/                     # Game documentation
│   └── README.md             # Game ruleset concept
└── node_modules/             # Development dependencies (local only)

.vscode/
└── sftp.json                 # FTP sync config (not synced to BGA)

Architecture

Backend (PHP)

The PHP backend uses the new BGA Framework architecture with:

  • Game.php - Main game class extending \Bga\GameFramework\Table

    • Global variables, player counters, card types
    • setupNewGame() - Initialize game state
    • getAllDatas() - Return data visible to current player
    • upgradeTableDb() - Database migrations
  • State Classes - Each game state is a class in modules/php/States/

    • Extend \Bga\GameFramework\States\GameState
    • Use #[PossibleAction] attributes for player actions
    • Return next state class or state ID at the end of actions
    • Support zombie mode for disconnected players

Frontend (TypeScript → JavaScript)

The UI code is written in TypeScript in src/ and compiled to modules/js/:

  • src/Game.ts - Main UI controller

    • setup() - Initialize game interface from gamedatas
    • setupNotifications() - Handle server notifications
    • movePlayerToken() - Update player position on board
  • State Classes (e.g., src/PlayerTurn.ts)

    • onEnteringState() - UI setup when entering state
    • onLeavingState() - Cleanup when leaving state
    • onPlayerActivationChange() - Handle active player changes

Build Process:

src/Game.ts ──(tsc)──> modules/js/Game.js

Communication Pattern

  1. Player clicks button → JS calls bga.actions.performAction("actionName", args)
  2. PHP validates and processes → returns next state
  3. PHP sends notifications via $this->bga->notify->all() or notifyPlayer()
  4. JS handles notifications via notif_* methods

Development Workflow

Prerequisites

  • BGA Studio account (for testing on the platform)
  • Local PHP 8.x environment (for syntax checking)
  • Node.js (for TypeScript compilation and code formatting)
  • VS Code with SFTP extension (for syncing to BGA)

Deployment: Local Git + BGA FTP Sync

This project uses a dual versioning workflow:

┌─────────────────┐     git commit      ┌─────────────────┐
│   Local Git     │ ──────────────────> │  Local Backup   │
│   Repository    │                     │  (GitHub/etc)   │
└─────────────────┘                     └─────────────────┘
        │
        │ VS Code SFTP
        │ (auto-sync on save)
        ▼
┌─────────────────┐                    ┌─────────────────┐
│  BGA Studio     │ <─── SVN ────────  │  BGA SVN        │
│  (FTP upload)   │                    │  (production)   │
└─────────────────┘                    └─────────────────┘

Important: The .vscode/sftp.json configures automatic upload to BGA on save, but excludes several files and folders.

Deployment Steps

  1. Code locally with git for version control
  2. Save files - SFTP automatically syncs to studio.boardgamearena.com:/deathwalker/
  3. Test on BGA Studio - Use the Studio sandbox to playtest
  4. BGA handles SVN - Their system commits to their version control

Note: The misc/ folder contains development notes and is excluded from BGA sync. Keep your working notes there.

Building TypeScript

npm run build     # Compile TypeScript to modules/js/
npm run watch     # Watch mode for development

Code Formatting

The project uses Prettier with PHP plugin:

npm run format    # Format all PHP files

Running on BGA Studio

  1. Zip the project directory
  2. Upload to BGA Studio
  3. Test in the Studio sandbox environment
  4. Use the Debug panel to jump to specific states

Framework Components (Available)

The BGA framework provides many components. See _ide_helper.php and bga-framework.d.ts:

  • Counters - PlayerCounter, TableCounter for tracking values
  • Deck - Card deck management
  • Notifications - notify->all(), notifyPlayer() with i18n support
  • Player Management - activeNextPlayer(), giveExtraTime()
  • Scoring - playerScore->inc(), etc.

License

See LICENCE_BGA for Board Game Arena licensing terms.