Dropped Msgs and MaxMsgLen

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

kaligus
Posts: 45
Joined: 01 Sep 2009, 13:26

Dropped Msgs and MaxMsgLen

Postby kaligus » 15 Nov 2009, 14:02

Hello,
Tried this o the Unity section, but I was advised to try something here, because it looks like more general.

please, need some help on this. I search for something related in other foruns here, found somethings but I need to take a doubt out.

My game clients are sending to much information I think to the server... if I increase the MaxMsgLen, the users are not disconnect due to dropped msg (set to 1), but then, some players got their movement not sync good with others (in my screen I saw player 2 in front of me, but he sees me behind him)...

Somebody can help me do decrease this?
The MaxMsgLen is set to 20000... I think thats too much, right? Is this maybe the sync problem?
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 16 Nov 2009, 11:26

Hello,
My game clients are sending to much information I think to the server... if I increase the MaxMsgLen, the users are not disconnect due to dropped msg (set to 1), but then, some players got their movement not sync good with others (in my screen I saw player 2 in front of me, but he sees me behind him)...

There are limits to the amount of data that you can send across a "regular" socket connection.
An excellent connection can have 50ms of lag.
This means that you can send a theoretical maximum of 20 messages/second
Unfortunately not everyone is lucky to have a lag of 50ms, some may have 100ms or even 200ms...
For this reason you should carefully tune the amount of messages you are going to send. We usually suggest an average of 10-12/second.

MaxMsgLen simply indicates the max size of a client request. Default = 4Kb (4096 bytes)

The MaxMsgLen is set to 20000... I think thats too much, right? Is this maybe the sync problem?

No this is still acceptable, although sending 20K messages is no good if you are trying to achieve real-time interaction ;)
Room Lists, Database profiles etc... can produce large messages but in realtime mode the client should just send small updates which usually are below 1Kb of data.
Lapo
--
gotoAndPlay()
...addicted to flash games
kaligus
Posts: 45
Joined: 01 Sep 2009, 13:26

Postby kaligus » 16 Nov 2009, 12:54

Thanks for the reply, Lapo.

Ok, let's say its a lag issue (I believe it is)...

Here are what I sync so far:
- Movement (each time the client moves, the script will send the data to SFS and only if the player changes the movement of the last move - Thomas can check this, I used the example he made into SFS Island demo).
- Animation (works the same way as the movement above).
- Chat in-game.
- Health of players (it syncs everytime it changes).
- Attack script (everytime player 1 attack player 2 it will send the data across the network to SFS server and all clients - this data contains the total damage, the player id and the chance of the hit - in player 2 client, it will receive the damage and calculate the chance of dodge, final damage and then send back to the player 1). Its not too much information I think.

About my internet connection:
- I have a link of 2 MB (but its not full to downstream and upstream). I can download files at 210 Kb at max so far, and upload at 30Kb so far. Is this good or bad?
- I run the server and a game client in the same machine.
- The datas are exchanged just for the players in same room.

And what do you mean how many message per second? In my example, can I say the quantity of messages if: movement (x,y,z), animation (one variable only), health, chat message and attack? So, is this 5 messages?

Thanks again for the help
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 18 Nov 2009, 20:04

- I have a link of 2 MB (but its not full to downstream and upstream). I can download files at 210 Kb at max so far, and upload at 30Kb so far. Is this good or bad?

Asymmetrical bandwidth usually means DSL, which is not the best thing for hosting servers. Normally you would need a dedicated line that has symmetric upload/download bandwidth.

Take into consideration that the upload bandwidth is the one used by all connected clients to send data, which is pretty narrow.
Lapo

--

gotoAndPlay()

...addicted to flash games
kaligus
Posts: 45
Joined: 01 Sep 2009, 13:26

Postby kaligus » 18 Nov 2009, 20:42

Lapo wrote:Asymmetrical bandwidth usually means DSL, which is not the best thing for hosting servers. Normally you would need a dedicated line that has symmetric upload/download bandwidth.


Trust me, I really know this (even I'm not expert in network configurations :lol: )... I know my bandwidth is not the best, but I dont see any problems to support 2 players online at same time... :lol: ... and that's the issue, only with 2 players I'm getting lag... I'm not saying its because of SFS or Unity, it must be something I'm doing wrong, I just want to see where

Lapo wrote:Take into consideration that the upload bandwidth is the one used by all connected clients to send data, which is pretty narrow.


Do you think my upload must be causing this? But it got only 2 players online :shock:

Anyway I will make more tests... thanks Lapo

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 24 guests