Rakst á þessa grein á netinu, gæti hjálpað einhverjum !
A short Treatise on UDP versus TCP/IP internet protoctols and why they cause problems.
Why oh why do we get these damn “connection problems detected” and “diconnected from server” messages? What do they mean and what can we do about them?
Bear with me, this may take some time, and it needs some backgound material first.
Your normal internet connection uses TCP/IP, which stands for “Transmission Control Protocol/Internet Protocol”. Your email uses it, Web pages use it, even game browsers like ASE use TCP/IP to find servers and to ping them. Now TCP/IP is what they call an orderless, error correcting protocol. Built into the packets is information that not only tells it where to go, but also in what order the receiving computer should put it together to reassemble the complete file. The receiving computer can also tell if there are any packets missing from the file and ask to have the missing packets sent again. Pretty clever stuff, but it gets even better, because it can re-route itself if one of the nodes (ie: other computers on the internet between you and the destination) go down and then fill in the missing packets later. Damn that's good stuff. It's reliable, it's been used from many years, and it works without fail (well almost, but most of the problems are usually user created ).
Can anyone see the gaming problems here yet? Well I will tell you about them. Games like BF aren't orderless, the data has to get there in the order it's used. Can you imagine the chaos that would happen if the data came in unordered? Ppl and objects would go berserk, with movement data for a few seconds ago coming in after you've already moved on from that position (and a few seconds in a jet can mean a long way!) Also you can't dynamically re-route if a node has a problem because that would put your packets out of order big time. In other words TCP/IP can't really be used for modern FPS games. So where do we go from here? We go via UDP.
UDP (User Datagram Protocol) is a ordered protocol, each packet follows on the heel of the preceding packet, and in no other order. Because it is ordered, missing packets can't be sent later, or they would screw up the order, so no error checking, it would just be a waste of time. It's also a fixed speed protocol, both the sender and receiver agrees that data travels at so many bytes per second, this is where your connection speed settings in BF come into the picture, and why if your connection is a bit dodgy, setting this to a slower transfer speed than your ISP's connection speed can sometimes improve gameplay a lot, the data is transferred slower than your actual connection speed and results in less missing packets (TCP/IP on the other hand will always try to run as fast as possible). UDP is commonly used for applications like Video Conferencing where missing packets don't matter much.
Everybody with me so far? Good, now comes the problem bit. To achieve that ordered, fixed speed connection a UDP connection uses a FIXED path through the internet. Now you see where we are going here right? If any of those nodes between you and the server run out of bandwidth, drop out, shut down, get infected by a virus or any other of the hundreds of things that can go wrong (Murphys law at work here - if anything can go wrong, it will) you will have problems because UDP cannot re-route. Not only that, the sending computer will go on merrily sending data regardless of whether you are receiving it because there is no error checking at either end. Hmmm! That could be a problem.
So what exactly is happening when we get the dreaded “connection problems detected” message? This is not a message from the game server, it's from your computer, and it's BF telling you that the data stream that you are receiving from the server has stopped coming in, or you have lost too many packets to continue playing. Of course it has no way to tell if the opposite is happening, it doesn't know whether the server is still receiving your packets or not! In this case it does the only thing it can do - it waits a few seconds to see if the packets resume (and I have had this happen a few times myself) and if it does it continues on with the game. If it doesn't resume it stops the game and displays the “disconnected from server” message. So that message is not the server telling you that is has disconnected you, it's actually your computer telling you that the server has stopped sending packets.
At the opposite end the server is still humming happily away to itself trying to send packets. So what happens if it's not receiving packets from you, or losing a lot, but just getting enough to assume you are still sending correctly? It only updates your position from the packets it receives! Your experience is, of course, that everything gets really laggy because the server is only updating your position every few packets or so. Sound familiar? You have a really low ping, because pinging is done using TCP/IP, which re-routes around the problem node, but UDP doesn't, hence crappy gameplay with a low ping.
So what do we do? First thing is, figure out where the problem is. We do this using a bit of logic.
1) Does your game disconnect or get laggy almost every time you join a server? Does it happen no matter what server you join? - Then the problem is probably at your end somewhere. Each time you join a multiplayer game a different path to the server is negotiated, if your game plays up every time no matter what server you join then it's quite likely the same node causing the problem. For you to go through the same node every connection it must be almost immediately upstream of your connection.
2) Is almost everybody who is playing getting laggy gameplay or getting disconnected? Then it is quite likely the server end. Everybody who connects are using a differnet route from different sources, for it to play up then logically it has to be where all these routes come together, and that is only at the server end.
3) If sometimes it plays fine, other times it disconnects or plays laggy then it has be somewhere between you and the server. Disconnect and join again and with luck your next connection will be routed past, not through, the problem node.
Is there anything we can do to improve gameplay?
Of course. I mentioned earlier about the conenction speed settings but lets dig a bit deeper. When you connect BF tries to negotiate a connection speed up to the maximum speed in your settings. I don't now whether the speed is always at that speed or if it tries and drops speed if it fails, but lets imagine it is, what happens then? If you are on cable with 1mb downstream bandwidth and set your connection speed to T1 (1mb) BF tries to negotiate a fixed speed two way connection at 1Mb. Of course to do this you have to have a synchronous connection, if your upstream bandwidth is only 256Kb the fastest connection you can practically get is 256Kb - keep in mind it's the same for everyone else on ADSL, your connection speed HAS to be slower or the same as your UPSTREAM bandwidth or you will have problems! Best to set it to half your upstream bandwidth to allow for things like Teamspeak. If you get a 256Kb connection on a 512/256 ADSL connection, running Teamspeak will cause packet loss in your upstream UDP connection, but the downstream will work fine and you may experience laggy gameplay, so set your speed to 112 (ISDN) in BF. People on 56K modems simply should NOT be running Teamspeak or anything like it.
Of course you may be lucky and have a synchronous 1Mb connection WOOT! lucky you, you can run it at full speed and never have a problem, right? I think not. All ISP's, and game servers, have a fixed width pipe somewhere on their infrastructure, it will fit only so much through. What if every player joining negotiated a UDP connection to their maximum speed, it would only need a few hogs to max out the pipe to the server, resulting in lag for everyone, and people getting randomly disconnected! There are people on the forums who have found that at certain times of the day they have connection problems, but other times it runs fine. This is likely caused by peak user congestion, their ISP has run out of bandwidth and everyone is on rations. The people browsing don't really notice it much, that sort of thing is very peaky. You read a page, load another, maybe you download a file but it's a bit slow, it happens, no worries. But if you have a fixed speed connection through UDP and it gets squeezed you start missing packets, and the game server also starts failing to receive your packets.
So for better gameplay and reliability set your connection speed to HALF your downstream speed at most. Better yet if you have a really phat pipe don't hog it, set it fast enough that you get good gameplay, but don't try max speed, leave some for the rest of us.
I hope this helps some ppl with their connection problems
*TARGET*