A real-time multiplayer battle game where players battle their genrated Zoids in king-of-the-hill combat. Each Zoid has unique stats and type advantages, with combat resolved through turn based dice mechanics. Built with React, Node.js, and WebSocket for live gameplay served from a locally deployed backend via Ngrok.
- King-of-the-hill lobby system where winners stay and defend their position
- Complex Combat mechanics:
- Type-based weakness and resistance system
- Variable damage rolls using d4, d6, and d8 dice
- Stats like accuracy and agility affect combat outcomes
- Monster generation system for unique Zoids
- Responsive design for both desktop and mobile play
- Frontend: React, TypeScript, Styled Components
- Backend: Node.js, Express, WebSocket
- Deployment: Netlify (Frontend), Local Server (Backend)
├── backend/ # Node.js/Express server
│ ├── server.js # Main server file
│ └── package.json # Backend dependencies
├── src/ # React frontend
│ ├── components/ # React components
│ ├── data/ # Game data (zoids, etc.)
│ └── utils/ # Utility functions
├── install.bat # Installs all dependencies
├── start-backend.bat # Runs the backend server
└── start-frontend.bat # Runs the React development server
- Make sure you have Node.js installed (version 14 or higher recommended)
- Clone the repository:
git clone https://github.com/johnl/zoids.git cd zoids - Set up your environment variables:
- Backend: Copy
backend/.env.exampletobackend/.envand add your ngrok auth token - Frontend: Create
.env.localwith your backend URL when deploying
- Backend: Copy
- Run
install.batto install all dependencies for both frontend and backend
- Run
start-backend.batto start the backend server (will run on port 3001) - Run
start-frontend.batto start the React development server (will run on port 3000) - Open http://localhost:3000 in your browser
The application uses ngrok to expose the local backend server:
- Hosted on Netlify with continuous deployment from the main branch
- Environment variables required in
.env.local:REACT_APP_BACKEND_URL: WebSocket backend URL (ngrok-provided URL)- Example:
REACT_APP_BACKEND_URL=wss://your-tunnel.ngrok.io
- Runs locally on your server using the provided
start-backend.bat - Uses ngrok to create a secure tunnel to the local server
- Required environment variables in
backend/.env:NGROK_AUTH_TOKEN: Your ngrok authentication token from ngrok dashboard⚠️ Make sure to keep your ngrok token private and never commit it to the repository
- The ngrok tunnel URL will be displayed in the console when starting the backend
- Frontend runs on port 3000 and will auto-reload on file changes
- Backend runs on port 3001 with nodemon for auto-reloading
- Zoid data is stored in
src/data/zoids.json - WebSocket is used for real-time game state updates
- Environment variables should be set in
.envfiles
