You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,7 +120,7 @@ For the comprehensive ruleset detailing movement edge cases, damage tables, and
120
120
-[x]**Runtime Payload Validation**: Strict server-side WebSocket payload validation before dispatch.
121
121
-[x]**Orbital Bases**: Carrying and emplacing strategic stations during play.
122
122
-[ ]**Client-Side Test Coverage**: Browser-facing orchestration, UI, and input flows still need dedicated tests.
123
-
-[ ]**Asteroid Map Visuals**: The in-game tactical map should match [docs/map.png](/Users/robertgilks/Source/delta-v/docs/map.png) and visibly render asteroid fields.
123
+
-[ ]**Asteroid Map Visuals**: The in-game tactical map should match [docs/map.png](./docs/map.png) and visibly render asteroid fields.
124
124
-[ ]**Spectator Mode**: Allowing third-party connections to watch ongoing battles.
Copy file name to clipboardExpand all lines: docs/ARCHITECTURE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Delta-V employs a full-stack TypeScript architecture built around a **shared pur
10
10
-**Language**: TypeScript (strict mode) across the entire stack.
11
11
-**Frontend**: HTML5 Canvas 2D API for rendering (`client/renderer.ts`), raw DOM/Events for UI and Input. No heavy frameworks (React/Vue/etc.) are used, ensuring maximum performance for the game loop.
12
12
-**Backend**: Cloudflare Workers for HTTP routing and Cloudflare Durable Objects for authoritative game state and WebSocket management.
13
-
-**Build & Tools**: `esbuild` for lightening-fast client bundling, `wrangler` for local testing and deployment, and `vitest` for unit testing.
13
+
-**Build & Tools**: `esbuild` for lightning-fast client bundling, `wrangler` for local testing and deployment, and `vitest` for unit testing.
Copy file name to clipboardExpand all lines: docs/SECURITY.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Delta-V now has a materially stronger authoritative-server boundary than the ori
9
9
- WebSocket actions are still resolved server-side against the authoritative game engine.
10
10
- Hidden-identity state is filtered per player before broadcast, so the fugitive flag itself is not sent to the opponent.
11
11
- Room creation is now authoritative: `/create` initializes the room, locks the scenario up front, and rejects room-code collisions.
12
-
- The room creator receives a reserved player token for seat 0, and the copied invite link carries a guest-seat token for seat 1.
12
+
- The room creator receives a reserved player token for seat 0, and the copied invite link carries a guest invite token for seat 1.
13
13
- Once the guest joins, that invite token is rotated into a private reconnect token for that player.
14
14
- Reconnects require the stored player token, which prevents the old "next socket steals the disconnected seat" failure mode.
15
15
- Client-to-server WebSocket messages are runtime-validated before any engine handler executes, and malformed payloads are rejected instead of being trusted structurally.
Copy file name to clipboardExpand all lines: docs/SIMULATION_TESTING.md
+15-7Lines changed: 15 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,20 @@
1
1
# Delta-V Simulation Testing Strategy
2
2
3
-
To ensure game balance, test edge cases, and validate the stability of the Durable Objects backend, we can implement two distinct types of simulation testing: **Headless Engine Simulation (AI vs AI)**and **Network Integration Simulation (PvP Bot Stress Testing)**.
3
+
Delta-V now has one established simulation layer and one still-planned layer:
4
4
5
-
Since the core `game-engine.ts` is purely functional and deterministic, creating high-speed simulations is extremely feasible.
5
+
-**Headless Engine Simulation (AI vs AI)** is implemented and runs in CI.
6
+
-**Network Integration Simulation (PvP Bot Stress Testing)** is still future work.
7
+
8
+
Since the core `game-engine.ts` is purely functional and deterministic apart from injected RNG, high-speed simulation is practical.
6
9
7
10
---
8
11
9
12
## 1. Headless Engine Simulation (AI vs AI)
10
13
11
-
**Goal:** Run thousands of games in seconds to test scenario balance, AI effectiveness, and find crash-inducing edge cases deep in the game tree. (Implemented in `scripts/simulate-ai.ts`).
14
+
**Goal:** Run large batches of AI-vs-AI games quickly to test scenario balance, AI effectiveness, and find crash-inducing edge cases deep in the game tree. This is implemented in `scripts/simulate-ai.ts`.
12
15
13
16
**Approach:**
14
-
Create a new Node script (e.g., `scripts/simulate-ai.ts`) that runs outside the browser and the Cloudflare Worker, executing purely in Node.js.
17
+
The current runner executes entirely in Node.js, outside the browser and Cloudflare Worker runtime.
15
18
16
19
1.**Setup:** Initialize `GameState` using `createGame(SCENARIOS[name], map, ...)`.
17
20
2.**Game Loop:** Put the engine in a `while (state.phase !== 'gameOver')` loop.
@@ -22,17 +25,22 @@ Create a new Node script (e.g., `scripts/simulate-ai.ts`) that runs outside the
22
25
4.**Data Collection:** Track metrics like win rates (Player 0 vs Player 1), average turns to win, fuel consumed, and most common causes of death (combat vs crashes).
23
26
24
27
**Implementation Details:**
25
-
- Because the `game-engine.ts` has no DOM or Canvas dependencies, this can run extraordinarily fast.
28
+
- Because the `game-engine.ts` has no DOM or Canvas dependencies, this runs very quickly in practice.
26
29
- You can run Monte Carlo simulations (e.g., 10,000 runs of the 'Escape' scenario) to definitively prove if the scenario favors the escaping player or the blockading player.
27
30
-**Randomness:** The combat engine relies on `Math.random()`. Passing a seeded random number generator (RNG) into `processCombat` and `processAstrogation` allows for completely reproducible replays when a simulation encounters a crash or an infinite loop.
28
31
32
+
**Current usage:**
33
+
-`npm run simulate` runs 100 headless games of the default scenario.
34
+
-`npm run simulate all 100 -- --ci` is the current CI stress pass across all scenarios.
35
+
-`--ci` fails the process on engine crashes and prints balance warnings without making them fatal.
Copy file name to clipboardExpand all lines: docs/SPEC.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ static/
48
48
49
49
**Worker (lobby-worker):**
50
50
-`GET /` — Serves the SPA (index.html + bundled JS/CSS)
51
-
-`POST /create` — Generates a 5-character invite code plus creator/guest tokens, initializes the Durable Object room, and locks the chosen scenario
51
+
-`POST /create` — Generates a 5-character invite code plus a creator reconnect token and a guest invite token, initializes the Durable Object room, and locks the chosen scenario
52
52
-`GET /ws/:code` — WebSocket upgrade, proxied to the Durable Object
53
53
54
54
**Durable Object (game-do):**
@@ -61,7 +61,7 @@ static/
61
61
62
62
### Invite / Join Flow (No Lobby, No Login)
63
63
64
-
1. Player 1 clicks "Create Game" → `POST /create` → receives 5-char code plus creator and guest tokens
64
+
1. Player 1 clicks "Create Game" → `POST /create` → receives a 5-char code plus a creator reconnect token and a guest invite token
65
65
2. UI shows the code prominently + a shareable invite link (`https://delta-v.example.com/?code=K7M2X&playerToken=...`)
66
66
3. Player 1 can copy link or share via native Share API
67
67
4. Player 2 receives the invite link or an equivalent tokenized join URL
@@ -90,25 +90,24 @@ When a player is planning movement, subtle dot markers or a faint radial guide m
90
90
The map represents the inner Solar System along the ecliptic plane:
91
91
92
92
**Celestial Bodies (with gravity hexes):**
93
-
-**Sol** (Sun) — center of map, large body, multiple gravity hexes, any contact = destruction
94
-
-**Mercury** — small, 2 bases, gravity hexes
95
-
-**Venus** — medium, bases on all 6 sides, gravity hexes
-**Luna** — small satellite, weak gravity (hollow arrows), 1 base
98
-
-**Mars** — medium, 2 bases, gravity hexes
99
-
- Has two tiny moons (no gameplay effect in basic scenarios)
100
-
-**Jupiter** — large, off-map or map edge, gravity hexes
101
-
-**Io** — satellite, weak gravity, 1 base
102
-
-**Callisto** — satellite, weak gravity, 1 base
103
-
-**Ganymede** — satellite, no base in basic scenarios
104
-
-**Ceres** — asteroid, 1 base
105
-
-**Asteroid Belt** — scattered asteroid hexes between Mars and Jupiter
93
+
-**Sol** (Sun) — center of map, radius-2 body with two full-gravity rings; any contact = destruction
94
+
-**Mercury** — single-hex body with one full-gravity ring and 2 base hexes
95
+
-**Venus** — radius-1 body with one full-gravity ring and bases on all 6 sides
96
+
-**Terra** (Earth) — radius-1 body with one full-gravity ring and bases on all 6 sides
97
+
-**Luna** — single-hex moon with one weak-gravity ring and bases on all 6 sides
98
+
-**Mars** — single-hex body with one full-gravity ring and bases on all 6 sides
99
+
-**Jupiter** — large northern body with two full-gravity rings
100
+
-**Io** — single-hex moon with one weak-gravity ring and 1 base
101
+
-**Callisto** — single-hex moon with one weak-gravity ring and 1 base
102
+
-**Ganymede** — single-hex moon with one weak-gravity ring and no base
103
+
-**Ceres** — single-hex asteroid body with 1 base and no gravity
104
+
-**Asteroid Belt** — scattered asteroid hexes between the inner planets and Jupiter
106
105
107
106
**Gravity types:**
108
107
-**Full gravity**: mandatory 1-hex deflection toward the body for any object passing through
109
-
-**Weak gravity** (Luna, Io): player may choose to use or ignore when passing through a single weak gravity hex. Two consecutive weak gravity hexes = full gravity effect on the second.
108
+
-**Weak gravity** (Luna, Io, Callisto, Ganymede): player may choose to use or ignore when passing through a single weak gravity hex. Two consecutive weak gravity hexes = full gravity effect on the second.
110
109
111
-
**The map data is defined as a static JSON structure**listing every hex with its terrain type (empty, gravity, asteroid, planet surface, base).
110
+
**The map data lives in a static TypeScript module**that programmatically builds body surfaces, gravity rings, base hexes, asteroid terrain, and scenario definitions.
112
111
113
112
### Vector Movement
114
113
@@ -790,14 +789,15 @@ interface ScenarioPlayer {
790
789
-[x] Server hardening for competitive play (tokenized room access, authenticated reconnect tokens, scenario locking at room creation, and runtime WebSocket payload validation)
791
790
-[x] Runtime WebSocket payload validation
792
791
-[x] Orbital bases (carrying, emplacing, torpedo launching)
792
+
-[x] PWA support (installable shell with offline-capable single-player)
793
793
-[ ] Browser-side orchestration and UI test coverage
794
+
-[ ] Asteroid map visuals to match `docs/map.png`
794
795
-[ ] Advanced features: looting, surrender, rescue, and richer logistics
795
796
-[ ] Improved animations (particle effects for thrust, gravity lensing)
796
797
-[ ] Turn history replay
797
798
-[ ] Spectator mode
798
799
-[ ] Game state persistence (resume interrupted games across sessions)
799
800
-[ ] Performance optimization for mobile
800
-
-[ ] PWA support (installable, offline-capable menu)
0 commit comments