NOTAP Squad Patch

What is lag?

The Bottleneck
Server + 1 client
Server + 2 clients
Server + 3 clients

How much bandwith is needed?
bandwith per connection

How many players?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 






HOME


Mail to Squadleader

Last update:
03/17/2001

The true over lag and DFLW

What is lag?

To make it easy, we can say lag is the delay bertween the action you do (on your pc you hit the firebutton for example) and the responding (you see your opponent get hit and die). What will happends by this (in a very simple and easy way)? Ok you hit the firebutton and and your pc (now named as client) will send some data to the host (the server). This will take some time (remember ping?). The server will check this data ( pos where you shot i.e. with the pos of the other players). If the server founds your bullet has hit an opponent it will send some data to this opponent (for make him death) and some data to you (for display the hit and die of your target).

On a normal connection this data will need between 120 and 300 ms (milliseconds, 1000ms = 1) to travel from the client to server and back. We all handle with this delay in the same manner as in real life. You shot somewhere in front of your moving target so that your bullet and the target meet at same time on the same position.

The internet connections for the DFLW base on the UDP protocol. That means little pieces of data (UDP-Datagrams) will be send from a sender to a receiver without any control of delievery. The bottleneck for all that is the internet connection of the server. This connection has a limited bandwith (usually measured in Bits per second bps).

You can think on it as a kind of pipe, and if to much packets want go through this pipe they must wait for a free space. And this waiting time may cause some lag. Some more reasons for lag can occured too, loss of packets etc.

Conclusion:

Lag is the delay caused by waiting for packet to transfer.


The Bottleneck

Why is the internet connection of the server the bottleneck?
All infos from all clients must be send to the server. And the server must be send any information back to all other clients! Because of this the send (or upload bandwith) of the server internet connection is the bottleneck. Let us look for a simple example:

1 Server , one remote player or (client) also 2 player game (non-dedicated host).

1 server 1 client

S means the server, the pc which host the game, its also player one.
C1 means the 1st remote pc with the player 2.

S =========SC1===========> C1
S <========C1S============ C1

We see that this results in 2 connections, SC1 for the infos send from the Server(S) to the client (C1). And a connection from the client (C1) to the server (S).


1 server 2 clients

S means the server, the pc which host the game, its also player one.
C1 means the 1st remote pc with the player 2.
C2 means the 2nd remote pc with the player 3.

S =========SC1===========> C1
S <========C1S============ C1

S =========SC2===========> C2
S <========C2S============ C2

We see that this results in 4 connections,
SC1 for the infos send from the Server(S) to the client (C1).
And a connection from the client (C1) to the server (S).
SC1 for the infos send from the Server(S) to the client (C2).
And a connection from the client (C2) to the server (S).

But this is not all! The infos from C1 must send to C2 and vice versa. This happends by sending the infos from C1 from the server to C2 as connection C1SC2.
The same must happends for the data from C2 (received over C2S) to C1.

And so the diagram for the connections look as follow:


S <========C1S============ C1
S
=========SC1===========> C1
S
========C2SC1==========> C1

S <========C2S============ C2
S
=========SC2===========> C2
S
========C1SC2 =========> C2

We have also 2 receiving connection and 4 sending connections for 3 players!

The sending bandwith is more used as the receiving bandwith,
because the server must spread his own infos to every client,
and all infos from any client to all other clients.

Or with other words, the number of sending connections is equal to n*n with n is the number of clients.


1 server 3clients

S means the server, the pc which host the game, its also player one.
C1 means the 1st remote pc with the player 2.
C2 means the 2nd remote pc with the player 3.
C3 means the 3rd remote pc with the player 4.


S <========C1S============ C1
S
=========SC1===========> C1
S
========C2SC1==========> C1
S
========C3SC1==========> C1

S <========C2S============ C2
S
=========SC2===========> C2
S
========C1SC2 ==========> C2
S
========C3SC2 ==========> C2

S <========C3S============ C3
S
=========SC3===========> C3
S
========C1SC3==========> C3
S
========C2SC3==========> C3

We see that this results in 3 receiving and 9 sending connections.

Remember as fact with any client comes an important increase for sending (or upload) bandwith!

The number of sending connections is n*n!


How many bandwith is needed?

I try to solve this problem by the following approximations and facts:

1) I can host a game for 6 players (5 clients) over my 1 B channel ISDN line without lag!
2) I can host a game with 7 players (6 clients) over my 1 B channel ISDN line with some lag.
3) I can host a game with 10 players (9 client) over 2 B channels ISDN with some lag.

The bandwith for the ISDN 1 B channel is theoretical 64Kbps (64000 bits per second). And i have done my calculations first on this value. That was wrong! I learned that the real bandwith of my connection is between 54 and 61 Kbps without changing anything on my side.

So i think the lag i see sometimes on 7 players happends if the bandwith goes down. With the lowest value for the bandwith (54Kbps) and 6 players we must be on the sure side.

With 6 players (means 5) clients we have 25 outgoing connections (remember n*n, 5*5 = 25).

This 25 connection need lesser as the 54Kbps because there is never lag.
So it looks 54000 Bits per second / 25 = 2160 Bits per second needed per client!

Sometimes it runs without lag for 7 players (6 clients) so i guess this happends with a good bandwith near 60Kbps.

60000 bits per second / 6*6 = 1666 bits per second.

The needed (upload) bandwith must also > 1666 and < 2160 bits per second and sending connection.

So i will use the value 2000 bits per second and sending connection.

 


How many players can i host?


All you need to know is your sending (upload) bandwith. Attention on cable connections and ADSL it is different (asymmetric) for sending and receive. And in most cases is the receiving bandwith much bigger as the sending, good for downloads and serving but bad for hosting.

We calculate the needed bandwith with the following equation :

bandwith = (n-1) * (n-1) * 2000 bit per second

or the number of players you can host

n = sqrt (bandwith / 2000 bps)+1

 

Needed bandwith for numbers of players:

6 player : (5*5) * 2000pbs = 50000 bps
7 player : (6*6) * 2000bps = 70000 bps

Or as example for a 128 Kbps line (2 B-channel or T-ADSL)

n= sqrt(128 000 bps / 2000bps)+1 = sqrt (64)+1 = 8+1 = 9 player