UDP or TCP for MMORPG?
Hi, I know the difference between UDP and TCP, pros and cons and in which case to use which...in general...but i'm not sure about MMORPGs. I know some of them use UDP and some TCP and there are no visible differences (in speed and reliability). Why i'm asking this is because if i'll go with UDP i'll have to make ACK and package ordering so it's a lot to write, while with TCP i won't have to worry about this. Any ideas on this? Thanks
The slacker way of doing this: both.
Open a TCP socket for reliable/ordered data then send position updates using UDP. Later on you can move to using all UDP if you want and build a reliability layer on top of UDP, or send position updates over TCP if it's not a problem.
Open a TCP socket for reliable/ordered data then send position updates using UDP. Later on you can move to using all UDP if you want and build a reliability layer on top of UDP, or send position updates over TCP if it's not a problem.
When you use TCP, you have to create a socket per player on the server. This can add up to a lot of overhead, assuming that you really have added the first M to your MOG.
enum Bool { True, False, FileNotFound };
hmm...i guess almost all packages are reliable/ordered, except maybe chats...so that means mostly TCP...but then again I have to add the first M to MOG:) and now my main problem is movement...so I guess I'm in a kind of dilema...
thanks
thanks
In fact, Chat is usually something you want to be reliable (because it's only important that it gets through - a few dozen milliseconds of extra latency don't hurt there, and it doesn't occur very often compared to other packets).
Most other things are sent unreliably (because they are sent so often that it hardly matters if it's properly programmed).
I'm simplifying things a lot, of course. Unreliable sending of course entails a lot of stuff you need to do, but your latency will be MUCH MUCH better if you use user datagrams instead of TCP.
Most other things are sent unreliably (because they are sent so often that it hardly matters if it's properly programmed).
I'm simplifying things a lot, of course. Unreliable sending of course entails a lot of stuff you need to do, but your latency will be MUCH MUCH better if you use user datagrams instead of TCP.
so the conclusion...does it worth it for me to make UDP reliable?:)...or just go with TCP? i wrote the begining of the game, login', movement, chat, etc, and in our LAN it works ok without any 'reliability issue' but when i tested it over net...well i guess it's obvious what happend:)...thanks for your comments
If you have up to 250 players connecting to a single server, then TCP will probably scale allright -- something else is likely going to be your bigger problem. Exactly where the break-off point comes depends on platform, application, hardware, and probably phase of the moon. It could be at 300. It could be at 3,000.
Thus, use proper layering, and use TCP for now, and when you have a problem, rip out the bottom layer and replace it with reliable UDP.
Thus, use proper layering, and use TCP for now, and when you have a problem, rip out the bottom layer and replace it with reliable UDP.
enum Bool { True, False, FileNotFound };
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement