Question:
What protocol do you think video game programmers would use UDP or TCP? Why do you think the game uses one or the other protocols? Give details!
Solution Preview:
Introduction
Video game programmers need to select the type of protocol for developing a game. There are two different sockets available i.e. TCP/ IP and UDP. Both the sockets differ in properties as listed below
TCP
- Connection based
- Data is automatically divided into packets
- Efficient flow control
- Reliable
- Guarantee order of data
- Easy to use
- No reliability
- Connection less
- Data ordering is not guaranteed
- No control over data flow
- Data needs to divided manually into packets
UDP
Based on properties, a programmer can choose both the protocols as per his requirements and expectation of game but UDP is always preferred by the programmers for games. There are number of reasons for this selection as TCP reliability and guarantee does not suit the programming environment.
Reasons for TCP is bad with video games
TCP can make the gaming environment poor: TCP can make the gaming environment poor in multi-player programming environment as TCP will break data into small packets and can decide that data will be sent only enough data is buffered so that a reasonable size packet can be built. This can make response time delayed which is not expected in gaming environment.
TCP second quality of reliability of data to be in order can also prove a curse as if TCP detect a packet is loss; the lost packet is resented to other machine. The receiver will discard the duplicate packets and packets are re-sequenced for reliability and ordered response. This will delay the response to a minimum of 1/5th of a second to maximum 1/2 of second.
So, TCP must not be used in such environment as every action has to be stopped and wait until the lost packets are sent and ordered.
When a programmer can choose TCP
TCP is only suited for games where there are not any real time constraints and also receiving the latest data straight is not a necessity for the game to work, TCP is a good option.
WHY UDP
- UDP is best to use with gaming environment due to following reasons
- UDP does not delay in data transfer for connection establishment
- Since UDP does not track any connection control parameters so number of active clients can be supported than TCP
- UDP has less bytes overhead than TCP
- No delay due to packet loss which can be 1/5th of a second to maximum of ½ of second
- UDP support multicast and broadcast whereas a TCP does not
What We Offer:
• On-time delivery guarantee
• PhD-level professionals
• Automatic plagiarism check
• 100% money-back guarantee
• 100% Privacy and Confidentiality
• High Quality custom-written papers