Thread: UDP Game Protocol

  1. #1
    Registered User
    Join Date
    Jun 2004

    UDP Game Protocol

    Has anyone had experience with a production level UDP game server protocol?

    I was hoping for some help on how to proceed about this. What concerns and what issues should i consider. Security issues? Timing issues? Packet Loss? ...

    Any help is appreciated.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    All of those, and many more

  3. #3
    Registered User
    Join Date
    May 2002
    UDP is one of protocols that is used for speed (there are many ways to tune it, like using data portion than is <1k to limit self to 1 packet per transmission, etc).

    You first need to figure out what you want to do and if you need TCP or UDP. UDP is not guaranteed and packets can and do get lost, so you have to design your application level protocol to account for that. UDP is often used to transmit changes in a game and by design subsequent UDP packets will provide data to allow correction.

    For example:

    UDP0: monster location is (0,5)
    UDP1: monster loc (1,5)
    UDP2: monster loc (2,7)
    UDP3: monster loc (3,8)

    Lets assume UPD1 is lost, then UDP2 and UDP3 make up for it and you will get mild "warping" effect you often see in online games. If UDP2 and UDP3 are lost then you may see a monster in the wrong location but doing actions as if there were somewhere else since the server has the correct location but client thinks it is somewhere else.

    For UDP to work you have to send lots of data and some redundant packets for synchronization.

    Above example is very simplistic but you get the idea, usually in 1k UDP packet you can fit a lot of coordinate/world changes and each packet has things that changed recently and rest is packed with things that changed some time ago, etc, so there is always a fully packed UDP packet to overcome issues of packet loss.

    UDP is connectionless also, you don't need to establish a connection as in TCP/IP, once you have a socket listener at a client on say port 8888, then server just sends packet to port 8888 of the client and hopes something is there to accept it and handle it.

    Hope this helps as a starting point.

  4. #4
    Registered User
    Join Date
    Jun 2004
    thanx a bunch

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-08-2010, 12:08 AM
  2. Open-source Game Project
    By Glorfindel in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 03-24-2009, 01:12 AM
  3. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  4. Traceroute using UDP + ICMP
    By Unregistered in forum Windows Programming
    Replies: 0
    Last Post: 08-05-2002, 10:50 AM
  5. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM