Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Handling Extra Messages


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
7 replies to this topic

#1 Butabee   Members   -  Reputation: 238

Like
0Likes
Like

Posted 22 July 2013 - 02:34 PM

I have a message queue that pumps out messages as long as the queue isn't empty and there is available bandwidth. But what do I do when I have more messages than the bandwidth can handle? I don't want to discard them but not sure what else to do. I think I might be able to slow down how many messages are added to the queue but things would start getting laggy.

Sponsor:

#2 Waterlimon   Crossbones+   -  Reputation: 2643

Like
0Likes
Like

Posted 22 July 2013 - 02:51 PM

If you mean like a server sending updates, im afraid youre going to have to reduce the quality, at least for some of the clients (if you have more important clients, like ones with a membership)

 

Possible solutions:

-Reduce non-necessary packets (fewer position updates, fewer 'visuals' updates...)

-Activate a laggy compressor to make the packets smaller by sacrificing some CPU under low bandwidth

-Slow down the simulation speed (depends what youre working on)


o3o


#3 Butabee   Members   -  Reputation: 238

Like
0Likes
Like

Posted 22 July 2013 - 04:14 PM

Thanks, I've come up with this to adjust the message queue update rate:


if(m_updateMessages.Count * messagesize < m_bandWidth * 3.2f)

{

	m_updateThresh = Mathf.Lerp(3.2f,0.2f,1.0f / (m_updateMessages.Count + 1.0f));

}

else

{

	//shutdown. Too laggy.

}



this only currently handles update messages though so messagesize is constant.
This happens after the messages are processed so the count would be excess messages that bandwidth couldn't handle.

Is this a decent solution, or should I try something else?

#4 hplus0603   Moderators   -  Reputation: 5725

Like
0Likes
Like

Posted 22 July 2013 - 04:27 PM

If you need to send more data than the network can tolerate, then you will fail, and you might as well disconnect the users.

If you don't need to send the data, then why are you sending it?

The main challenge is to reduce the number of messages you need to send; the secondary challenge is to reduce the size of each message you send.

No matter what you do, you have to be prepared for falling behind. The available bandwidth may at some point go close to zero, for various reasons (none of the good,) and you need to know what to do in that case. Typically, send a message to each connected client that there's a problem, and then disconnect all users.

Oh, and send email to the pager of whoever runs the servers to have them wake up and look into it, as they weren't on the ball as available bandwidth was starting to go down :-)


enum Bool { True, False, FileNotFound };

#5 Butabee   Members   -  Reputation: 238

Like
0Likes
Like

Posted 22 July 2013 - 04:42 PM

I was thinking I would start disconnecting players instead of shutting down. The update messages are pretty much positional updates plus a couple other things that are lerped between on the client side. They do need to be sent at a decent rate for the game to be playable as it's an action type game, but if players decide to clump up there's nothing sane I can do to prevent that. The code above will decrease messages sent up to 16 times before I shutdown or start booting players. I'd have to test how the game plays at an update rate of once per 3.2 seconds, but I'm thinking it won't be remotely playable. I'd have to start booting way before that. There's no set upload bandwidth since the servers will be player ran. I think the lowest update rate I can get away with is 1 per second, but not sure until I test it out.

#6 hplus0603   Moderators   -  Reputation: 5725

Like
1Likes
Like

Posted 22 July 2013 - 08:04 PM

The code above will decrease messages sent up to 16 times before I shutdown or start booting players.


Decreasing the rate you send messages isn't going to help if you still generate messages faster than you can send them.

You have to decrease the rate at which you *generate* those messages. For example, do not generate a new update for an entity if the previous update for that entity is still pending in the queue -- that would auto-balance the network to send no faster than it could support.

The next question is: what do you use as an indication that you "can't send" a packet? Are you using TCP or UDP? If UDP, then your local network interface can send messages very quickly without blocking, but those get dropped as soon as they hit your upstream cable modem / DSL router / ISP interface if you exceed capacity.
enum Bool { True, False, FileNotFound };

#7 Butabee   Members   -  Reputation: 238

Like
0Likes
Like

Posted 23 July 2013 - 01:32 PM

Sorry, that's what I meant, the threshhold variable slows down the rate the messages are generated, not sent.

#8 Butabee   Members   -  Reputation: 238

Like
0Likes
Like

Posted 23 July 2013 - 03:45 PM

Thanks, I decided to use your method of checking for previous updates in the queue.




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