An introduction to networking for game programmers:
Hi, I'm Glenn Fiedler and welcome to the first article in my article series Networking for Game Programmers
In this article we start with the most basic aspect of network programming, sending and receiving data over the network. This is just the beginning – the simplest and most basic part of what network programmers do, but still it is quite intricate and non-obvious as to what the best course of action is. Take care because if you get this part wrong it will have terrible effects on your multiplayer game!
You have most likely heard of sockets, and are probably aware that there are two main types: TCP and UDP. When writing a network game, we first need to choose what type of socket to use. Do we use TCP sockets, UDP sockets or a mixture of both?
The choice you make depends entirely on what sort of game you want to network. So from this point on, and for the rest of this article series, I'm going to assume you want to network an action game. You know games like Halo, Battlefield 1942, Quake, Unreal, CounterStrke, Team Fortress and so on.
(Score: 2) by driverless on Tuesday January 03 2017, @02:56AM
Great summary! It's interesting that you mention performance considerations in regard to dialup modems and the like, there's a lot of historical baggage around TCP vs. UDP that dates back to fuzzball routers and 2BSD and similar, before every NIC had hardware offload and every router was done in ASICs (at least for the fast path) that operated at the full line rate. So in many cases where the historical wisdom was that you did it in UDP, it's now perfectly OK to do it with TCP. In particular, as you point out, reimplementing 90% of TCP, inevitably done badly because you have to rediscover 40-odd years of TCP optimisation and tuning each time you do it, using UDP is never a good idea.