Skip to content

tre-systems/delta-v

Repository files navigation

🚀 Delta-V

TypeScript Cloudflare Workers HTML5 Canvas Vitest

Buy Me a Coffee at ko-fi.com

Delta-V Tactical Map

Delta-V is an online, real-time multiplayer tactical space combat and racing game featuring realistic vector movement and orbital gravity mechanics across the inner Solar System.

Command your fleet, master astrogation trajectories, sling-shot around celestial bodies, and engage in high-stakes combat where positioning and velocity are just as crucial as firepower.

Check out our Ship Aesthetics & Visual Style Guide to see the high-fidelity concept art for our fleet.

🌟 Features

☄️ Realistic Vector Physics Spaceflight

  • Vector Movement Engine: Your velocity persists between turns. Plan your burns carefully; there's no friction to stop you.
  • Orbital Mechanics: Planetary gravity deflects your course. Master "Weak" and "Full" gravity wells to execute slingshot maneuvers.
  • Continuous Rendering vs Discrete Logic: The visual rendering provides a smooth, continuous-space aesthetic, whilst all game logic acts on a strict, pure axial hex-coordinate system.

⚔️ Deep Tactical Combat

  • Odds-Based Combat: Gun combat utilizes a classic odds-based dice resolution system, influenced by relative velocity and range modifiers.
  • Ordnance Management: Equip and deploy mines, torpedoes, and devastating nukes.
  • Damage & Repairs: Complex damage tracking (disabled turns vs. cumulative elimination). Find safe harbor at planetary bases for repairs and resupply.

🎮 Multiple Game Modes

  • 8 Playable Scenarios: Features Bi-Planetary, Escape, Convoy, Duel, Blockade Runner, Fleet Action, Interplanetary War, and Grand Tour race.
  • Local AI Opponent: Test your skills offline against an AI component with configurable difficulty levels.
  • Real-Time Multiplayer: Built for fast, responsive web-socket based remote play.

🛠️ Architecture

Delta-V adopts an elegant, robust architecture utilizing modern web primitives:

src/
├── shared/              # Pure Game Engine (Shared between Client & Server)
│   ├── engine/            # Core state machine (createGame, processAstrogation, combat, ordnance, victory)
│   ├── movement.ts        # Vector astrogation & gravity logic
│   ├── combat.ts          # Odds resolution & damage tables
│   ├── hex.ts             # Axial hex coordinate math
│   ├── map-data.ts        # Solar system bodies, gravity, bases, scenarios
│   └── ai.ts              # AI opponent for single-player
├── server/              # Cloudflare Workers Backend
│   ├── index.ts           # HTTP entry point & WebSocket routing
│   └── game-do/           # Durable Object: state, messages, sessions, turns
└── client/              # Browser Frontend
    ├── main.ts            # Client-side state machine & networking
    ├── game/              # Game logic helpers (combat, burn, phase, ordnance, input)
    ├── renderer/          # Canvas rendering, camera, animations, minimap
    └── ui/                # DOM overlays (menu, HUD, game log, game over)
scripts/                 # Automated Bot & AI Simulation tests

Design Highlight: The core game-engine.ts is purely functional. It receives inputs (astrogation orders, combat declarations) and deterministically produces the new state. This guarantees synchronization between server and client without complex reconciliation, and makes the game highly unit testable. The backend stays authoritative through Cloudflare Durable Objects, handling room lifecycle, tokenized joins, validation, and state persistence.

For project conventions and refactoring guidance, see CODING_STANDARDS.md.


🚀 Quick Start

Get your thrusters firing locally in seconds:

  1. Use the Project Node Version

    nvm use

    Delta-V is tested in CI with Node 25.x.

  2. Install Dependencies

    npm install
  3. Start the Local Development Server

    npm run dev

    This starts the Wrangler server.

  4. Play the Game

    • Open your browser to http://localhost:8787
    • Open a second tab or window to the same URL.
    • Create a game in tab 1, then use the generated invite link in tab 2.

CLI Commands

Command Description
npm run dev Start local development server (Wrangler/esbuild)
npm run build Build the client bundle
npm run typecheck Run TypeScript type checking across the project
npm test Run all unit tests via Vitest
npm run test:coverage Run tests with a coverage report under coverage/
npm run test:watch Run Vitest in continuous watch mode
npm run simulate Run headless AI vs AI matches to test game balance and engine stability
npm run deploy Deploy straight to Cloudflare Workers

📜 Game Rules Reference

For the comprehensive ruleset detailing movement edge cases, damage tables, and specific scenario rules, refer to SPEC.md.

🗺️ Roadmap

Complete

  • Server hardening (tokenized rooms, authenticated reconnects, runtime payload validation)
  • Hidden information (Fog of War, server-side state filtering for Escape)
  • AI opponent (Easy/Normal/Hard, gravity-aware pathfinding)
  • Orbital bases (carrying, emplacing, torpedo launching)
  • PWA support (installable, offline single-player)
  • Premium polish (glassmorphism UI, procedural SFX, micro-animations)
  • 880 tests across 57 suites, 8 scenario AI simulations

Planned

  • Asteroid Map Visuals: Render asteroid fields to match docs/map.png
  • New Scenarios: Lateral 7, Fleet Mutiny, Retribution (require logistics mechanics)
  • Logistics: Surrender, looting, rescue, fuel transfer, capture, cargo handling
  • Spectator Mode: Third-party connections to watch ongoing battles
  • Turn Replay: Review past turns and full game history

📄 License

All rights reserved.

About

Delta-V: A tactical space combat game with realistic vector physics and orbital mechanics. Command your fleet across the inner Solar System.

Topics

Resources

Security policy

Stars

Watchers

Forks

Contributors