The
word Admins love to hate…
LAG!!!
This guide is
intended to:
1)
Help you
wade through & understand all the technical Mumbo-Jumbo.
2)
Give you
enough info so you can understand what’s happening without getting too
detailed.
Special thanks goes to ReDe@d, & Flawless
who helped me test & confirm much of this info.
Section
1 – Understanding Networks &
Unreal.
Fact:
Unreal uses a Client/Server UDP Connection over the
Internet.
To understand why lag happens you need to understand a
little bit about computer networks.
Client / Server
·
The Server is the computer that’s hosting the game.
·
The Clients are the players who connect to the server
in order to join the game.
UDP
·
Stands for: User
Datagram Protocol (but who really
cares?)
·
UDP is a fast way to communicate,
because it does NOT establish a dedicated connection between the
server and client. Huh? How can this be?
This may
seem strange so let me explain it this way…
Imagine
someone talking to you while you are busy doing something else. Because your busy, you may not catch
everything they say. But, of course
that person doesn’t realize it and just keeps talking. You miss out on information because they don’t have your dedicated attention.
UDP is like
that; the connection is NOT forced.
Clients & Servers don’t wait to make sure the other received all the
data. They just keep sending it, and sometimes the network is simply too busy
& packets of data get dropped.
But, because it doesn’t have to
wait for confirmation, it is a faster way to communicate.
Ping: refers to how long it takes the
signal to travel from your PC to the server and back.
·
The Internet is a WAN (Wide Area Network); the computers are far apart.
·
Clients who are farther away will have a higher ping.
Bandwidth
·
Refers to your Internet connection speed: NarrowBand (Dial-up) or BroadBand (Cable, DSL, T1)
·
Its like a two lane highway vs. an eight lane super-highway. The eight lane super-highway can handle more
traffic at one time.
·
For a server, it’s the UPLOAD speed that’s important
(not your download speed).
·
A slower connection will have a higher ping.
Section
2 – What IS Lag and What causes it?
So what is
Lag? Lag is when too
much data is being sent by the game and the network and/or server can’t handle
it all, so game starts skipping or getting slow. The Network gets Congested & lags (or slows down) very much like a rush hour
traffic jam.
·
What causes LAG?
There are several factors and they include:
o
Low bandwidth (slow network connection)
o
The type of sever your running can affect lag.
o
Too many players for your connection or CPU
o
Downloaders
(downloading uses a lot of bandwidth)
o
Improper network settings (MaxTicksPerSecond &
MaxClientRate)
And here’s
one that many Admins ignore …
o
Bogging down your CPU resources by Summoning too much stuff & Using Weapons that are bandwidth hogs
(like some of the Aura weapons)
Section 3 - How can I reduce Lag?
·
DON’T Go Summon Crazy & avoid using weapons that spawn a lot
of projectiles or effects!
But, Don’t take my word for it… read these
Excerpts directly from Tim Sweeney (the
guy who created Unreal).
Reprinted from: Unreal Networking
Architecture by Tim Sweeney
While a tick operation
is in progress, the game state is being continually modified
by the code which executes. The game state can change in
exactly three ways:
·
A variable in an actor
can be modified.
·
An actor can be created.
·
An actor can be destroyed.
Reprinted from: UnrealScript Language
Reference by Tim Sweeney
“Spawning
and destroying actors are fairly expensive operations on the server side, and are
even more expensive in network games, because spawns and destroys take up
network bandwidth. Use them reasonably, and regard actors as "heavy
weight" objects.”
·
Type of server:
o
A Listen server – This is the best option for
a Dial-Up server. OK for Broadband
servers too.
It will
use less Bandwidth, CPU & Memory
resources, thereby reducing lag. However,
it’s less stable than a dedicated server (if your game crashes then everyone gets disconnected).
o
Dedicated Server – for Faster PC’s with more Memory AND a Broadband connection (DSL,
Cable)
o
A Stand-Alone Dedicated Server - Best and fastest kind of
server!
Yes, I
know not everyone can afford a second PC and a network Router. I’m just saying this is the best way to go.
·
Number of players
(MaxPlayers): (Note:
this is my opinion based on how I have seen various servers run)
o
Dial-up - No more than 3 players.
o
Standard DSL - 4 – 6 players.
o
Standard Cable - 6 – 8 players (I prefer 6 happy players. Again, my opinion).
o
Business class
Cable or
DSL -
Depending on Upload speed 10 – 12 players.
o
T1 - If you can afford a dedicated T1
line, then go Hog wild with 20 + players!
·
CacheSizeMegs
This
setting tells the Unreal Engine how much RAM to use before spilling over to
disk Cache.
PAY
ATTENTION HERE!!!
If your
running a Stand-Alone Dedicated Server
or a Listen Server then set this to about 2/3 of your Total system RAM.
HOWEVER…
If you’re
running both, a Dedicated Server AND a player game on the same PC then
you have two copies of Unreal running and they have to share the memory! … so, set to NO higher than about 1/3 of your Total System RAM.
MaxTicksPerSecond &
MaxClientRate:
What exactly are they? How do I set them Correctly?
When
you install Unreal, it sets MaxTicksPerSecond to 20 & MaxClientRate to 20000. These settings were intended for a LAN game
NOT Internet games! Lowering these
settings drastically reduces the amount
of network traffic flowing across your Internet server network.
MaxTicksPerSecond: (also called TickRate)
This is how many times each second the server updates info.
A
common misconception is that a higher TickRate improves your ping. IT DOES NOT!!!! It only appears to do so!
Lets
talk about ping for a second… Remember,
ping is how long it takes the signal to travel from your PC to the
server and back. When your PC sends a
signal to the server, it has to wait its turn in line to be processed on the
next available “Tick”. This wait time
is added to your ping.
When
there’s too much traffic going in or out of the server then the signals get
jammed up and have to wait longer. Again this extra wait time is added to your
ping.
So
how does a lower MaxTicksPerSecond
help? Lowering this
setting lets the server process data in bigger chunks thereby reducing the number of requests & updates between the clients and server. So, even though your ping might seem
slightly higher, it is more steady
because there is now less network traffic.
Lowering
the TickRate means fewer updates per second, so initially the ping will appear
to be slightly higher. THIS IS NOT A
BAD THING!!!
Think of
it like this: It’s like a 100 people
driving their own cars versus 100 people getting on a couple of busses. It might take a little longer to load up
the busses, but once everyone is aboard, there’s a lot less traffic to cause
traffic jams. This keeps the traffic
flowing smoother.
So
what should this setting be?
Usually a setting of around 12 to 15
works well for internet servers.
MaxClientRate: The rate at which clients are allowed to
communicate to the server (based on bandwidth).
First of
all, be aware that there seems to be some debated over whether or not this
setting actually does anything. I can
tell you this: Debate all you want, but
It DID make a difference for my server!
Ok, so
we’ve slowed down the number of times the server is sending updates. Now
we need to tell the clients to do the same sort of thing. This is important because if you don’t
limit this, then clients with a faster connection, or lower ping, will actually steal bandwidth from
others. Lowering this setting forces
all the clients to share the bandwidth equally, and ensures that it matches
your connection’s bandwidth.
Think of
it like this:
Imagine
four people sharing a milkshake. Two
of the people have big fat straws and the other two have skinny straws. if they are all drinking at the same time,
then the two with the fat straws will get more of the milkshake.
Now, imagine putting caps on the bottom of the
two fat straws so the all the openings are relatively the same size. They will now all get their fair share of the milkshake.
This will
also help ensure that they can’t drink the milkshake faster than you can refill
it.
So, What should this setting be?
Epic’s web
site says, “Make sure that the MaxPlayers x
MaxClientRate is less than your available bandwidth (in the case of cable
modems or xDSL, your upstream bandwidth).”
Here’s a
good way to test this for yourself to see what setting works best for you:
1) While you have players in you server, simply
try a setting of 7,500 and play the game. Summon some monsters & let the players fight them.
See how this setting works.
2) Then increase it to 10,000 or so and test it again. Repeat this step until players agree that it
is getting laggy.
3) Now simply back this setting off until you
consistently get good smooth game-play.
4) DON’T rush this test! Be absolutely sure to take a few days to
test this fully.
I have
found for my server a setting of about 7500 seems to work very well. The only time anyone really complains about
lags is when there is a downloader.
Again, I cannot stress enough, that you need to
test these settings out for yourself!