A real-time multiplayer browser-based battle arena game built with Phaser 3, Express, and Socket.IO. Challenge your friends in fast-paced PvP combat with multiple character classes and game modes!
Bro Battles is a server-authoritative multiplayer action game where players can:
- Choose from multiple unique character classes (Draven, Ninja, Thorg, Wizard)
- Battle in different game modes (1v1, 2v2, 3v3)
- Fight on various maps (Lushy Peaks, Mangrove Meadow)
- Create or join parties with friends
- Experience smooth real-time combat with client-side interpolation
The game features a matchmaking system, party management, character progression, and an in-game economy for upgrades.
- Node.js (v14 or higher recommended)
- MySQL (v5.7 or higher)
- A modern web browser (Chrome, Firefox, Edge, Safari)
git clone https://github.com/Spirit4449/APCSP-Create-Project---Final.git
cd "Bro Battles"npm installCreate a MySQL database and run the migration scripts:
CREATE DATABASE game;Then execute the migration files in order from server/migrations/:
2025-09-05_matchmaking.sql2025-09-06_party_status_enum.sql
Refer to database.md for detailed schema information.
The server will auto-generate a .cookie-secret file on first run. You can optionally set these environment variables:
PORT- Server port (default: 3002)NODE_ENV- Environment mode (development/production)SECURE_COOKIES- Set totruefor HTTPS (default: false)COOKIE_SECRET- Custom cookie secret (auto-generated if not set)ADMIN_USERS- All the users who can access admin panel on /admin
Development Mode:
npm run devThe server will start on http://localhost:3002 with hot reloading.
Production Mode:
npm run build
npm start-
Open Your Browser
- Navigate to
http://localhost:3002(or your configured port)
- Navigate to
-
Create an Account (Optional)
- Click "Sign Up" to create a persistent account
- Or continue as a guest (automatically created)
-
Select Your Character
- Choose from available character classes:
- Draven: Balanced melee fighter
- Ninja: Fast, agile assassin
- Thorg: Tank with high health
- Wizard: Ranged magic caster
- Choose from available character classes:
- Click "Play" from the main menu
- Select your game mode (1v1, 2v2, or 3v3)
- Choose your map
- Click "Ready" to join the matchmaking queue
- Wait for other players to be matched
- Accept the ready check when a match is found
- Battle begins!
- From the main menu, click "Create Party" or join an existing party
- Share your party ID with friends
- Wait for friends to join your party
- As party leader, select:
- Game mode
- Map
- Character class for yourself
- All party members must click "Ready"
- Party leader initiates matchmaking
- Once a match is found, all players accept the ready check
- Fight together as a team!
- Movement: WASD or Arrow Keys
- Attack: Left Click or Spacebar
- Special Abilities: Character-specific (check in-game HUD)
- Heal: H key (if available)
- Each character has unique stats and abilities
- Pay attention to your health bar
- Use the environment and map features to your advantage
- Coordinate with teammates in team modes
- Time your attacks and abilities strategically
- Win matches to earn currency
- Purchase character upgrades in the shop
- Level up your characters to unlock new abilities
- Track your stats and match history
- Real-time Combat: Server-authoritative gameplay with client-side prediction and interpolation
- Matchmaking System: Fair matching with ready-check confirmation
- Party System: Play with friends in private or public matches
- Multiple Maps: Each with unique layouts and strategic elements
- Character Classes: Diverse playstyles with unique abilities
- Economy: Earn and spend currency on character upgrades
- Responsive Design: Playable on desktop browsers
Connection Issues:
- Ensure the server is running
- Check your firewall settings
- Verify MySQL is running and accessible
Game Won't Start:
- Clear browser cache and cookies
- Check browser console for errors (F12)
- Ensure all dependencies are installed
Matchmaking Stuck:
- Wait for other players to queue
- Try a different game mode
- Refresh and try again
- Frontend: Phaser 3 (game engine), vanilla JavaScript
- Backend: Node.js, Express
- Real-time: Socket.IO
- Database: MySQL with mysql2/promise
- Build Tool: Webpack 5
- Authentication: Signed cookies with guest support
Run the development server with hot reloading:
npm run devBuild production bundles:
npm run buildThe project structure follows:
src/- Client-side game code and server codepublic/- Static assets and HTML pagessrc/server/- Server-side logic (matchmaking, game rooms, routes)server/migrations/- Database migrations
- Architecture map:
docs/ARCHITECTURE_MAP.md - Contributor guide with exact "add character/map/powerup" instructions:
docs/CONTRIBUTING.md - Repository coding constraints:
.github/copilot-instructions.md
Contributions are welcome. Before opening a PR:
- Read
docs/ARCHITECTURE_MAP.md. - Follow
docs/CONTRIBUTING.mdchecklists. - Run
npm run buildand verify gameplay paths affected by your change.
This project is an educational project for AP Computer Science Principles.
For issues or questions, please open an issue on the GitHub repository.
Ready to battle? Launch the game and show your skills! 🎮⚔️