1 prompt vive-coded multiplayer bomberman game using libp2p
  • TypeScript 93.6%
  • JavaScript 4.8%
  • HTML 1.6%
Find a file
Vibe Kanban 4653f662d1 yeah
2026-01-30 23:47:47 +01:00
dist Create an ipfs multiplayer game (vibe-kanban 3f05cdd0) 2026-01-30 23:30:20 +01:00
scripts yeah 2026-01-30 23:47:47 +01:00
src yeah 2026-01-30 23:47:47 +01:00
.gitignore yeah 2026-01-30 23:47:47 +01:00
index.html Create an ipfs multiplayer game (vibe-kanban 3f05cdd0) 2026-01-30 23:30:20 +01:00
package-lock.json Create an ipfs multiplayer game (vibe-kanban 3f05cdd0) 2026-01-30 23:30:20 +01:00
package.json yeah 2026-01-30 23:47:47 +01:00
README.md Create an ipfs multiplayer game (vibe-kanban 3f05cdd0) 2026-01-30 23:30:20 +01:00
tsconfig.json Create an ipfs multiplayer game (vibe-kanban 3f05cdd0) 2026-01-30 23:30:20 +01:00
tsconfig.tsbuildinfo Create an ipfs multiplayer game (vibe-kanban 3f05cdd0) 2026-01-30 23:30:20 +01:00
vite.config.ts Create an ipfs multiplayer game (vibe-kanban 3f05cdd0) 2026-01-30 23:30:20 +01:00

Bombo — P2P Bomberman

A serverless, P2P Bomberman-style game that uses:

  • WebRTC DataChannels for low-latency real-time gameplay
  • Pubsub-style relay for lobby discovery and WebRTC signaling (minimal bootstrap)
  • Host-authoritative game state: one peer simulates, others send inputs and receive state

No long-lived game servers: you run a tiny relay (or use a public one), and players connect directly via WebRTC for the actual game.

Quick start

  1. Start the relay (one terminal):

    npm run relay
    

    Listens on ws://localhost:9090 by default. Set PORT to change it.

  2. Start the app (another terminal):

    npm run dev
    
  3. Open two browser tabs at the dev server URL:

    • In one tab: click Host game
    • In the other: pick the game from the list and click Join
    • Play: WASD / Arrows move, Space places a bomb

Architecture

  • Relay server (scripts/relay-server.mjs): WebSocket server that broadcasts every message to all connected clients. Used only for:

    • Lobby: host publishes “game open” with game id and peer id; clients subscribe and see the list.
    • Signaling: SDP offer/answer and ICE candidates for WebRTC, so peers can open a direct DataChannel.
  • Game traffic goes over a WebRTC DataChannel (peer-to-peer), not through the relay.

  • Gameplay: Host runs the game loop, applies inputs from all players, and sends state snapshots over the DataChannel. Clients send inputs and render received state.

Scripts

  • npm run dev — Vite dev server
  • npm run build — Production build
  • npm run preview — Preview production build
  • npm run relay — Start WebSocket relay (lobby + signaling)
  • npm run bootstrap — Start libp2p bootstrap server (optional; requires compatible libp2p stack)

Env (Vite)

  • VITE_BOOTSTRAP_WS — WebSocket URL for relay (default: ws://localhost:9090)

Optional: libp2p

The app can use libp2p + GossipSub instead of the relay for discovery and signaling (same WebRTC game channel). To do that youd need:

  1. A running libp2p bootstrap node (e.g. npm run bootstrap after fixing the current bootstrap scripts deps).
  2. Build/run with libp2p support (e.g. set VITE_USE_RELAY=false and resolve the current @libp2p/utils / pipe export issue in the libp2p stack).

The relay mode is the default so the game works out of the box with minimal setup.