Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Scalability issues (UDP)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 brokilodeluxe   Members   -  Reputation: 115

Like
0Likes
Like

Posted 07 June 2013 - 03:42 PM

I'm designing an online top down fighting game with the XNA C# framework. It uses the host/joiner architecture common in first person shooter games. It's supposed to support up to 16 players.

 

The game works fine up to ~6 players. After that, every player besides the host (all the joiners) starts getting bad latency issues for some reason. I've had my nose in server/client code for months, and I'm honestly at a loss. Is there a certain tool besides Visual Studio that specializes in analyzing server/client communication?

 

The fact that the host works completely fine despite everyone else lagging concerns me. I know the server isn't getting bottlenecked since the host has a client just like anyone else, and has to communicate with it, even if it is just through the loopback address. My packet sizes also tend to stay under 1kB so I dunno.


Logic is:

 

Game.Update:

  • Client.Update;
  • If you're the host: Server.Update;


Server.Update:

  • Check for inputs;
  • Assign inputs to players;
  • Level.Update;
  • Send level data unreliable sequenced to all clients;

 

Client.Update:

  • Check for server messages
  • Fill in level with message data
  • Level.Update
  • Send input unreliable sequenced to server

Edited by brokilodeluxe, 07 June 2013 - 03:54 PM.


Sponsor:

#2 Dave Weinstein   Members   -  Reputation: 510

Like
0Likes
Like

Posted 07 June 2013 - 10:17 PM

You are likely saturating your network bandwidth on the Server.

 

Remember that additional clients are a geometric bandwidth progression.

 

Server + one client: Network traffic for AI (if applicable) plus the activities of the server player sent to one client, bandwidth on the order of  (AI + P)

Server + two clients: Network traffic for AI (if applicable) plus the activities of two players sent to two clients, bandwidth on the order of (AI + 2P) * 2

Server + three clients: Network traffic for AI (if applicable) plus the activities of three players sent to three clients, bandwidth on the order of (AI + 3P) * 3

 

Looking at this, you can see that traffic is going up approximately by the square of the number of connected clients. So going from 5 connected clients (6 players) to 6 means that we go from (AI + 5P) * 5 to (AI + 6P) * 6, roughly a 50% increase in bandwidth required.

 

The host player is fine because they aren't going over the overburdened network connection.



#3 brokilodeluxe   Members   -  Reputation: 115

Like
0Likes
Like

Posted 08 June 2013 - 04:17 AM

So from what I've read, that means I should basically try to cut down on my byte size, right?

 

So it doesn't get all multiplicative and evil.



#4 kunos   Crossbones+   -  Reputation: 2207

Like
0Likes
Like

Posted 08 June 2013 - 04:48 AM

another typical strategy used in action games is to send updates with different rates based on the distance between players.

So, for example, player A would get the 5 closest enemies at the highest possible rate and plus up to 5 more in a round robin fashion.. so you know that your server bandwidth cost becomes linear once you go over 10 players.

But ya.. most of the work is trying to reduce packet size and rate anyway.


Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#5 Dave Weinstein   Members   -  Reputation: 510

Like
1Likes
Like

Posted 08 June 2013 - 11:43 AM

The art of the network engineer is knowing what not to send, and how often to not send it.

 

So, first, look for everything that can be inferred by another piece of information. If a specific gun firing always generates the same sound, and you know what gun the actor has, then you don't send both a FireGun message and a PlaySound message, the one is inferred from the other.

 

Next, measure. What packets are you sending the most often. Optimize these down to as compact a form as you can.

 

Next, throttle. If you send a change of direction packet for the player every time their vector changes slightly then human mouse interactions are going to generate a lot of unneeded traffic. So for an FPS, you want to send an updated movement packet (here is my facing, position, speed) at a throttled rate, with exceptions for things like starting and stopping which will be really obvious if held.

 

Then, affinity filtering. Send information based on what they need to know. In the original Rainbow Six, every actor in the game had its position updated in the game over a reliable channel to all players on a 1 hz strobe. However, if another actor was in the same room, in an adjacent room, or there was a line of sight relationship (these were cached by the engine anyway), you would get unreliable updates (throttled as above) for them as movement changed.



#6 brokilodeluxe   Members   -  Reputation: 115

Like
0Likes
Like

Posted 09 June 2013 - 04:47 PM

Alright, thanks for the info guys! I think I understand what to do now.

Back to the grindstone.


Edited by brokilodeluxe, 09 June 2013 - 04:58 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS