Thomas Richter b52cdb0685 Add comprehensive test suite with Vitest and Playwright
**Unit Tests (Vitest):**
- Test game logic: inventory management, barrel calculations
- Test whale hunting mechanics: fuel consumption, oil rewards, health system
- Test mobile detection patterns
- Test crosshair bounds and scene transitions
- 21 unit tests covering core game logic
- Fast execution with jsdom environment

**E2E Tests (Playwright):**
- Test complete game flows from intro to hunting
- Test scene navigation and transitions
- Test whale hunting interaction
- Test mobile compatibility and touch interactions
- Test desktop scaling on various viewports
- Run on both desktop (Chrome) and mobile (iPhone 12) configurations

**Test Scripts:**
- npm test - Run unit tests
- npm run test:ui - Run unit tests with UI
- npm run test:coverage - Run with coverage report
- npm run test:e2e - Run E2E tests
- npm run test:e2e:ui - Run E2E tests with UI
- npm run test:all - Run all tests

**Configuration:**
- Vitest configured with jsdom for fast unit testing
- Playwright configured with automatic dev server startup
- Test coverage reporting enabled
- Separate unit and E2E test directories

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-18 06:48:02 +01:00

Whale Hunting - A Point & Click Adventure

A Monkey Island-style adventure game based on 18th century whaling history, including the dark practice of burning penguins as emergency fuel when traditional fuel ran out.

Setup

Install Dependencies

npm install

Run Development Server

npm run dev

The game will be available at http://localhost:5173 (or another port shown in the terminal).

Build for Production

npm run build

The built files will be in the dist/ directory.

Docker Deployment

# Build and start the container
docker-compose up -d

# View logs
docker-compose logs -f

# Stop the container
docker-compose down

The game will be available at http://localhost:8080

Using Docker directly

# Build the image
docker build -t whalehunting-game .

# Run the container
docker run -d -p 8080:80 --name whalehunting whalehunting-game

# View logs
docker logs -f whalehunting

# Stop and remove container
docker stop whalehunting
docker rm whalehunting

Production Deployment Notes

  • The Docker image uses nginx to serve static files
  • Includes gzip compression for better performance
  • Health checks are configured for container monitoring
  • Security headers are enabled
  • Static assets are cached for 1 year

Project Structure

whalehunting/
├── index.html              # Main HTML file
├── package.json            # Dependencies and scripts
├── src/
│   ├── main.js            # Game initialization and configuration
│   ├── scenes/            # Game scenes
│   │   └── ShipDeckScene.js  # Ship deck scene (starting point)
│   └── game-objects/      # Reusable game objects (future)
└── assets/                # Images, sounds, etc. (future)

Current Features

  • Ship Deck Scene: Explore the deck of your whaling vessel
  • Interactive Objects: Click on barrels, the ship's wheel, and other objects
  • Inventory System: Track fuel, whale oil, and penguins
  • Message System: Get feedback when interacting with objects

Game Concept

The game simulates 18th century whaling expeditions where:

  • Whalers hunt whales to produce whale oil
  • Fuel management is critical for the voyage
  • When fuel runs out, desperate measures (burning penguins) become necessary

Next Steps

Future development could include:

  • Whale hunting mini-game/scene
  • Port scene for resupply and selling oil
  • Decision system for fuel management
  • Narrative elements and character dialogues
  • Penguin catching mechanics
  • Multiple voyages with progression
  • Art assets to replace placeholder graphics

Technology

  • Phaser 3: Game framework
  • Vite: Build tool and dev server
  • JavaScript (ES6 modules): Programming language

Controls

  • Mouse: Click to interact with objects
  • Point-and-click adventure style navigation

Development Notes

This is a prototype with placeholder graphics (colored rectangles). Art assets can be added later by:

  1. Adding images to assets/sprites/ or assets/backgrounds/
  2. Loading them in the scene's preload() method
  3. Replacing rectangle shapes with sprites
Description
Whale hunting browser game
Readme 214 KiB
Languages
JavaScript 95.5%
Shell 2.3%
HTML 1.4%
Dockerfile 0.8%