How anmolllll311/battleship works
Aegis is a browser-based, peer-to-peer Battleship game with cryptographic board commitments. The principal workflow is to set up a fleet, exchange compressed WebRTC offer/answer codes, then exchange game messages over a data channel while proving attacked cells against prior commitments. The excerpts show the controller wiring to the crypto and transport engines, and a hit sound call. QR libraries and the camera appear to support code exchange, but the relevant wiring is not shown; those relationships are therefore omitted.
Main entry points: game.js Game controller · webrtc.js WebRTC transport · crypto.js Board commitments · audio.js Synthesized audio
Components 10
Game experience
- Game controller
game.js - Game page
index.html
Peer connection
- WebRTC transport
webrtc.js - QR decoding
lib-jsqr.js - QR decoder bundle
jsqr.bundle.js - QR generation
qrcode.bundle.js
Fair play and feedback
- Board commitments
crypto.js - Synthesized audio
audio.js
Other components
- Player
- Opponent
Connections 5
- Player → Game controller: plays
- Game controller → WebRTC transport: creates
game.js - Game controller → Board commitments: creates
game.js - Game controller → Synthesized audio: plays hit
game.js - WebRTC transport → Opponent: P2P messages