A real-time multiplayer tank battle arena game featuring pure Java WebSocket server implementation and modern HTML5/JavaScript client. Experience fast-paced tank combat with power-ups, leaderboards, and voice chat capabilities.
- Real-time Multiplayer: Smooth 20 FPS server-side game loop with low latency
- Tank Combat: Classic top-down tank warfare with mouse aiming and WASD movement
- Power-up System: Collect shields, speed boosts, and double-fire upgrades
- Heat Management: Strategic weapon cooldown system prevents spam
- Leaderboard: Track kills, deaths, and K/D ratios in real-time
- Respawn System: 3-second respawn timer with invincibility period
- Pure Java Server: Zero external dependencies - built with core Java APIs only
- Custom WebSocket: Hand-coded RFC 6455 compliant WebSocket implementation
- Thread-safe Architecture: Concurrent data structures and multi-threaded client handling
- Minimap: Real-time battlefield overview with player tracking
- Voice Chat: Integrated WebRTC voice communication (optional)
- Responsive UI: Modern, accessible interface with screen shake and visual effects
- Network Stats: Real-time ping display and connection monitoring
- Java 11+ (for server)
- Maven 3.6+ (for building)
- Python 3.x (for serving client files)
- Modern web browser with WebSocket support
-
Clone the repository
git clone https://github.com/th33k/minitankfire.game.git cd minitankfire.game -
Build the project
make build
-
Start the server
make server
Server will start on
ws://localhost:8080/game -
Start the client (in a new terminal)
make client
Client will be available at
http://localhost:3000 -
Play the game
- Open browser to
http://localhost:3000 - Enter server address (e.g.,
localhostor your IP) - Enter your callsign
- Click "Deploy to Battle"
- Open browser to
Server (Java):
cd server
mvn clean compile
mvn exec:javaClient (Python HTTP Server):
cd client
python -m http.server 3000| Action | Control |
|---|---|
| Move | W A S D |
| Aim | Mouse |
| Fire | Left Click |
| Chat | Enter |
| Toggle Aim Line | Settings Menu |
| Toggle Minimap | Settings Menu |
| Voice Chat | Settings Menu |
- Pure Java Implementation: No external libraries or frameworks
- WebSocket Protocol: RFC 6455 compliant handshake and framing
- Multi-threaded: ExecutorService for concurrent client handling
- Game Loop: 50ms tick rate (20 FPS) with ConcurrentHashMap state management
- TCP Sockets: java.net.ServerSocket for low-level networking
- ES6 Modules: Clean, modular architecture with import/export
- Canvas Rendering: Hardware-accelerated 2D graphics
- WebSocket Client: Native browser WebSocket API
- Manager Pattern: Separate managers for UI, network, input, and voice chat
- Responsive Design: Scales to different screen sizes
- JSON-based messaging: Structured data exchange
- Message types: join, game_state, input, fire, chat, powerup, respawn
- Ping/Pong: Network latency monitoring
- Binary WebSocket frames: Efficient data transmission
minitankfire.game/
โโโ client/ # HTML5 Client
โ โโโ index.html # Main game page
โ โโโ css/
โ โ โโโ style.css # Game styling
โ โโโ js/
โ โ โโโ game-client.js # Main client logic
โ โ โโโ core/ # Core game systems
โ โ โ โโโ config.js # Game constants
โ โ โ โโโ input-manager.js
โ โ โ โโโ renderer.js # Canvas rendering
โ โ โโโ managers/ # Feature managers
โ โ โโโ network-manager.js
โ โ โโโ ui-manager.js
โ โ โโโ voice-chat-manager.js
โ โโโ src/audio/ # Sound effects & music
โโโ server/ # Java Server
โ โโโ pom.xml # Maven configuration
โ โโโ src/main/java/com/minitankfire/
โ โโโ server/
โ โ โโโ GameServer.java # Main server entry
โ โโโ game/
โ โ โโโ GameRoom.java # Game logic & physics
โ โโโ network/
โ โ โโโ ClientHandler.java # Client connection handler
โ โ โโโ WebSocketHandler.java # WebSocket protocol
โ โโโ model/
โ โ โโโ Player.java # Tank model
โ โ โโโ Bullet.java # Projectile model
โ โ โโโ PowerUp.java # Power-up model
โ โโโ util/
โ โโโ JsonUtil.java # JSON serialization
โโโ docs/ # Documentation
โ โโโ ARCHITECTURE.md # System design
โ โโโ DEVELOPMENT.md # Developer guide
โ โโโ GAMEPLAY.md # Game mechanics
โโโ Makefile # Build automation
โโโ README.md # This file
Edit GameServer.java constants:
private static final int DEFAULT_PORT = 8080;
private static final int MAX_CLIENTS = 100;Edit GameRoom.java for game mechanics:
private static final int MAP_WIDTH = 1920;
private static final int MAP_HEIGHT = 1080;
private static final int GAME_TICK_MS = 50; // 20 FPS
private static final int RESPAWN_TIME_MS = 3000;
private static final int BULLET_DAMAGE = 20;Edit client/js/core/config.js:
export const CONFIG = {
CANVAS: { WIDTH: 1920, HEIGHT: 1080 },
PLAYER: { SPEED_NORMAL: 12, SPEED_BOOSTED: 20 },
WEAPON: { FIRE_RATE: 500, BASE_DAMAGE: 25 }
};# Clean and rebuild
make clean build
# Run server in test mode
cd server && mvn test
# Check for compilation errors
mvn compile- Server Tick Rate: 20 FPS (50ms per tick)
- Network Protocol: WebSocket (low latency)
- Max Players: 100 concurrent connections
- Memory: ~50MB server heap (typical)
- Client FPS: 60+ FPS (browser dependent)
- Java 11+: Core language
- Maven: Build tool
- Pure Java Networking: java.net, java.nio, java.util.concurrent
- No external dependencies: 100% pure Java
- HTML5: Structure
- CSS3: Styling with animations
- JavaScript ES6+: Logic and rendering
- Canvas API: 2D graphics
- WebSocket API: Real-time communication
- WebRTC: Peer-to-peer voice chat
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- th33k - Initial work - th33k
- WebSocket RFC 6455 specification
- HTML5 Canvas API documentation
- Java networking community
For issues, questions, or contributions, please visit:
- Issues: https://github.com/th33k/minitankfire.game/issues
- Discussions: https://github.com/th33k/minitankfire.game/discussions
Built with โค๏ธ using pure Java and modern web technologies