A hex-based naval strategy game built with vanilla HTML5 Canvas and JavaScript. Play in-browser with no dependencies — just open and play.
- Hexagonal Grid — Pointy-top hex map with sea, land, and mountain terrain
- Fog of War — Terrain visible through fog, units hidden until spotted
- Economy — Towns generate money, factories produce materials, with encirclement production bonuses
- Naval Units — Warship (anti-sub), Submarine (stealth), Aircraft Carrier (colonize), Colony Ship
- Land Structures — Main Base, Town, Factory, Naval Base, Airport, Radar, Coastal Gun, AA Gun
- Combat — Counter-attacks, passive destruction, submarine stealth, AA suppression
- AI Opponents — Easy, Medium, and Extreme difficulty levels
- Map Editor — Create and save custom maps with terrain painting and base placement
- Full Customization — Edit all unit/building stats, share config codes, save templates per player
- Save/Load — Save games to browser storage and resume later
- Statistics — Track economy and military performance with charts
- Multiplayer — Online play via WebSocket (requires server)
- Cross-Platform — Works on desktop and mobile browsers
Option A — Open directly (no server needed):
- Run
python build.pyto generategame.html - Open
game.htmlin your browser
Option B — With ES modules (local server):
- Serve the project folder with any HTTP server:
python -m http.server 8080
- Open
http://localhost:8080in your browser
| Input | Action |
|---|---|
| Left click | Select / Move / Attack / Build |
| Right click drag | Pan camera |
| Scroll wheel | Zoom in/out |
1-7 |
Quick-select building type |
E |
End turn |
Escape |
Deselect |
Ctrl+Z |
Undo last action |
Tab |
Toggle statistics |
Touch controls are supported on mobile (tap to select, drag to pan, pinch to zoom).
- Start the WebSocket server:
cd server npm install node server.js - In-game, select Online mode and connect to the server URL
- Create or join a room with the 6-character room code
index.html — Main HTML (ES module version)
css/style.css — Styles and responsive layout
js/
hex.js — Hex grid math (coordinates, pathfinding, line of sight)
config.js — Game configuration and data templates
gameState.js — Core game engine (turns, combat, economy, fog)
renderer.js — Canvas renderer (terrain, units, buildings, UI)
ai.js — AI system (easy/medium/extreme)
multiplayer.js — WebSocket multiplayer client
main.js — Application controller and UI
server/
server.js — WebSocket multiplayer server (Node.js)
build.py — Bundles JS into standalone game.html for offline use
python build.pyThis generates:
js/bundle.js— All JS concatenated into a single non-module scriptgame.html— Standalone HTML that works viafile://protocol
MIT