No description
Find a file
2026-10-09 19:34:29 +00:00
docs Add Netwall solo client, shared simulation core and protocol spec 2026-10-09 19:14:35 +00:00
public Upload files to "public/assets/music" 2026-10-09 19:34:29 +00:00
test Add Netwall solo client, shared simulation core and protocol spec 2026-10-09 19:14:35 +00:00
.gitignore Add Netwall solo client, shared simulation core and protocol spec 2026-10-09 19:14:35 +00:00
package-lock.json Add Netwall solo client, shared simulation core and protocol spec 2026-10-09 19:14:35 +00:00
package.json Add Netwall solo client, shared simulation core and protocol spec 2026-10-09 19:14:35 +00:00
README.md Add Netwall solo client, shared simulation core and protocol spec 2026-10-09 19:14:35 +00:00

NETWALL

Build the firewall. Stretch the route. Protect the server.

An open-map, maze-building tower defence game for the browser, with two-player co-op. Hostile packets (pings, worms, trojans, spam, spoofed flyers and the odd rootkit boss) pour in from internet gateways and head for your server along the shortest open route. You can't walk them off the map, but you can make that route long: cheap Firewall walls, placed anywhere, force them on a detour past your turrets. You may never seal the route completely, so every wall is a decision.

  • Plays in any modern browser, desktop and mobile (portrait and landscape, touch, pinch-zoom).
  • Solo works straight from the files (no server needed).
  • Co-op online: two players, one shared map, one base and one pot of credits, building at the same time, with live partner cursors and map pings. Needs the small Node server in this repo.
  • No build step, no framework, no external requests. Vanilla JS + canvas.

Run it

# Debian / Ubuntu: sudo apt install nodejs npm
npm install            # one dependency: ws
npm start              # http://localhost:8080  (prints your LAN URLs too)

Open the printed URL on any device on your network. Pick a map and press Play solo, or Co-op online to create a room and send the invite link (or the 4-letter code) to a friend.

Solo only: you can also just open public/index.html in a browser.

Environment variables: PORT (8080), HOST (::, dual-stack IPv4 + IPv6), TRUST_PROXY, ALLOWED_ORIGINS, MAX_CONN_PER_IP, GRACE_MS. Deployment in a Debian LXC behind nginx Proxy Manager (WebSockets, TLS, IPv6, systemd) is in docs/DEPLOY.md.

How to play

Goal Survive 30 waves (then keep going in endless mode). Every packet that reaches the server costs integrity.
Firewall (5) A wall. Packets path-find around it; the route preview shows how much longer it makes their trip.
Packet Filter Fast and cheap. Weak against armour.
IDS Sniper Long range, hits hard, slow. The answer to armour and bosses.
Flood Mortar Splash damage on ground swarms. Cannot hit flyers.
Rate Limiter Slows everything in range. Rootkits resist it.
Router Arc Chain lightning between nearby packets.
Spoofed packets Fly straight over your maze: keep some anti-air.
Credits From kills and cleared waves. Upgrade turrets to level 3; selling returns 70% (walls 100%).

Controls, desktop: click to build, drag to paint walls, right-click cancels, 1-6 pick a tower, Space next wave, U upgrade, X sell, T change targeting, P pause, F speed, A auto-waves, M mute, wheel zoom, Alt+click pings.

Controls, touch: tap a tower type, tap the map to preview (the new route is drawn), tap the check mark (or the same cell again) to build. Walls paint as you drag. Two fingers pan and zoom; long-press pings your partner. In portrait the board turns 90 degrees so the cells stay big.

Music

The game has a built-in synth melody, and plays your own tracks if you add them. Drop files in public/assets/music/ and name them in public/assets/music/tracks.json:

{ "theme": "menu.mp3", "battle": "battle.mp3", "boss": "boss.mp3", "win": "win.mp3", "lose": "lose.mp3" }

Any entry left null keeps the synth version. See public/assets/music/README.md for prompt ideas for Suno.

How it works

public/              static client (also the web root)
  index.html, css/   layout: grid that reflows for desktop / landscape phone / portrait phone
  js/sim.js          the whole game rules: pure, deterministic, no DOM. Runs in the browser (solo) AND in Node (co-op)
  js/controllers.js  LocalController (runs sim in the tab) | RemoteController (WebSocket, snapshot interpolation, reconnect)
  js/render.js       canvas renderer: camera, zoom/pan, portrait rotation, effects
  js/main.js         screens, HUD, mouse + touch input, lobby
  js/audio.js        sfx + music
server/              Node: static files + authoritative co-op rooms over WebSocket
docs/PROTOCOL.md     wire protocol and server requirements
test/                node:test suites (sim rules, server)
tools/bot.js         headless bot used to balance the game

Pathing. Every placement is checked against a flow field (Dijkstra from the server, 8-way movement, no corner cutting so two diagonal walls really are a wall). A wall is refused if it would seal any gateway or trap any packet already on the board. The browser keeps a mirror of the maze so it can preview a placement and the resulting route instantly, even in co-op.

Co-op. The server owns the one true simulation per room and ticks it at a fixed 60 Hz. Clients send commands (place, sell, upgrade, ...); the server broadcasts compact 20 Hz snapshots, and clients render them slightly in the past, interpolating. Nothing is simulated twice, so nothing can drift. A dropped connection (phone locked, wifi switch) reconnects automatically and resumes the same seat for a minute.

Tests

npm test

Covers the rules (placement validation, route sealing, corner cutting, targeting, waves, economy) and the server (protocol, rooms, reconnects, security checks, static files, dual stack).