Jump to content

  • Log In with Google      Sign In   
  • Create Account

UDP and TCP


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Nikopol_AU   Members   -  Reputation: 468

Like
0Likes
Like

Posted 22 June 2012 - 12:40 AM

In fast-paced FPS game,
I plan to send updates stream from server to client using UDP.

Is it a good idea to send user actions from client to server using TCP ?
Or maybe it will be better to send this info using UDP and some delivery guarantee protocol ?

Sponsor:

#2 Gazu   Members   -  Reputation: 216

Like
0Likes
Like

Posted 22 June 2012 - 03:41 AM

I'm no expert, but from what I understand so far, UDP with delivery guarantee is basically TCP.
So that would totally annihilate the advantage of UDP, which is, being faster than TCP.

I think in fast-paced games with constant updates for the gameview, TCP should only be used for requests which really need to get to their destination by all means, like, the Server has a list of clients which are currently playing and wants to add a new client. If you use UDP for that and the packet gets lost, you're screwed. Of course you could modifiy it so that your UDP socket sends that "connection request" over and over, until it gets a response from server which tells the client "yep, I got you". But as I said, that is basically TCP.

The thing with user actions is, user actions are most likely to be sent to the server all the time, so would it really hurt if there was some loss here and there? (which isn't even very likely to happen with UDP, it just CAN happen because there is no guarantee) using TCP for that constant flow of data would slow down the performance considerably and lags will become more likely.

At least, that's what I understand.

#3 btower   Members   -  Reputation: 983

Like
0Likes
Like

Posted 22 June 2012 - 04:07 AM

UDP with guaranteed delivery is not "basically TCP annihilating the advantage of UDP"... TCP is much more than that. TCP doesn't just guarantee delivery, it also guarantee's the packets to arrive in order, and it also manages flow of packets (flow control).

You should just use UDP. For an excellent resource explaining all the details, see: http://gafferongames...ers/udp-vs-tcp/

Edited by btower, 22 June 2012 - 04:07 AM.


#4 Gazu   Members   -  Reputation: 216

Like
0Likes
Like

Posted 22 June 2012 - 06:33 AM

Oh I see, I wasn't aware of that particular difference between TCP and UDP, thank you.

#5 Rasterman   Members   -  Reputation: 206

Like
0Likes
Like

Posted 22 June 2012 - 07:03 AM

http://www.gamedev.net/index.php?app=forums&module=forums&section=rules&f=15

#6 Xanather   Members   -  Reputation: 712

Like
0Likes
Like

Posted 23 June 2012 - 05:14 AM

For a FPS I would recommend using UDP, only because of the responsiveness that it provides and that it is a fast paced fps. By using UDP though you have to have ways to overcome packet loss (what if this is sensitive data such as a order to change map gets lost out in the vast internet?)

Read this, it talks about using lag compensation and other strategies in first person shooters (how valve's source engine does networking)
https://developer.va...ayer_Networking

I have never developed a mainstream network (especially for a FPS game) yet but I just know that reading that will be very helpful.

Edited by Xanather, 23 June 2012 - 05:15 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS