A modern, real-time, peer-to-peer multiplayer Battleship game built with Next.js 15, TypeScript, and Supabase Realtime. Experience the classic naval warfare with a sleek dark-navy interface, immersive sound effects, and zero-latency P2P synchronization.
No custom backend server required! The game leverages Supabase Realtime Channels (Presence & Broadcast) to synchronize game states directly between browser peers.
- Standard Rules: All 5 classic ships (Carrier, Battleship, Cruiser, Submarine, Destroyer).
- "Hit-Again" Rule: Keep your turn as long as you land a hit on the enemy fleet.
- Ready Sync: Robust P2P handshake ensures both players are ready before battle begins.
- Interactive drag-and-drop/click placement.
- Seamless rotation support (press 'R').
- Auto-placement algorithm for quick deployment.
- Dynamic Battle Theme: Music that intensifies when the combat phase begins.
- Cinematic SFX: High-quality sounds for firing shots, explosions on hits, and turn transitions.
- Global Volume Control: Adjust your audio experience directly from the status bar.
- Dark Navy Aesthetics: A clean, military-inspired interface with glassmorphism effects.
- Responsive Design: Fully playable on desktops, tablets, and mobile devices.
- Victory/Defeat States: Clear visual and audio feedback upon game conclusion.
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Networking: Supabase Realtime (Presence & Broadcast)
- State Management: Zustand
- Styling: Vanilla CSS (Modular & Glassmorphic)
- Icons: Lucide React
- Fonts: Outfit & JetBrains Mono
git clone https://github.com/your-username/battleship.git
cd battleshipnpm installCreate a .env.local file in the root directory and add your Supabase credentials:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_keynpm run devOpen http://localhost:3000 in your browser. To test the multiplayer, open another window in Incognito mode or a different browser.
Special thanks to the creators on OpenGameArt.org for the amazing assets:
- Battle Theme: Battle Theme A by cynicmusic.
- Sound Effects: Sci-Fi Sound Effects Library by LittleRobotSoundFactory.
- Ship Sunk SFX: Big Explosion by Blender Foundation
- Ship Assets: Sea Warfare Set by Lowder2.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ for the Naval Combat fans.