View Full Version : UDP vs TCP/IP for gaming
CiNiMoDZA
15-03-2011, 11:13 AM
I have read up on both and both have pro's and cons, but which would be better to use? Im making a library for fun in C# and want to mess around with an MMO idea, which would be better? My gut feeling says TCP/IP...
Im probably going to use both just for fun anyways :P
dislekcia
15-03-2011, 04:17 PM
Generally games tend to use TCP for critical information and establishing connections, that way you can be reasonably sure that something has arrived. Then, once game state has been confirmed and everyone knows where they are, UDP is used to transfer realtime information because it's faster. The only issue is to make sure that information sources are made aware of the info that receivers have confirmed receipt of, but you have to do that with TCP in complex games anyway - TCP can fail too.
Necrolis
15-03-2011, 04:46 PM
The only issue is to make sure that information sources are made aware of the info that receivers have confirmed receipt of, but you have to do that with TCP in complex games anyway - TCP can fail too.technically you don't even need to bother confirming reception of the packet, game state delta's work this way (it has its downsides though), but what you use depends heavily on the type of game, resources you can use and whether your concerned about efficiency or "that it just works". some light reading: http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/Quake3Networking & http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/IntroductionToMultiplayerGameProgramming
dislekcia
15-03-2011, 11:20 PM
technically you don't even need to bother confirming reception of the packet, game state delta's work this way (it has its downsides though), but what you use depends heavily on the type of game, resources you can use and whether your concerned about efficiency or "that it just works". some light reading: http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/Quake3Networking & http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/IntroductionToMultiplayerGameProgramming
State deltas always depend on a known/shared state, if you don't update the sender on the state you're currently using as the base for deltas, then it's not going to send you the correct delta info ;)
I remember reading both of those articles ages back.
FuzzYspo0N
16-03-2011, 02:19 AM
best of both worlds, UDP that has reliable packets.
http://enet.bespin.org/
"ENet's purpose is to provide a relatively thin, simple and robust network communication layer on top of UDP (User Datagram Protocol). The primary feature it provides is optional reliable, in-order delivery of packets."
In other words, the joy of TCP with the benefits of UDP (multiple users, for example)
Powered by vBulletin® Version 4.2.4 Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.