A real-time, multiplayer turn-based strategy game where players compete on a dynamic 20x20 grid.
Tank Turn Tactics is a strategic game where players control tanks on a grid-based battlefield. Players accumulate action points over time, which they can use to move, shoot, upgrade their range, or trade with other players. The game features a shrinking battlefield, adding an element of urgency as the match progresses.
- User Authentication: Register, login, and manage user profiles
- Game Creation and Management: Create, join, and start games
- Real-time Gameplay: Move, shoot, upgrade range, and trade action points
- Chat System: Global and private messaging between players
- Game History: Track actions and chat messages during gameplay
- Dynamic Board: Battlefield shrinks over time, forcing players to confront each other
- Node.js with Express
- MongoDB with Mongoose
- Socket.io for real-time communication
- Redis for caching
- JWT for authentication
- Winston for logging
- React with Vite
- TailwindCSS
- Context API for state management
tank-turn-tactics/
├── client/ # React frontend (initialized with Vite)
└── server/ # Node.js backend
├── src/
│ ├── config/ # Configuration files
│ ├── controllers/ # Route controllers
│ ├── middleware/ # Express middleware
│ ├── models/ # Mongoose models
│ ├── routes/ # Express routes
│ ├── services/ # Business logic
│ ├── socket/ # Socket.io handlers
│ ├── utils/ # Utility functions
│ └── index.js # Entry point
├── .env # Environment variables
└── package.json # Dependencies
- Node.js (v14 or higher)
- MongoDB
- Redis
-
Clone the repository:
git clone https://github.com/yourusername/tank-turn-tactics.git cd tank-turn-tactics
-
Install server dependencies:
cd server npm install
-
Install client dependencies:
cd ../client npm install
-
Create a
.env
file in the server directory with the following variables:PORT=5000 MONGODB_URI=mongodb://localhost:27017/tank-turn-tactics JWT_SECRET=your_jwt_secret_key_change_in_production JWT_EXPIRY=7d REDIS_URL=redis://localhost:6379 NODE_ENV=development
-
Start MongoDB and Redis
-
Start the server:
cd server npm run dev
-
Start the client (when implemented):
cd client npm run dev
POST /api/auth/register
- Register a new userPOST /api/auth/login
- Login a userPOST /api/auth/logout
- Logout a userGET /api/auth/me
- Get current user profilePUT /api/auth/password
- Update user password
POST /api/game
- Create a new gameGET /api/game
- Get all gamesGET /api/game/:id
- Get a game by IDPOST /api/game/:id/join
- Join a gamePOST /api/game/:id/start
- Start a gamePOST /api/game/:id/move
- Move a playerPOST /api/game/:id/shoot
- Shoot a playerPOST /api/game/:id/upgrade
- Upgrade player rangePOST /api/game/:id/trade
- Trade action pointsGET /api/game/:id/history
- Get game action history
GET /api/users/profile
- Get user profileGET /api/users/stats
- Get user stats
joinGame
- Join a game roomleaveGame
- Leave a game roomgameChatMessage
- Send a chat messagegameAction
- Perform a game action
playerJoined
- A player joined the gameplayerLeft
- A player left the gamegameChatMessage
- Receive a chat messagegameAction
- Receive a game actionerror
- Error message
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the original Tank Turn Tactics concept
- Built as a learning project for real-time multiplayer game development