Live data from Hacker News

Is it just me or is networking really hard?

gafferongames.com

141–150 of 188 posts

Re: Is it just me or is networking really hard?

#141
post #131

Earlier quoted context omitted.

[deleted]

I debate whether multicast has any use case in gaming. When online gaming started, it was fairly common to send the entire world state to all clients. Multicast helps when you are sending the same data to everyone. but online gaming started, worlds were small (think Quake I level). However, this type of model does not scale as the world size increases, and eventually the world is too big to send everything to every c…

Sending a fraction of the entire world state is still enormous for most non-FPS game types. It would benefit from multicast.

Also, map-hack-style cheating will always be common because of games that take the efficient rout, sending only inputs.

Re: Is it just me or is networking really hard?

#142
post #88
post #46

Earlier quoted context omitted.

This goes on the list of interview questions that's great at letting the interviewer claim pretty much any candidate they want to discard is unworthy of the position. It's the tech community's variant of a voting literacy test. If you ask me "how does the internet work" and what you really want is details on the underlying protocols, at around the range of TCP/IP, why aren't you actually asking for that? Your questio…

> If you ask me "how does the internet work" and what you really want is details on the underlying protocols, at around the range of TCP/IP, why aren't you actually asking for that? To see if you know what "how the internet works" even means. It's not an ambiguous question. If you respond with a description of Ruby on Rails, out you go!

"How does the internet work?"

Well, you see, when two computers love each other very much...

Re: Is it just me or is networking really hard?

#143
post #122

"You can’t even imagine a way that reliability could be implemented on top of UDP that beats TCP? What total bullshit" This. This "TCP already does it best in every situation" is a common trope usually spouted by people who know nothing about what TCP does and why. The easiest way to get over this misconception is to ask yourself, can you think of a protocol that not only works well over all sorts of networks, all th…

UDP is used when it's designed by network engineers. That's why we have VOIP and video streaming - all are served UDP. dont get me started on the lack of multicast out there. imagine game servers running multicast. one day.

A lot more traffic than you can imagine comes over UDP. Most Bittorrent traffic (used to be a majority of traffic on the Internet!) comes over LEDBAT, which runs over UDP, https://tools.ietf.org/html/rfc6817. WebRTC by Google is now using UDP for most things, because NAT traversal is not really possible over TCP (due to the 3-way handshake, and the SYN-SYN connection setup not being widely supported by OSes).

Re: Is it just me or is networking really hard?

#144
post #122

Earlier quoted context omitted.

UDP is used when it's designed by network engineers. That's why we have VOIP and video streaming - all are served UDP. dont get me started on the lack of multicast out there. imagine game servers running multicast. one day.

> UDP is used when it's designed by network engineers. UDP is used when low latency and low jitter is more important than complete information. For telefony it's better to lose a few packets than to wait a second or two for a retransmit. Some for game state, I believe. And I do believe that TCP was also designed by network engineers :-)

I really depends on the game, if your writing a chess game then TCP is a much better choice than UDP. Though for anything really complex your probably going to want to use both.

Re: Is it just me or is networking really hard?

#145
post #131

Earlier quoted context omitted.

[deleted]

I debate whether multicast has any use case in gaming. When online gaming started, it was fairly common to send the entire world state to all clients. Multicast helps when you are sending the same data to everyone. but online gaming started, worlds were small (think Quake I level). However, this type of model does not scale as the world size increases, and eventually the world is too big to send everything to every c…

There's nothing preventing you from sharding the world state into multiple multicast streams which clients could access/subscribe to as needed. You would still get the benefit of not sending massively duplicated data, and additionally clients wouldn't be downloading large portions of world state that are either useless, an exploit vector (even if it just exploits the game), or both.

Re: Is it just me or is networking really hard?

#146
post #111

Earlier quoted context omitted.

Gaffer is absolutely not saying 'What the fuck is wrong with you?' to beginners. He's saying it to the so-called experts who posted nonsense like this: "Yeah... Gaffer is well-known as a guide, but also kind of horribly flawed. Question 1 for networking development: Do you need everything that TCP offers? If yes, then use TCP. You're not going to outperform TCP to do what it's good at. If not, read on." This was a gi…

> You're not going to outperform TCP to do what it's good at. I took this to be something more akin to "never implement your own crypto." If everyone followed that advice there would be no crypto, so it's obviously not blanket advice.

Even looking at it like that, it's wrong.

TCP has a lot of tunable parameters where the choices are baked into it, and it assumes that extra round trips are no big deal.

Crypto does not have all that many tradeoffs. You just need expert implementation. It's dangerous and unnecessary to do it yourself.

For something that is low-bandwidth and latency-sensitive, you can take TCP and make minor adjustments and come out with something that is far better suited. Even something as dumb and easy as sending all packets twice could turn an semi-common jitter into an ultra-rare jitter.

If you could open a TCP socket with forward error correction options, and disable head-of-line blocking, then you could probably argue against custom TCP-like protocols. But that's not the world we live in.

Re: Is it just me or is networking really hard?

#147
post #131

Earlier quoted context omitted.

[deleted]

I debate whether multicast has any use case in gaming. When online gaming started, it was fairly common to send the entire world state to all clients. Multicast helps when you are sending the same data to everyone. but online gaming started, worlds were small (think Quake I level). However, this type of model does not scale as the world size increases, and eventually the world is too big to send everything to every c…

Don't picture a single multicast connection socket for all clients. Picture a multicast pub/sub topic model: each client would have a regular unicast socket to send to the server, but to receive, each client would subscribe to a set of server-multicast channels, one listener-socket per channel.

For each event, the server would find (or create) a multicast-socket channel that has only the correct subscribers, and push the message once over that multicast socket. The network would then do the job of making that message arrive on every client.

And, of course, you can separately encrypt each multicast channel[1], handing out keys over a regular 1:1 TCP+TLS "control" socket to the clients. (This would usually be merged with the client's unicast "send" socket.)

Guess what design I have just coincidentally described? Cable set-top-box pay-per-view! (The original kind, not the "over-the-top" access-on-demand kind which is effectively equivalent to Netflix.)

In legacy STB PPV, each movie stream chunk is an "event" as described above; each stream is separately encrypted; and each set-top-box gets a low-bandwidth TCP-like duplex control channel to the head office to request and receive keys for streams. People requesting the same movie at the same time get put into a queue and then bucketed on ~15min intervals; each bucket gets temporarily allocated a UHF band; and then a stream is broadcast over that band to everywhere that head-office reaches, injected on the line similarly to a local public-access cable TV channel, but only existing for two hours.

---

[1] If your clients are okay with their bandwidth being wasted, you can be a bit sloppier and get away with fewer (or even just one) multicast socket(s). Imagine a multiplayer game like Starcraft: you could push every player's update events to all players... encrypted with keys in a keybag whose owners are the people the event should be visible to. Clearing fog-of-war would literally involve the client performing an action that the server responds to by sending a key to decrypt previously-received opaque event data.

This matches the model of how, say, collaboration software treats group ACLs: being granted access to a new group means being given the key to decrypt the object-change-events within the global event stream that were relevant to that group.

Re: Is it just me or is networking really hard?

#148
It's not that networking is really hard, it's that development of synchronized games that run over unreliable links is really hard.

If you want a simple solution for a simple game, here's one. Use a fixed-format UDP packet to pass current location and orientation of the player and whatever else changes rapidly. This should be stateless; if you lose a packet, the next one has a full state update. This is enough for a simple FPS game.

Anything else goes over one or more TCP connections. If you have to load assets (level maps, textures, etc.) just use HTTP over TCP, which means you get to use standard servers and client software for that stuff.

If your game is too complex for that model, you're probably going to have to do some serious thinking about distributed synchronization.

Re: Is it just me or is networking really hard?

#149

It's not that networking is really hard, it's that development of synchronized games that run over unreliable links is really hard. If you want a simple solution for a simple game, here's one. Use a fixed-format UDP packet to pass current location and orientation of the player and whatever else changes rapidly. This should be stateless; if you lose a packet, the next one has a full state update. This is enough for a…

> This should be stateless; if you lose a packet, the next one has a full state update. This is enough for a simple FPS game.

Also enough considering packet reordering? And corruption?

Re: Is it just me or is networking really hard?

#150

It's not that networking is really hard, it's that development of synchronized games that run over unreliable links is really hard. If you want a simple solution for a simple game, here's one. Use a fixed-format UDP packet to pass current location and orientation of the player and whatever else changes rapidly. This should be stateless; if you lose a packet, the next one has a full state update. This is enough for a…

> This should be stateless; if you lose a packet, the next one has a full state update. This is enough for a simple FPS game. Also enough considering packet reordering? And corruption?

If you get a bad packet, the problem will disappear when the next one comes in.
Post reply on HN