A networked multiplayer implementation of the classic Battleship game with enhanced features.
- Multiplayer Network Play: Play against other players over a network connection
- Spectator Mode: Watch ongoing games between other players
- Chat System: In-game chat with other players
- Secure Protocol: Custom secure protocol for game communication
- Reconnection System: Ability to reconnect to ongoing games if disconnected
The following enhancements have been added to the game:
The game now supports different gameplay modes:
- Classic Mode: Traditional Battleship with standard rules
- Quick Game Mode: Smaller board, fewer ships for faster games
- Salvo Mode: Fire multiple shots per turn equal to your remaining ships
- Advanced Mode: Larger board with diagonal ship placement allowed
Player performance statistics are now tracked across games:
- Win/loss record
- Ships sunk
- Shot accuracy
- Rank progression based on performance
- Per-game mode statistics
Full game replay functionality:
- Games are automatically recorded
- Replay viewer with step-by-step playback
- Auto-play mode with adjustable speed
- Jump to specific moves in the game
- Save and share replays with other players
New options for customizing the game:
- Board size options (6x6, 8x8, 10x10, 12x12)
- Custom ship configurations
- Timeout settings
- Server configuration
- battleship.py: Core game logic and data structures
- server.py: Network server for handling multiplayer games
- client.py: Client application for connecting to the server
- game_settings.py: Configurable game parameters
- stats_tracker.py: Player statistics tracking system
- game_modes.py: Implementation of different game modes
- game_replay.py: Game recording and replay functionality
- replay_viewer.py: Command-line utility for viewing game replays
- Start the server:
python server.py
- Start the client:
python client.py
-
Follow the prompts to enter your username and connect to a game.
-
Replay saved games:
python replay_viewer.py
- Place ships:
PLACE <coordinate> <orientation> <ship_name>- Example:
PLACE A1 H BATTLESHIP
- Example:
- Fire at opponent:
<coordinate>- Example:
B5
- Example:
- Send chat message:
CHAT <message> - View statistics:
STATS - Select game mode:
MODE <mode_name> - Help command:
HELP
| Mode | Board Size | Ships | Special Features |
|---|---|---|---|
| Classic | 10x10 | 5 ships | Standard rules |
| Quick | 6x6 | 3 ships | Fast games |
| Salvo | 10x10 | 5 ships | Multiple shots per turn |
| Advanced | 12x12 | 6 ships | Diagonal ship placement |