3 ms·
Thanks for posting that - it's basically a case study on how to do a good job of implementing the communication for a networked multiplayer game. Extremely hand
by bartread 10y ago
Thanks for posting that - it's basically a case study on how to do a good job of implementing the communication for a networked multiplayer game. Extremely handy.
The only bugger of it is that there's still no across the board UDP support in browsers(1) which means if you're building games with HTML5 and JavaScript, whatever you do, you're still using TCP, which is a PITA. It's actually even worse: WebSockets obviously a bunch of HTTP guff on top so it's not even like you're using vanilla TCP. At present I don't think there's any way to use raw TCP from JavaScript.
This obviously isn't a big problem for slower paced or turn-based games but it's a total pain in the neck for anything that has real time dynamics (FPS, many types of 2D arcade game, etc.).
(1) There is WebRTC, which is apparently UDP-based, but it's not yet supported across all browsers: http://caniuse.com/#feat=rtcpeerconnection http://caniuse.com/#feat=rtcpeerconnection. It's also meant for peer to peer so may or may not be a good fit for the kind of client/server/master game state comms you'd need for a multiplayer game. (I suppose you could utilise one of the clients for the master state but this is obviously open to abuse given that JS runs in a completely insecure execution environment - anything can get injected in there.)