Networking Client / Server

Networking Client / Server

UnKnown

10/7/2013 7:16:00 PM

Just some things I have learned about networking games in the last couple of days.  First you want to use UDP aka User Datagram Protocol this protocol is fast and does not carry the overhead that TCP does.  Both protocol are built on the IP layer but UDP does not have a lot of the checks and balance that TCP does for errors and data structure.  This has a down side that I think more packets are lost during transport and we may never get them back.  However with game programming the most recent packet is normally all we care about.  As we want the most up todate information for the game.  Most the calls for this are pretty simple with the .net classes however since we want to send struct instead of just primitive data type like int, string or byte.  This adds a complexity to the code for sterilizing and desterilizing a struct.  We are currently using a Marshal helper to do this.  But I do know of a memory with a binarywriter and binaryreader that I think would do this as well.  Not sure if there is any gain in preformance between the two at this time.  I am going to leave it a long because as of now it works great so unless I see a problem with it might try the other way of doing it.  There is an article pasted in below that shows some more information about all of this.  The class that have develop I think handle all the case in that document along with some other website article i have found.  As of now I think we have a really good start on a networking structure.
 
 
 

  • 0