An open API service indexing awesome lists of open source software.

https://github.com/cdilga/ultimate-risk

An strategy war game that involves multiple players.
https://github.com/cdilga/ultimate-risk

Last synced: 3 months ago
JSON representation

An strategy war game that involves multiple players.

Awesome Lists containing this project

README

          

# Ultimate Risk - WW2 Strategy Game

A turn-based World War 2 strategy game featuring historically accurate nations, units, and territories in the European theatre.

## ๐ŸŽฎ Game Features

- **6 Historical Nations**: Nazi Germany, Great Britain, United States, Canada, France, Soviet Union
- **Historical Leaders**: Each nation led by their actual WW2 leader (Hitler, Churchill, Roosevelt, etc.)
- **24 European Territories**: Historically accurate map of Europe including land and naval zones
- **4 Unit Types**: Infantry, Vehicles, Naval, and Aircraft - all historically accurate
- **Turn-Based Gameplay**: Purchase phase, Combat phase, Movement phase, and Income collection
- **Currency System**: Earn income from controlled territories to purchase units
- **Combat System**: Dice-based combat with attack and defense values
- **Mobile & Desktop**: Fully responsive design works on all devices

## ๐ŸŒ Live Deployment

๐Ÿš€ **Production**: [https://ultimate-risk.dilger.dev](https://ultimate-risk.dilger.dev)

## ๐Ÿš€ Quick Start

```bash
# Clone the repository
git clone https://github.com/cdilga/ultimate-risk.git
cd ultimate-risk

# Install dependencies
npm install

# Run locally
npm run dev
```

Visit `http://localhost:8787` to play the game.

## ๐ŸŽฏ How to Play

1. **Start a New Game**: Click "New Game" to begin with 4 players (Germany, Britain, USA, Russia)
2. **Purchase Phase**: Use your starting currency to buy units (Infantry, Vehicles, Naval, Aircraft)
3. **Deploy Units**: Place purchased units in territories you control
4. **Movement Phase**: Move units to adjacent territories
5. **Combat**: When units move into enemy territories, combat is automatically resolved
6. **Collect Income**: At the end of your turn, collect income based on territory values
7. **Next Turn**: Click "Next Phase" to advance through the game phases

## ๐Ÿ—บ๏ธ Nations & Units

### Nazi Germany
- Leader: Adolf Hitler (Fรผhrer)
- Infantry: SS Infantry
- Vehicle: Panzer IV
- Naval: U-boat
- Aircraft: Bf 109

### Great Britain
- Leader: Winston Churchill (Prime Minister)
- Infantry: SAS Rogue
- Vehicle: Churchill Tank
- Naval: U-class Submarine
- Aircraft: Supermarine Spitfire

### United States
- Leader: Franklin D. Roosevelt (President)
- Infantry: Army Rangers
- Vehicle: M4 Sherman
- Naval: Fletcher-class Destroyer
- Aircraft: B-17 Flying Fortress

### Canada
- Leader: William Lyon Mackenzie King (Prime Minister)
- Infantry: Devils Brigade
- Vehicle: Ram Tank
- Naval: Tribal-class Destroyer
- Aircraft: de Havilland Mosquito

### France
- Leader: Charles de Gaulle (General)
- Infantry: French Resistance
- Vehicle: Char B1
- Naval: Surcouf Submarine
- Aircraft: Dewoitine D.520

### Soviet Union
- Leader: Joseph Stalin (General Secretary)
- Infantry: Guards Infantry
- Vehicle: T-34
- Naval: S-class Submarine
- Aircraft: Yakovlev Yak-3

## ๐Ÿ”Œ API Endpoints

The game exposes a RESTful API for all game operations:

### Game Management
- `POST /api/game/new` - Create a new game
- `GET /api/game/state?gameId={id}` - Get current game state
- `POST /api/game/next-phase` - Advance to next phase

### Game Actions
- `POST /api/game/purchase` - Purchase units
- `POST /api/game/deploy` - Deploy units to territories
- `POST /api/game/move` - Move units between territories
- `POST /api/game/combat` - Resolve combat in a territory

### Data
- `GET /api/nations` - Get all nation data
- `GET /api/territories` - Get all territory data

## ๐Ÿ“ฆ Deployment

This project automatically deploys to Cloudflare Workers when you push to the main branch.

### Manual Deployment
```bash
npm run deploy
```

## ๐Ÿ› ๏ธ Development

### Local Development
```bash
# Start development server
npm run dev

# Run unit tests
npm test

# Run E2E tests
npm run test:e2e

# Test against deployed site
npm run test:deployed
```

### Project Structure
```
src/
โ”œโ”€โ”€ index.js # Main Worker with API routes and UI
โ”œโ”€โ”€ gameData.js # Historical data (nations, territories, units)
โ””โ”€โ”€ gameLogic.js # Game state and rules engine
```

### Testing
- Unit tests use Vitest with Cloudflare Workers pool
- E2E tests use Playwright
- Tests can run against local dev server or production

## ๐ŸŽต Audio

The game includes a placeholder for background audio. To add the Erika Marschlied music:
1. Host the audio file on a CDN or include it in the project
2. Update the `` tag source in `src/index.js` (line 83)

## ๐Ÿ—๏ธ Architecture

Built on the Cloudflare Workers platform:
- **Runtime**: Cloudflare Workers (V8 isolates)
- **Frontend**: Vanilla JavaScript with Tailwind CSS
- **Storage**: In-memory (can be upgraded to Durable Objects or KV)
- **Deployment**: Automated via GitHub Actions

## ๐ŸŽจ Technology Stack

- **Backend**: Cloudflare Workers
- **Frontend**: Vanilla JavaScript, Tailwind CSS
- **Testing**: Vitest, Playwright
- **Deployment**: Wrangler CLI

## ๐Ÿ” Environment Variables

- `CLOUDFLARE_API_TOKEN`: Used for deployment (set in GitHub Secrets)
- `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare account ID

## ๐Ÿค Contributing

This is a solo project created with Claude Code. Feel free to fork and modify for your own use.

## ๐Ÿ“ Future Enhancements

Potential improvements for the future:
- Persistent game storage with Durable Objects
- Multiplayer real-time synchronization
- More detailed combat animations
- Additional nations and territories
- Diplomacy and alliance mechanics
- Save/load game functionality

## ๐Ÿค– Created with Claude

This project was automatically generated using [the-ultimate-bootstrap](https://github.com/cdilga/the-ultimate-bootstrap) and implemented by Claude Code.

## ๐Ÿ“œ License

Open source - feel free to use and modify.