3 ms·
We've been using WebRTC Datachannels for multiplayer gaming in the browser in our game editor Construct 2 (www.scirra.com) for a couple of years now. Generally
by AshleysBrain 10y ago
We've been using WebRTC Datachannels for multiplayer gaming in the browser in our game editor Construct 2 (www.scirra.com) for a couple of years now. Generally they work great! However the main problem we have is switching tab suspends the game, which if you're acting as the host, freezes the game for everybody. This is really inconvenient. There ought to be some way to exempt tabs with WebRTC connections from being suspended. I filed a bug for it here: https://bugs.chromium.org/p/chromium/issues/detail?id=676036 https://bugs.chromium.org/p/chromium/issues/detail?id=676036
- jczhang 10y agoAre you using any libraries to simplify the initial handshake connection or Socket.io?
- AshleysBrain 10y agoNo, we run our own signaling server and wrote the connection establishment parts ourselves. The client ends aren't that complicated in that regard.
- taf2 10y agoWait can you do a pop out window? That way it's always open and can't have multiple tabs. The main tab can control the pop out to kill the data channel ...
- AshleysBrain 10y agoMinimising still suspends. And IMO pop-ups are slightly user hostile compared to just staying in the tab.
- ilaksh 10y agoHave you tried popping up a message in other browsers saying 'userBob switched browser tabs, disabling his host. Please contact userbob to switch back and always remeber if you are the host, dont switch tabs.' Then it would only happen when people were trying to be hostile or negligent. Also have you tried with a webworker or something similar.
- j_s 10y agoThe answer is a server hosting the games, but that costs money.
- yincrash 10y agoWebsockets are much simpler if you just want to do server<>client. A lot of webrtc is to handles the problems that come with p2p.
- j_s 10y agoAFAIK, websockets can't UDP (which is useful for many games).
- banachtarski 10y agoNot only can they not do UDP, they are framed as HTTP connections so until HTTP supports an alternative transport, WS is stuck.
- AshleysBrain 10y agoExactly, the appeal of P2P is you don't need to run servers. And it seems like a reasonable feature to allow browsers to reliably host multiplayer games.
- Crespyl 10y ago> it seems like a reasonable feature to allow browsers to reliably host multiplayer games. We're at a point now where you're certainly not wrong, it just feels really wrong.
- est 10y agoIs it possible to run WebRTC in a webworker?