4 ms·
WebRTC really isn't suitable for multiplayer gaming due to it being entirely P2P. You need the server to operate as a single source of truth and enforce clients
by meritt 9y ago
WebRTC really isn't suitable for multiplayer gaming due to it being entirely P2P. You need the server to operate as a single source of truth and enforce clients to play by the rules.
- TheCowboy 9y agoIs it entirely P2P? It seems like it has use cases for streaming audio and video, where low-latency is desired and dropped packets are acceptable.
- meritt 9y agoYep. The server provides signaling (who the peers are, what data is being requested/should be snet, etc) but you're absolutely correct: WebRTC primarily envisioned for high-bandwidth peer-to-peer suitable content such as video/audio/file-sharing. People have tried using it for gaming (e.g. server is the master peer) but it's tenuous and folks should just stick to WS.
- lxtx 9y agoIt is not entirely P2P, a server can act as a "peer" for all clients and handle the connections itself.
- deleted 9y ago[deleted]
- londons_explore 9y agoHaving both models works well... TCP from a master server to every client. and UDP low latency links from every client to every other client. The client code sends a sample of received UDP packets to the server over the TCP connection, who will then verify that all info contained in the packets is true and accurate and nobody was cheating. It's a nice model because you get the super low latency between clients, and at the same time within a few hundred milliseconds you can detect cheaters and kick/ban them. Obviously, you have to design your game to handle asynchronous lossy information from many different sources and nobody having a complete and whole view of the game until half a second later or so. Thats quite do-able though by timestamping every event and then running rollback-able or checkpointed synchronous simulation on all clients.
- alanning 9y agoKnow of any games that have implemented this method?
- gregmac 9y agoI'm not that familiar with WebRTC, but can the server not act as the only peer?