Wednesday 2 October 2013

Network diagram for Deep Waters game on Xbox 360 Indie games.


As you can see from the above diagram.  We have a Server-Client based network setup.

After trial and error and a few calculations we have decided that the above is the most efficient way for this particular game.

Key points:-

Each player controls his own submarine.

Each player sends their submarine data to the Server.

The Server sends it`s own and the other remaining players in the network data to each of the other players.

The Server Can choose to override Any players data if needs be, ie at Initialization and players death.

 Generally the server does not update the local players data. ie Each client controls his own submarine directly.

This produces smooth controls for each of the local players.  We will then use predictive movements for all players, as viewed from each client player.

The formula for calculating the bandwidth is the following:-

Network bandwidth  =  (  (n-1)*(n-1) + (n-1)  )  *  DataPerPlayer (bytes)

( (n-1)*(n-1)+(n-1) ) happens to break down to (n*(n-1)), so for example 4 players would need 4*3 = 12 lots of network data to sync all 4 players in the network.

In our example of 4 players (n) and each player needing 20 bytes of data to sync their position and orientation means we need 4x3 = 12 x 20 = 240 bytes per frame. If we update our game network at 20 frames per second (fps) then in 1 seconds our bandwidth usage will be 4x3x20x20 = 4800 bytes per second (bps). If we forget about the headers that is!!!






No comments:

Post a Comment