Stories
Slash Boxes
Comments

SoylentNews is people

posted by on Monday January 02 2017, @08:09PM   Printer-friendly
from the which-packet-is-right-for-you dept.

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.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 3, Insightful) by pe1rxq on Tuesday January 03 2017, @12:01AM

    by pe1rxq (844) on Tuesday January 03 2017, @12:01AM (#448704) Homepage

    Sending keyboard (or other input) events over UDP is generally a bad idea.

    What will your commands do if a few packets with crucial characters went missing? (e.g. 'rm -rf /lib' instead of 'rm -rf ./lib')
    Or the result in your text editor when a key-up event goes missing? (For extra drama make it the backspace key-up)

    Starting Score:    1  point
    Moderation   +1  
       Insightful=1, Total=1
    Extra 'Insightful' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   3  
  • (Score: 0) by Anonymous Coward on Tuesday January 03 2017, @02:30AM

    by Anonymous Coward on Tuesday January 03 2017, @02:30AM (#448740)

    This is not the use case for UDP.

    This is: you shoot a bullet in an FPS. Your key press gets lost on the network, you utter a curse on the gun and pull the trigger again. In the worst case, your avatar got shot in the mean time and you respawn.