This is a split board - You can return to the Split List for other boards.

What games use TCP and what games use UDP?

#1KeyeszxPosted 10/6/2013 10:54:53 PM
Trying to understand the difference. From what I can tell TCP would be something like like Starcraft 2 where the players connect to one server and that server than sends out the information to all the players(clients).

Then UDP would be more like connecting directly player to player or something? I'm not entirely sure on UDP.

Could someone give some examples of games that use one or the other?
---
PSN/Gamertag:Keyeszx (Don't send blank friend invite)
Currently Playing:League of Legends, Ultimate Marvel vs Capcom 3, Mortal Kombat, Infinity Blade 2
#2turbovirginPosted 10/7/2013 12:03:55 AM
Most games are UDP. UDP just sends packets to the other player without bothering to wait for acknowledgements or provide flow control.

With TCP every packet must be acknowledge by the other computer and if no acknowledgment is received the packet is resent. Problem is, things change so fast (is player movement) in a game that it often doesn't make sense to resend a packet as it will contain old information. TCP will also give greater latency than UDP making it a poor choice for games.
---
Heads on straight, my girlfriend's beautiful, looks pretty good to me
#3Keyeszx(Topic Creator)Posted 10/7/2013 6:25:36 AM
Your explanation makes it sound like UDP is more dangerous. Since nothing is acknowledged it could be false data. By false data I mean hacked data. I'm sure TCP can't be that slow. I guess maybe it's slowness is similar to how Java is slower than C++. It's slower but they're both still pretty damn fast.

I can't see TCP being that bad if it's still included in libraries for games.
---
PSN/Gamertag:Keyeszx (Don't send blank friend invite)
Currently Playing:League of Legends, Ultimate Marvel vs Capcom 3, Mortal Kombat, Infinity Blade 2
#4SinisterSlayPosted 10/7/2013 7:05:15 AM
Keyeszx posted...
Your explanation makes it sound like UDP is more dangerous. Since nothing is acknowledged it could be false data. By false data I mean hacked data. I'm sure TCP can't be that slow. I guess maybe it's slowness is similar to how Java is slower than C++. It's slower but they're both still pretty damn fast.

I can't see TCP being that bad if it's still included in libraries for games.


They are used at the same time.

Server lists, chat, stats, etc. Anything that must be accurate will be sent with TCP.
Things like character movement, will be sent with UDP as it's not important if a packet disappears. If a large bunch disappear, players will appear to jump around on screen.

Most RTS games use TCP.

Keep in mind, packet dropping is pretty rare.

Try pinging a server on the other side of the world, set it for infinite (ping address -t) and check on it in a few hours. In most cases there will be almost no failures at all.
---
He who stumbles around in darkness with a stick is blind. But he who... sticks out in darkness... is... fluorescent! - Brother Silence
#5turbovirginPosted 10/7/2013 7:13:38 AM
Packet loss is pretty rare and you can also program your own error detection or other algorithms on top of UDP. And like slay said some games will still use TCP. World of Warcraft is an example of a popular games that uses TCP.

In games where low latenecy is critical, UDP is used. This includes most FPS games like battlefield, CoD, halo, and team fortress.
---
Heads on straight, my girlfriend's beautiful, looks pretty good to me
#6ChetyrePosted 10/7/2013 7:25:29 AM
Keyeszx posted...
Your explanation makes it sound like UDP is more dangerous. Since nothing is acknowledged it could be false data. By false data I mean hacked data.


That's not what acknowledgement means. And both can be just as easily faked, but that is for the server to handle. If a package is invalid the server will usually just drop it.

TCP:
client: I sent you a package, waiting for a response.
server: I got the package, here is your answer.
client: I got the answer, have another package; waiting for a response.

UDP:
client: I'm transmitting packages and I don't care whether you are getting them or not, I'll just keep transmitting.
server: *processes*
---
"Beyond The Beaten Path Lies The Absolute End. It Matters Not Who You Are, Death Awaits You." Nyx Avatar
#7SinisterSlayPosted 10/7/2013 7:36:43 AM
Chetyre posted...
Keyeszx posted...
Your explanation makes it sound like UDP is more dangerous. Since nothing is acknowledged it could be false data. By false data I mean hacked data.


That's not what acknowledgement means. And both can be just as easily faked, but that is for the server to handle. If a package is invalid the server will usually just drop it.

TCP:
client: I sent you a package, waiting for a response.
server: I got the package, here is your answer.
client: I got the answer, have another package; waiting for a response.

UDP:
client: I'm transmitting packages and I don't care whether you are getting them or not, I'll just keep transmitting.
server: *processes*


Also, packet loss isn't necessarily that the packet disappeared.
At it's base form, a packet is just a series of voltages. These voltages break down the farther they travel, and eventually reach a hub/switch/router or something else that will read the packet, and re-transmit it. If it reads the packet incorrectly, it will transmit the wrong voltages.
This happens several times, sometimes going up to satellites and back.
When it finally reaches the destination, the packet might be completely ruined. All packets have a checksum attached to them, if the checksum fails, the packet is discarded.
This is where TCP is different from UDP. In UDP, the packet is discarded and nothing else is done, in TCP, a server now sends a message back saying it didn't get the last packet, send it again.

This also happens in a LAN, very often with WIFI which has a high failure rate. Which is why most don't recommend gaming on wifi although I think modern Wifi with routers automatically does something similar to TCP even over a UDP connection.

Ever notice how WIFI advertises speeds like 300mbps and yet runs a lot slower than a normal 100mbps LAN? It's all overhead and slow downs.

TCP has another problem.

On a failure, both sides agree to slow down and try again.

It's not 1 packet back and forth, its more like 4000 packets at a time.
So computer sends 4000, server receives 3999. The server responds back and the computer now sends those same packets all over again, all of them, but in a 2000 group instead. The server may only get 1999 again so again they agree to a slower speed.
This can keep happening until your down to 10 packets per response, causing a huge latency between you and the server.
In a game, that data is actually old and irrelevant already.
---
He who stumbles around in darkness with a stick is blind. But he who... sticks out in darkness... is... fluorescent! - Brother Silence
#8Keyeszx(Topic Creator)Posted 10/7/2013 12:23:20 PM
I was watching this thing that said that UDP and TCP aren't used at the same time because TCP induces packet lost in UDP. The guy linked something describing why it happens. I haven't read it yet.

http://www.isoc.org/INET97/proceedings/F3/F3_1.HTM#s2
---
PSN/Gamertag:Keyeszx (Don't send blank friend invite)
Currently Playing:League of Legends, Ultimate Marvel vs Capcom 3, Mortal Kombat, Infinity Blade 2
#9SinisterSlayPosted 10/7/2013 12:30:07 PM
Keyeszx posted...
I was watching this thing that said that UDP and TCP aren't used at the same time because TCP induces packet lost in UDP. The guy linked something describing why it happens. I haven't read it yet.

http://www.isoc.org/INET97/proceedings/F3/F3_1.HTM#s2


That's a bit misleading.

It's saying the sync packets for TCP cause this to happen.

But what this actually shows is congestion packet loss. The TCP is losing packets to, it's just resending them. The more congestion, the more packets lost.
---
He who stumbles around in darkness with a stick is blind. But he who... sticks out in darkness... is... fluorescent! - Brother Silence