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.
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.
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.