Jump to content
  • Advertisement
Sign in to follow this  
Leo28C

Question about UDP

This topic is 4251 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone! Okay, so I have a first-step game here. You walk around and the other clients can see you. That's it. On a 2GHz computer, one server and 2 clients run perfectly fine. On a (very crowded) 1.4GHz, not so much. The opposite clients move very slowly on the screen. I can't use both computers due to a temporary (I hope) router problem. I'm using TCP right now. Maybe UDP will do it better? It's unreliable though. When clients first connect, data that cannot be changed it sent, such as user ID and total number of players. I'm working this way; client presses a key, sends new X/Y to the server, server sends X/Y to the other clients. Wouldn't it look choppy if some of the X/Y's don't get to their destination? What if they're corrupt, it would be worse. Can someone please clarify? Thanks in advance! (PS: If you need to know, the language is the lovely C#)

Share this post


Link to post
Share on other sites
Advertisement
Corruption is unusual enough not to be a problem. Choppiness can be avoided by buffering some input from the server and interpolating between two previously received positions; but this creates some percieved latency (lag). For two clients TCP or UDP shouldn't matter; are you disabling nagles algorithm (m_socket.NoDelay = true)?
If you want to try UDP i'll shamelessly plug my own library at http://code.google.com/p/lidgren-library-network

Share this post


Link to post
Share on other sites
UDP guarantees that packets will arrive intact. They might arrive out of order, not at all or multiple times, but if a packet arrives, you can assume it's valid.

Share this post


Link to post
Share on other sites
The non-corruption guarantee of UDP is unfortunately based on a very weak checksumming algorithm. However, if you do authentication through cryptographic signing (hashing), then that will take care of detecting corruption for you.

[Edited by - hplus0603 on April 23, 2007 10:23:49 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!