We made a multiplayer browser game with no game server
Super Nova Arena is a small PvP game that runs in a browser tab. Your mouse is your player, a glowing star. Pull back, let go, and you sling a shot at someone else. Space puts up a shield, right click (or Q) drops a mine, and after 90 seconds whoever has the most KOs wins. Up to 8 people can share a lobby. The part I actually want to talk about is the plumbing, because there isn't any. No game…
Super Nova Arena is a multiplayer browser-based game that doesn't require a game server or backend. Players, represented by glowing stars, compete in a first-person shooter using only their mouse. The game features a 90-second round where the player with the most kills wins. Up to eight players can join a lobby, and the game runs on GitHub Pages.
The game utilizes Trystero and a Nostr strategy for peer-to-peer connections, with public relays only helping peers find each other. Once connected, communication happens directly between players using WebRTC. Each lobby is a separate room with a cap of eight players, and the lobby list is a shared room with 8 players. Every player maintains their own state, including name, color, health, KOs, downs, wins, and if they're dead.
The game uses an event channel for shots, mines, shields, and hits, and a shared match object for the round status. Rounds progress through waiting, countdown, live, and over states. The game's mechanics are controlled by a fixed 1/120 second step, with physics smoothing out positions between updates to prevent jittering. Players can adjust their view by standing still and planting their slingshot or pulling back to increase pull distance up to 330 units.
Networking challenges include players trusting each other, lacking TURN servers for strict networks, and exposing IP addresses. The game adapts to different monitor refresh rates and adjusts frame rendering accordingly. If performance issues arise, the game automatically drops to 1x pixel density. The game is currently in early access, and players can report bugs directly to the developers' Discord.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to