News for hackers. Stuff that matters.
Re:Is it just me or is networking really hard? by ggambetta on Sunday September 13, 2015 @06:57AM (#10210961)
I've written a series of articles about this topic: http://gabrielgambetta.com/fast_paced_multiplayer.html It's usually well received, perhaps because it builds the ideas from the ground up and does not include the words "What the fuck is wrong with you?".
Re:Is it just me or is networking really hard? by exDM69 on Sunday September 13, 2015 @07:48AM (#10211058)
To be fair, Gaffer's original articles are well written, thoughtful and informative too.

This is him ranting about the unfounded, negative and incorrect feedback he's been receiving about them from people who are willfully ignorant about networking. He could or should have replied with less attitude and more facts, though. I understood what and why he's saying what he is, but I didn't enjoy the negativity either.

Re:Is it just me or is networking really hard? by zamalek on Sunday September 13, 2015 @03:29PM (#10212497)
> He could or should have replied with less attitude and more facts, though.

I can see his frustration: ignorance frequently has the loudest voice - especially on The Internet.

* "TCP is good enough for Minecraft, it's good enough for you." Blissfully ignores the numerous networking-related bugs that have been present in Minecraft for years.

* "Premature optimization is the root of all evil." Blissfully ignores the remainder of Knuth's quote.

* "UDP is too complex, you won't get it right." Blissfully ignores any and all challenges, never improving their ability.

* "Internet is fast enough." No, it isn't.[1]

* Learns any or all of the above from someone else and believes it because it requires less effort.

Here's someone who has been putting out top-notch content on how to solve the hard problems out of nothing else but for the common good: educating people on how to make games. What do people do? Challenge those facts with superstition and unbelievable ignorance. He's got all reasons to be frustrated, I didn't even write those beautiful articles and I'm frustrated.

He's been putting in so much effort and when people blissfully ignore it, yeah, it's going to be frustrating.

Let him have his rant - at least he's not throwing the towel in. Everyone has their bad days.

[1]: http://www.statista.com/statistics/381388/asia-average-inter...

Re:Is it just me or is networking really hard? by ggambetta on Sunday September 13, 2015 @10:36AM (#10211527)
His articles are excellent, and I've learned a lot from them myself. But I cannot sympathise with lowering the level of a technical discussion to personal insults.
Re:Is it just me or is networking really hard? by Wintamute on Sunday September 13, 2015 @12:49PM (#10211944)
I would be wary about parsing any text below the words "RANT MODE ON" all caps in bold as technical discussion.
Re:Is it just me or is networking really hard? by angersock on Sunday September 13, 2015 @08:36PM (#10213234)
I don't know if this is a general failing of people's critical thinking abilities, a sloppiness in their reading, or something else, but I have noticed over the past (feels like) few years a growing problem:

A lot of folks conflate personal insults ("you, ggambetta, are clearly a dunderhead when it comes to reading comments") with general sentiments about a group or abstract population ("Hacker News posters tend to be overly sensitive to the point of being crybabies").

A great deal of the flavor and comedy in writing, especially pieces that are self-identified rants, are not from personal insults but instead from hyperbolic and sometime vitriolic statements about an abstract other.

Re:Is it just me or is networking really hard? by gafferongames on Sunday September 13, 2015 @09:20PM (#10213315)
Spot on and this was firmly written with tongue in cheek! It's funny because it's true though. I harbor no ill will to anyone. Also, a nice ending to this whole thing, the original poster found the article, and halfway through reading it, realized it was about them and posted a comment!
Re:Is it just me or is networking really hard? by copperx on Sunday September 13, 2015 @03:30PM (#10212500)
On the other hand, I really love those personal insults. They get the point across. Maybe there's something wrong with me?
Re:Is it just me or is networking really hard? by amagumori on Sunday September 13, 2015 @05:53PM (#10212922)
there's a difference between being angry at people and insulting them. he was definitely pissed off, but he didn't insult anyone.
Re:Is it just me or is networking really hard? by plonh on Sunday September 13, 2015 @08:48PM (#10213257)
I can't sympathize with a technical discussion Mandarin. Lucky it is a big internet with lots of blogs.
Re:Is it just me or is networking really hard? by brudgers on Sunday September 13, 2015 @12:54PM (#10211958)
An explanation for a behavior is not an excuse for it. Likewise my synpathy for the frustrations that led to someone else's behavior don't make the behavior right.
Re:Is it just me or is networking really hard? by wpietri on Sunday September 13, 2015 @01:40PM (#10212117)
Which specific behavior concerns you?

My only real complaint is that he's addressing a particular person here. In his shoes I would have anonymized the source of the text and maybe blended material from a few different people. I'd rather the individual didn't accidentally recognize their words.

Other than that, I think I'm ok with people making exasperated rants. For those of us who actually understand the topic or have experience of teaching, I think a rant like this can at least be funny, and often can be cathartic. One shouldn't howl at the noobs, but howling at the moon seems fine by me.

I think it's also helpful for novices to see the occasional bile-dump like this. The question comes across to me as kinda lazy. The querent never really took the time to understand the core technologies and instead just spent a few months implementing broken stuff. But rather than think it through, he just waves away an expert answer as "kind of silly". A piece like this can help novices see how frustrating and self-defeating that kind of laziness is. I know I've benefited from seeing others get roasted for mistakes I could well have made.

Re:Is it just me or is networking really hard? by ibejoeb on Sunday September 13, 2015 @08:36PM (#10213233)
There's nothing wrong with his behavior. He's an adult, and he can speak candidly. He needs no permission to rant or use foul language.
Re:Is it just me or is networking really hard? by simoncion on Sunday September 13, 2015 @06:02PM (#10212947)
Does nickpsecurity's breakdown of the reason for the rant help you to understand its appropriateness?

https://news.ycombinator.com/item?id=10212003

Please take the time to read and digest nickpsecurity's comment in its entirety before forming an opinion about it.

Re:Is it just me or is networking really hard? by plonh on Sunday September 13, 2015 @08:55PM (#10213267)
Indeed, it is wrong for a novice to ask a professional how he accomplished his work, and then call the answer "silly" without any evidence or reasoning in support.
Re:Is it just me or is networking really hard? by Goladus on Sunday September 13, 2015 @09:14AM (#10211279)
Personally, I consider it very bad taste for you to sanctimoniously criticize Gaffer's tone to promote your own work. Sometimes a good rant is a very effective way to communicate.

PS http://www.paulgraham.com/disagree.html

Re:Is it just me or is networking really hard? by ggambetta on Sunday September 13, 2015 @10:45AM (#10211559)
You are probably right -- it was bad taste. I got a bit annoyed by the tone of the article; I don't think personal insults have a place in a technical discussion.

I taught Computer Graphics for several years, and I came across two kinds of students: uninterested, so no matter what you do they probably won't learn; and interested and trying hard but not understanding, in which case it's my responsibility as the teacher to find a way to get the idea into their heads.

In this latter case I believe asking someone who is trying (but failing) to understand what I'm saying "What the fuck is wrong with you?" doesn't lead to better understanding on their part. Yes, I promote my own work, but this is because I feel it caters to a public that is usually left out -- the absolute beginner. The kind of people who are missing a mental leap or two to get the concepts but are either ignored or essentially called idiots for not understanding.

Re:Is it just me or is networking really hard? by camperman on Sunday September 13, 2015 @12:59PM (#10211975)
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 gilded +20 comment in the thread despite a) being nonsense and b) having the temerity to call his advice 'horribly flawed.' He is an expert with multiple shipped AAA games. And he prefixed his rant with RANT MODE ON. Sometimes you just need the cluestick.

Re:Is it just me or is networking really hard? by pyre on Sunday September 13, 2015 @02:14PM (#10212233)
> 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.

Re:Is it just me or is networking really hard? by Dylan16807 on Sunday September 13, 2015 @04:33PM (#10212712)
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? by pyre on Sunday September 13, 2015 @07:54PM (#10213167)
I was using "never implement your own crypto" as an example. I think that "never implement your own crypto" is a more important rule to follow than anything regarding TCP. On the other hand, if you don't know much about networking, trying to reimplement TCP over UDP isn't likely to gain you better performance. As with most things, there is no substitute for knowing what are doing.
Re:Is it just me or is networking really hard? by Dylan16807 on Sunday September 13, 2015 @09:46PM (#10213361)
I know it was an example, but the crypto saying is actually a good rule of thumb, while "don't do TCP" is a pretty bad rule of thumb.

You don't need to know that much about networking to get something that's better than TCP in this specific use case. It may be unoptimized and terrible but your goal is latency. Just pretend that 5% of packets will get lost and do something to compensate, and you beat TCP on imperfect networks, even as a novice.

Re:Is it just me or is networking really hard? by zurn on Monday September 14, 2015 @12:55AM (#10213693)
There's a lot of work besides performance to get right in a transport protocol though. Just getting the retransmission working like you want is a small part of the job.

WebRTC went for UDP-encapsulated SCTP in order to get a transport without HOL blocking. I'd look into that or an existing UDP game net transport (like Enet) first.

Re:Is it just me or is networking really hard? by Gibbon1 on Sunday September 13, 2015 @06:22PM (#10212979)
I think 'never implement your own crypto' really means, 'this is an area where there is no substitute for knowing what the hell you are doing. Sometimes knowing what you are doing is not hard (changing a tire), sometimes it is (cryto and networking)
Re:Is it just me or is networking really hard? by aavegmittal on Sunday September 13, 2015 @04:11PM (#10212656)
Agreed. TCP is a great general purpose communication protocol, but using it in all situations is probably not a good idea. For eg, for a specific case of mobile networks, a custom protocol built over UDP could out perform TCP. details here:

https://packetzoom.com/blog/lessons-learned-tcp-slow-start-d...

Re:Is it just me or is networking really hard? by nickpsecurity on Sunday September 13, 2015 @01:07PM (#10212003)
I have mixed feelings about it. A student with character will at least read the material, try to understand it, and then ask questions about confusing points. So, I put it to the test by loading up the article the Redditer saw. First paragraph explained it's part of a series with this link:

http://gafferongames.com/networking-for-game-programmers/

Very first link explained some of what Reddit poster asked with others covering how to solve the problem and why each method was used. Reading that person's post shows he or she took a casual glance at Part 4, didn't attempt to read rest, drew conclusions, then smeared same article on Reddit, then pretended to know what he or she was talking about on advanced aspects, and then asked some questions. This is the kind of behavior that makes the Internet drop verbal bombs on people as punishment and to deter future instances of laziness and arrogance.

So, when seeing this, the writer has several choices: reward the behavior by rewriting their articles points in new comment for just that lazy person w/ specific references to things he or she ignored; link back to original w/ guidance on specific parts he or she ignored; blast him or her for being a lazy idiot who writes criticisms of stuff he or she doesn't even read. I think the latter is an entirely valid strategy in such a situation. It has the side benefit of preparing the person for the fact that the Internet will drop bombs on them when they display laziness, ignorance, and sense of authority at the same time. Hopefully the deterrent effect kicks in with the poster reading the next article and its links first. And only then questioning or criticizing part of it.

Less likely to get rants that way from that writer, other writers, FOSS projects, and anyone else that doesn't tolerate such bad behavior. You're much more patient than most. Nothing wrong with that either. Let's just differentiate between people making solid attempt to learn and people like this poster. Nobody's insulting the former. If they did, I'd totally agree with you. Far as this poster, I'd have grilled him or her too.

Re:Is it just me or is networking really hard? by Cederfjard on Sunday September 13, 2015 @01:00PM (#10211979)
To me, it feels like the biggest gripe isn't with people who don't understand, but with those who claim they do when they don't. It's always frustrating to see people talk confidently out of their ass, especially when they're criticising you.

I'm usually not bothered by insults or harsh language, so perhaps we're viewing this post through different lenses.

Re:Is it just me or is networking really hard? by nickpsecurity on Sunday September 13, 2015 @01:09PM (#10212011)
I expressed the same view here:

https://news.ycombinator.com/item?id=10212003

I think the person didn't even read the articles but smeared them anyway. Blasting such a person is entirely justified. That the rant included useful information, too, was quite generous.

Re:Is it just me or is networking really hard? by cortesoft on Sunday September 13, 2015 @01:39PM (#10212107)
Was there no third type of student: those who WERE understanding?
Re:Is it just me or is networking really hard? by ggambetta on Sunday September 13, 2015 @02:34PM (#10212311)
Hahaha, of course :D
Re:Is it just me or is networking really hard? by duaneb on Sunday September 13, 2015 @02:09PM (#10212217)
This is not one of them. Frankly, unless you have a reason NOT to use TCP (and a very good one is realtime lossy communication), don't try to implement your own damn custom protocol on top of UDP that's just going to be a shittier TCP. This doesn't mean that TCP is perfect, but if you want lossless communication you will PROBABLY be happier there.

If I'm writing a chess game, I could easily just stream the text format of the games over an IRC channel. Many things, including games, don't necessarily need high bandwidth or low latency over consistency.

But the attitude is definitely not warranted.

Re:Is it just me or is networking really hard? by andy_ppp on Sunday September 13, 2015 @10:39AM (#10211537)
Re:Is it just me or is networking really hard? by Goladus on Sunday September 13, 2015 @02:13PM (#10212230)
At least make sure your accusation is true before making it.
Re:Is it just me or is networking really hard? by Mithaldu on Sunday September 13, 2015 @07:41AM (#10211046)
Glenn's articles are also well received and go in fact into much more detail, with code examples of various pieces of infrastructure. He's been writing them based on patreon donations for a while now: https://www.patreon.com/gafferongames

This one is just a frustrated vent at people who don't understand the difference between TCP/UDP, don't make the effort to learn about it, but feel the need to espouse about it.

--

As an aside: floodyberry, you've been hell-banned for a few years now. Might wanna mail the mods.

Re:Is it just me or is networking really hard? by benihana on Sunday September 13, 2015 @07:52AM (#10211069)
I don't get this guy at all. He opens with how hard networking is, then spends the entire article calling his readers stupid for not getting networking. Ok.
Re:Is it just me or is networking really hard? by Marazan on Sunday September 13, 2015 @08:14AM (#10211109)
Because he wrote an article on how to do networking but then gets people who clearly don't understand how networking works criticising and dismissing his article.
[dead]
Re:Is it just me or is networking really hard? by desdiv on Sunday September 13, 2015 @11:01AM (#10211607)
I was hellbanned for a while and didn't know it until someone told me.

I emailed the mods and they told me they never banned me and that it must've been a technical glitch.

Re:Is it just me or is networking really hard? by rch on Sunday September 13, 2015 @11:23AM (#10211665)
The phrase you're apparently concerned with here is preceeded by:

"I swear you guys are like the fucking climate change deniers of network programming."

I appreciate the sentiment in context.

Re:Is it just me or is networking really hard? by nickpsecurity on Sunday September 13, 2015 @12:32PM (#10211884)
I liked that part, too. Haha.
Re:Is it just me or is networking really hard? by archagon on Sunday September 13, 2015 @01:34PM (#10212090)
I'm usually allergic to rants, but I liked this one because it didn't attack anyone in particular and also had tons of technical evidence to back up its claims. Gaffer even helped out the OP in a big way by providing a solution to his problem. Basically a free consultation from a networking expert.
Re:Is it just me or is networking really hard? by jokoon on Sunday September 13, 2015 @01:20PM (#10212053)
Sometimes inviting the reader to ask himself question or be curious about the tools he's using can be important. Latency is not often taken in consideration when teaching networking. So many consider TCP to be the standard versus UDP, which needs to be clarified.
Re:Is it just me or is networking really hard? by Luc on Sunday September 13, 2015 @07:35AM (#10211031)
Thanks very much for this, these are great articles.

It seems one would need some way of synchronizing clocks (or measuring the lag between server and client). Do you know if there is a standard way of accomplishing this?

Re:Is it just me or is networking really hard? by exDM69 on Sunday September 13, 2015 @07:55AM (#10211073)
> Do you know if there is a standard way of accomplishing this?

Synchronizing clocks is one of the difficult problems in distributed computing.

Games tend to avoid doing proper synchronization of clocks by working in discrete time steps (frames). Because games run at 15-60 frames per second (a bit more for simulators), you can get away with synchronizing the clocks to +/- a few frames, ie. an accuracy of tens of milliseconds is good enough to provide a perception of real time.

In other words: game time is measured with an unsigned integer that tells how many time steps have elapsed since the game started.

Re:Is it just me or is networking really hard? by techdragon on Sunday September 13, 2015 @10:05AM (#10211431)
Sorry but that needs a rather large asterisk applied to it. In the current era of 120Hz LCD displays and a Billion dollar market for video games. It's becoming very evident that the "best", not in a AAA title sense, but in the 'so popular it becomes a sport with professional players" sense, games are those that have put a LOT more effort into the implications of their network synchronisation algorithms. Some game engines have extremely long tail lives as popular mods take advantage of reliable network behaviour to create gaming experiences that don't infuriate passionate players keeping them alive many years after the game that wrote the engine moved on.
Re:Is it just me or is networking really hard? by exDM69 on Sunday September 13, 2015 @01:38PM (#10212102)
Very good point! Back in Quake 1 days, the gameplay framerate was only 15 frames per second, so a more crude mechanism would do.

I guess modern AAA games synchronize their clocks with an algorithm similar to what NTP is using. We're still talking about discrete time steps, though, so there's some tolerance for a little clock mismatch.

Re:Is it just me or is networking really hard? by animal531 on Monday September 14, 2015 @11:43AM (#10215615)
Usually these days we use client/server for most games, meaning that initially the server is taken as being authoritative on time. It can collect and use a running average of pings to/from all clients which it can then use to order events (ie. did I do X before you did Y?). But that's where the really hard (and fun!) coding and choices start, such as for example future prediction and unrolling of actions.

Roughly speaking, for prediction (to lessen the effect of perceived lag), the server could predict that I was moving forward up to the last packet received, so I'm probably still going to be moving forward. It can then use the predicted values in all calculations until it receives an actual packet informing it what actually happened (at which point it will need to decide how to handle possibly conflicting information, which is handled the same as below).

For unrolling, if you have for example a 50ms ping and I 100ms; then at T+51ms you tell the server that you killed me, but I do the same at T+100ms - effectively compensating for the 50ms of lag difference between us you should die since I killed you 1ms before you killed me. BUT now it really depends on the server choices, do you kill me because your message got there first (old-school FPS); or does the server wait for my info since I'm involved in the action and then retroactively adjust you? Worse, since the server only gets my info on T+100 you will at best only get it at T+150, meaning that you will perceive 99ms of being alive (and maybe during which you killed someone else) which the server will then have to discard before killing you (some modern FPS use this scheme, you'll notice it where you peek out around a corner from safety and then go back, before suddenly being dead from an impossible shot). Also tough is the fact that it's not a single unroll, during the extra 99ms of being alive you would have still been sending packets to the server which then all have to be unrolled.

Re:Is it just me or is networking really hard? by kaoD on Sunday September 13, 2015 @08:19AM (#10211121)
I've used this technique[0] successfully in a networked minesweeper game I made ages ago. Wikipedia lists more algorithms[1].

[0] http://www.mine-control.com/zack/timesync/timesync.html

[1] https://en.wikipedia.org/wiki/Clock_synchronization