TCP or UDP?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • TCP or UDP?

      Hey MrMike! I've just finished reading the networking chapter, but I just wanted some clarification on the subject.

      Was wondering which is actually better then to use in a real game? TCP or UDP? As you've stated that UDP is fairly lightweight, but doesn't have a duplex connection like TCP which I gather is therefore a more reliable means??

      I personally thought that TCP would be much better, since then you can make sure game events are received/sent in correct order, received/sent consistently, etc. on top of which, as stated in the book, you could actually use a streaming method? The thing that put doubt in my mind is that the book also suggests that most games make use of UDP.
      If you put your mind to it, you can accomplish anything.
    • ok, thats does make sense. So it entirely depends upon what type of game your creating. Thanx for the advice.
      If you put your mind to it, you can accomplish anything.
    • A better way to say this is "it depends on what kind of packets you are sending" - most games use UDP at the low level but implement some TCP-ish protocol on top for those packets that absolutely positively have to arrive...
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • Check out ZoidCom. It's very easy to integrate with the GCC engine architecture, and it has options for reliable vs. unreliable packets and ordered vs. non-ordered packets. And the automatic object synchronization is very nice.

      The only thing I would comment about it that's negative is that it's set up to deliver a good experience to a handful of connections, so FPS, RTS, racing games... It would not fare well with extrapolation to an MMO.

      The post was edited 1 time, last by kibiz0r ().

    • Network Programming for Microsoft Windows goes over everything from UDP to raw sockets under Windows, covers multicast and QoS, and a few other things. Basically, under a Windows environment you're going to want to use the overlapped completion port model for maximum throughput on a server, but the protocal is entirely dependent on the application.

      For an MMO or FPS I believe that UDP probably works good for the most part because the client is always wrong anyway and you get better speed overall.

      Anyway, head to the library and pick it up. It's not the best network programming book out there, but it's very informative where Windows is concerned.
      "Your job is not to die for your country. Your job is to make some other poor sod die for his."