r/javascript • u/woqr • 29d ago
Serverless multiplayer via webrtc/camera/barcode (no signal/stun/turn servers)
https://github.com/bacionejs/multiplayerThis project is mainly about the serverless technique used and the simple game merely provides an end-to-end explanation.
12
Upvotes
View all comments
Show parent comment
1
u/woqr 1d ago
This is an experimental proof of concept for two family members sitting on the couch at home on the same hotspot to quickly whip up a small game and play head-to-head without setting up a custom local game server, with pasted games designed to stay standalone over the WebRTC data channel inside an unsandboxed
srcdociframe that has page-origin access (localStorageand network calls) and directlinkobject access instead of apostMessagebridge while pressingPlaysends the code straight to the connected peer. Tip: pastesamplegame.jsinto an AI to generate a different game to paste in right away, only run code you trust (your little brother could easily paste a script that messes with your stuff), and while you are welcome to fork it and add security features, you might as well create a traditional game server if you need real multi-user isolation.