MMORPG and the ol' UDP vs TCP
#1 Members - Reputation: 128
Posted 11 May 2005 - 01:18 PM
#2 Members - Reputation: 402
Posted 11 May 2005 - 01:25 PM
Anyone have the look at Quake3 network code story hanging around? It's an intresting read, but it only really works for small enviroments where the priority is speed and not efficiancy or realiablity. Mind you, that system can be used over TCP or UDP. Just TCP automatically made sure the data arrived in a certain order.
EDIT: Found it
http://www.bookofhook.com/Article/GameDevelopment/TheQuake3NetworkingModel.html
Also See the Forum FAQ about TCP v UDP
http://www.gamedev.net/community/forums/showfaq.asp?forum_id=15
So anyways: TCP
#3 Anonymous Poster_Anonymous Poster_* Guests - Reputation:
Posted 11 May 2005 - 01:47 PM
However, I would still like to take advantage of interpolating users positions as they will be quickly moving around. Thus, I don't need to spend time waiting for a packet detailing the position of a ship that got lost when I already have the next update. So that implies I should be using UDP for that aspect of the game (as I mentioned in my post).
I did spend the time to read the FAQ as well as read over several of the articles here before I posted. The FAQ states exactly: "For role playing games, the story is less clear -- action-based RPGs with lots of kinetics, like City of Heroes, use UDP, whereas slower RPGs and MUDs often stay with TCP. For action-based games like first-person shooters or racers, you should absolutely use UDP." This game is an RPG where much of the game takes place in boats which are firing cannons back and forth. Thus, it is a bit of an action game. Though not as action filled as say Planetside. At the same time, there are less action packed areas of the game play. Anyway, my question still remains, is a combination of the two an appropriate approach or is it generally better to pick one? And I guess now, an add on, if just one, then which? It seems to me that the easy answer to that last question is TCP, but then how do you deal with lost position update packets, other than just letting the game be jumpy and laggy...
#5 Members - Reputation: 402
Posted 11 May 2005 - 01:57 PM
#7 Moderators - Reputation: 3296
Posted 11 May 2005 - 06:28 PM
Quote:
(It seems fast enough to me *wink*)
Yeah, that's why the FAQ talks about the "speed" of the two protocols.
Rumor has it that one of the reasons they had such lag and server queue problems initially was that they were using TCP, and the number of connections per server was just too much. With TCP, there is overhead per connected user in the form of a separate socket; with UDP, you can push that into user space and a simple hash table.
For the project described here, however, I doubt that either protocol will get in the way; pick one (or better: pick an existing library) and run with it.
#8 Members - Reputation: 269
Posted 11 May 2005 - 11:38 PM
Also the lag issues are still present. Whether this is a result of using TCP or just the high volume of users, whos to say other than Blizzard.
I have ran some TCPdump's on the game while playing and one thing that I noticed is when you use the mouse to "look around" the client pelts the server with an insane number of updates/sec. I didnt count, but I'd say on the order of 30 packets/sec.
With that said, TCP seems to be working good for the most part.
-=[ Megahertz ]=-
#9 Members - Reputation: 416
Posted 12 May 2005 - 12:44 AM
It allows you to send priority messages, packet ordering, etc.
rekkarsoft.com
GameDev Product Review
I'd really suggest using it. I'm doing the same thing for my school project (actually 2 school projects), except my game is tile-based.
#10 Crossbones+ - Reputation: 2422
Posted 12 May 2005 - 10:16 AM
RunUO is an Ultima Online emulator written in C# that has had up to 3200 connected clients on a quad Xeon box. Of course an isometric point and click game uses a hell of a lot less traffic (movement/view) than a 3D game.
You could also look at Dawn of Light which is a Dark Age of Camelot emulator written in C# that is a TCP/UDP hybrid approach. Basically the movement system works off UDP and for things that need to get to the server TCP works well.
So UO uses TCP, WoW uses TCP, Camelot uses TCP w/ UDP for movement, AC uses UDP, City of Heroes UDP, EQ TCP w/ UDP.
I'm not so sure if it is fair to say that WoW is laggy because of using TCP over UDP quite yet unless we see them change network subsystems.. as AC had a hell of a lot more lag than WoW ever has but it is using UDP.
So really it is up to the problem space, at least in my opinion I may be wrong on this.
#11 Members - Reputation: 583
Posted 12 May 2005 - 10:44 AM
Saruman's post kind of brought up some confusion... from what I've heard from the experts around here, UDP should always be used with MMORPG's simply because of the scalability problems associated with TCP... so, whats the deal? [grin].
#12 Crossbones+ - Reputation: 2422
Posted 12 May 2005 - 11:40 AM
Quote:
Original post by graveyard filla
hey everyone,
Saruman's post kind of brought up some confusion... from what I've heard from the experts around here, UDP should always be used with MMORPG's simply because of the scalability problems associated with TCP... so, whats the deal? [grin].
Sorry I don't mean to be confusing, I was just stating what commercial games use and for the most part MMOG games have been based off TCP in the past.
I have a larger listing at home that I will try to dig up, but the games and networking subsystems I listed above are correct. I actually have a server for a prototype game that can easily handle 2000-3000 clients on a single machine, but obviously it is not scalable and once I add in more defined movement/views I will need more than a single server system. I was looking at a variety of solutions but it is a very hard problem set to address as well as implement. I still haven't decided on the way we are moving with our product, but it has come down to either licensing a middleware product or using our current solution but zone-based.
Scalability completely depends on your architecture.. obviously if you have one single main server that hosts 3000+ TCP connections you will bog down... but if you have 5 of that machine talking with other ones, I haven't seen an issue yet. So far all my testing and prototype tweaking has lead me to do is use 2 servers in front and one single simulation server, which seems very nice for scalability.. except scaling the simulation sever needs to be thought out and is an amazingly hard problem set.
Oh Anarchy Online is also using a TCP based network architecture. Actually the majority that I have seen or have information about use a TCP based network architecture, or a TCP based architecture with UDP for quick updates such as movement. But as I stated it really depends on the problem set, as City of Heroes could not have been created using the same mechanics using TCP.
[Edited by - Saruman on May 12, 2005 8:40:36 PM]
#13 Members - Reputation: 583
Posted 12 May 2005 - 02:16 PM
I know what you mean about how complex a distributed simulation could be... from my own designs and talking with people like hplus, it seems like a very huge beast to tackle... so many problems with hand offs and such... my best idea was to just make it zone based, which is probably the simplest method... although this can only scale so well..
What's really interesting to me is a seamless, truly scalable world which isnt based on zones... e.g. two people standing next to each other in game can actually be connected to 2 seperate servers, for true scalability (imaging thousands of people all crowded in a small area and killing each other, this would be possible given the hardware with such an architecture)... IIRC 'There' works like this... some day hplus is gunna have to write a paper on all this crap [grin].
#14 Crossbones+ - Reputation: 2422
Posted 12 May 2005 - 02:33 PM
If you are going to spam packets such as movement.. than UDP seem the obvious choice to me because there is less overhead. But for anything else I fail to see why TCP is not able to scale or be used.
I also agree with you on how awesome the technology used in 'There' is, it is quite amazing. Although I would be willing to put money on the fact that is not a technology that will become 'mainstream' or 'public knowledge' really as it takes a lot more than a single person to build load balanced simulation servers.
One design we have been tossing around and are thinking of prototyping is basically our TCP simulation server but breaking apart certain components to be distributed services. We want to split apart the movement to a UDP service which would allow us to scale movement very easily even though it is all interacting with a single simulation server. Sure this doesn't give us ultimate scalability, but if we do that for each 'zone' it makes zones able to handle a ton of traffic. I mean 60-70% of traffic is movement traffic, so if we can offload that to a seperate service and have the other 30% on the simulation server I would be very happy.
#15 Crossbones+ - Reputation: 2422
Posted 13 May 2005 - 03:49 AM
Currently this is something we are looking at to solve our approach of having to use both TCP and UDP which can cause some trouble.. but we will either be using that approach or a full RakNet approach although we will have to modify the library to get it working for a large number of players.
#16 Moderators - Reputation: 3296
Posted 13 May 2005 - 06:34 AM
If your MMO is more of a classic MUD/RPG, and not a full "distributed simulation" then you don't necessarily need real-time properties in your protocol. You might be OK with receiving older data as part of a re-transmit. In that case, TCP will work fine, as long as the amount of connections doesn't overwhelm your server machine. With current hardware, I'd believe you can do 3,000 clients on a single machine, for RPG/MUD-style interactions.
So, analyze your problem; pick the right architecture.
Quote:
some day hplus is gunna have to write a paper on all this crap
I did. Sadly, we currently require an NDA to send it to you. Apparently, defense contracting isn't quite as open an environment as open source game development yet.
#17 Members - Reputation: 100
Posted 13 May 2005 - 07:13 AM
HP, is right about UDP in that it takes much more processing power so one of the things we're working on is implementing dynamic zoning, so that the players are seamlessly interacting with one another without overloading the servers by having everyone's slightest movement detail broadcasted to the whole map!
I am not a coder myself but if you have any questions about how we're planning on doing it email or PM me. 0_o
#18 Moderators - Reputation: 3296
Posted 13 May 2005 - 09:36 AM
Quote:
we will be using UDP for most of the system but we are looking into applying TCP for other tasks such as item interaction
If you've already built infrastructure for UDP communication, I recommend sending everything over it. We use UDP/TCP, and it works, but we had to do a LOT of mitigation to avoid large TCP packets from introducing unnecessary jitter on the UDP connection, especially for modem users.
I'd rather have a single point of communication, which can totally manage the bandwidth to the client, for all the data streams. Each data stream managing itself (as in a single TCP stream) is not ideal.
#19 Members - Reputation: 807
Posted 13 May 2005 - 11:25 AM
Quote:
Original post by hplus0603 Quote:
we will be using UDP for most of the system but we are looking into applying TCP for other tasks such as item interaction
If you've already built infrastructure for UDP communication, I recommend sending everything over it. We use UDP/TCP, and it works, but we had to do a LOT of mitigation to avoid large TCP packets from introducing unnecessary jitter on the UDP connection, especially for modem users.
I'd rather have a single point of communication, which can totally manage the bandwidth to the client, for all the data streams. Each data stream managing itself (as in a single TCP stream) is not ideal.
My early networked systems used UDP and TCP (including linked COTS hardware, multi-head (view) sims, with no genlocking (worked great)). Really early networked code (before the internet (arpanet was around)) it was all modems, and custom CRC-based lock-step protocols were the best you could do.
I started out using UDP+TCP for an Xbox launch title, but due to early performance issues, was forced to create a custom protocol using UDP only. The custom protocol effectively combines UDP and TCP into UDP-only packets. This is the most efficient method possible, especially for low bandwidth apps. I tested 100 moving 3D objects on a laptop connected via cellphone (14.4kbps data rate), and it worked fine (ended up around 1000ms latency).
Thus I recommend getting everything working with UDP+TCP until you hit a wall and are forced to write a custom UDP protocol. At that point you'll also have a much better idea of how to tackle the creation of a custom reliable UDP-based protocol (at least a few weeks to develop and possibly months to debug and test). You could also switch to a low cost or free existing library (Raknet, etc.).
It's not clear if this is still true, but in 2002, some internet routers gave preference to UDP packets over TCP packets. That is, during high traffic situations, TCP packets would be dropped in preference to UDP packets, with the logic being that UDP packets are time critical for real-time apps, whereas TCP was carrying mostly non-time-sensitive data. I poked around google for info in 2005, but didn't find anything pointing one way or the other as to how companies are actually configuring their internet routers (a place to look would be Cisco tech info, etc.).
IP Packet Dropping Policy.
See the links at bottom of this page.
Packet dropping techniques for multimedia, RED (Random Early Detection) and Weighted RED (WRED).
Cisco's WRED.
For a large MMOG, unless the custom UDP protocol has excellent bandwidth adaption, TCP may be a better choice for keeping data flowing smoothly. This is one reason why custom UDP protocol authors should study TCP very carefully during the design phase (see my previous posts for links to excellent TCP/design/implementation papers).
#20 Members - Reputation: 214
Posted 13 May 2005 - 11:46 AM
TCP vs UDP isn't the only issue/concern with performance/scalability. There are also issues of synchronisity (that a word?) and overlapping.
I won't make a grand point here, but if you haven't already, take a look at IO Completion ports. They're a winsock 2 method of handling very many (thousands) connections more efficiently (and requires an NT based system). They're inherently multithreaded though, so consider that when you decide what to do : )
-Alamar
This topic is locked





