High latency when playing a game

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

User avatar
Lapo
Site Admin
Posts: 19601
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: High latency when playing a game

Postby Lapo » 19 Nov 2013, 10:27

Hi,
thanks for the example. I've tested it using a Chrome client under MacOSX 10.8 and a Chrome client on Windows 8.
Everything works as expected, the lag is stable at around 1.8ms

Additionally we test on Windows XP and Windows 7 (32bit) with the same results, always using Chrome. I am not sure if the browser can make any difference but I doubt it. Unless it's a specific issue under Win7-64 I don't know what else to look for.
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Bax
Site Admin
Posts: 4327
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: High latency when playing a game

Postby Bax » 19 Nov 2013, 10:39

I tested under Mac OSX 10.9 using Safari and Chrome, enabling the "autochat". With Chrome, same results as Lapo (consistent lag below 2ms); with Safari I had a varying lag between 10ms and 20ms but it was due to the messages rendering in the chat windows (maybe because I had too many tabs open in Safari). When I removed the messages printing, again the lag was below 2ms.
Paolo Bax
The SmartFoxServer Team
User avatar
Bax
Site Admin
Posts: 4327
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: High latency when playing a game

Postby Bax » 19 Nov 2013, 10:45

I still think you are spending too much time on this detail. Consider that when your game will be online, you will have a lag to take into account anyway.
Maybe you should look for strategies to compensate it when you will have 100 or 200 milliseconds of latency, instead of trying to find out what is wrong with your setup.
Paolo Bax
The SmartFoxServer Team
jdv145
Posts: 21
Joined: 11 May 2013, 13:13

Re: High latency when playing a game

Postby jdv145 » 19 Nov 2013, 12:27

Lapo wrote:Hi,
thanks for the example. I've tested it using a Chrome client under MacOSX 10.8 and a Chrome client on Windows 8.
Everything works as expected, the lag is stable at around 1.8ms

Additionally we test on Windows XP and Windows 7 (32bit) with the same results, always using Chrome. I am not sure if the browser can make any difference but I doubt it. Unless it's a specific issue under Win7-64 I don't know what else to look for.


Thanks for testing it. All my browsers give pretty much the same results. There might be a couple of % difference but that is to be expected i think.

If i read the documentation on microsoft about TcpAckFrequency the latency is as intended to increase efficiency. http://support.microsoft.com/kb/328890

It was already available for winxp (sp3?) and win2003 if you read the article. I think it's mostly a question about if most people have it on or not. If you have a delayed ack, it will cause latency and the gaming will be less pleasurable and some games even impossible. Did you look if it was on or not? It would be *really* surprising if you had a delayed ack but still very low latencies

Bax wrote:I tested under Mac OSX 10.9 using Safari and Chrome, enabling the "autochat". With Chrome, same results as Lapo (consistent lag below 2ms); with Safari I had a varying lag between 10ms and 20ms but it was due to the messages rendering in the chat windows (maybe because I had too many tabs open in Safari). When I removed the messages printing, again the lag was below 2ms.


Im glad it's okay on osx also :). I believe i read somewhere macosx does not have this kind of problem, but i don't have a mac myself.

I assume you both did not run the smartfox on the same computer as the client which connected to it? This might influence the outcome (at least i think it could).

Bax wrote:I still think you are spending too much time on this detail. Consider that when your game will be online, you will have a lag to take into account anyway.
Maybe you should look for strategies to compensate it when you will have 100 or 200 milliseconds of latency, instead of trying to find out what is wrong with your setup.


If it was just me, i would agree, and i already ignored it for a little while. But exact the same thing happened with 2 of my colleagues (which also run win7 x64 i believe). So in my tests 'everybody' had the problem. I also have to inform the customer about this. I can't inform him very well if i don't know the extend of the problem. It's not that i got to much time on my hands, but when i noticed it wasn't just my computers i did feel an urgent need to see how far this would reach. A little bit of lag is normal, but some type of games (like counterstrike) are simply unplayable at 200ms ping. When i played halflife a long time ago, i believe a ping of 120+ ms would get you kicked quite fast. I'm just trying to achieve an acceptable experience comparable with other games/game-sites. Nothing more :wink:

Ill try to test with winxp and a mac also and hope (and expect) to get the same results as you guys.
User avatar
Lapo
Site Admin
Posts: 19601
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: High latency when playing a game

Postby Lapo » 19 Nov 2013, 15:25

I have checked both under Windows XP SP3 and Windows 8 and there's no track of a TcpAckFrequency key in the registry.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Bax
Site Admin
Posts: 4327
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: High latency when playing a game

Postby Bax » 20 Nov 2013, 08:48

jdv145 wrote:A little bit of lag is normal, but some type of games (like counterstrike) are simply unplayable at 200ms ping. When i played halflife a long time ago, i believe a ping of 120+ ms would get you kicked quite fast. I'm just trying to achieve an acceptable experience comparable with other games/game-sites.

What is that "little bit of lag" you have in mind?
Paolo Bax
The SmartFoxServer Team
User avatar
Lapo
Site Admin
Posts: 19601
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: High latency when playing a game

Postby Lapo » 20 Nov 2013, 09:00

jdv145 wrote:A little bit of lag is normal, but some type of games (like counterstrike) are simply unplayable at 200ms ping. When i played halflife a long time ago, i believe a ping of 120+ ms would get you kicked quite fast. I'm just trying to achieve an acceptable experience comparable with other games/game-sites.

That's right.
You should also keep in mind that you are mentioning AAA type games that don't rely so much on TCP. Action FPS games use a lot of UDP or semi-reliable UDP communication which can significantly reduce the lag, plus the games are designed for packet loss from the grounds up.

In the case of HTML5 there's only TCP support, which is not bad anyways but can't be pushed like you might do with UDP.
A ping of 120ms is already considered pretty decent for most multiplayer games, where optimal values should be around 50-80 which is perfectly achievable in TCP provided that the client connection is a good one.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Carl Lydon
Posts: 298
Joined: 12 Nov 2007, 16:15
Location: NYC
Contact:

Re: High latency when playing a game

Postby Carl Lydon » 07 Mar 2014, 06:49

I'm doing a realtime robot fighting game deploying to android. The client wanted a type of motion control which can't be reliably synched with small immediate messages as I would rather do.

My solution, which I have used for other games, is to store up location and rotational values for a number of cycles, and then transmit this int array to the other player (it's a 2 person game). I also compress it a bit by skipping 5 frames at a time, and reconstruction the missing frames on the other side. I do this because it's my understanding that infrequent larger data is easier on the server than frequent small data.

When I save up data for 1 second, the motion is nice and smooth accurate, but of course there is a 1 second delay +latency.

Of course if I reduce the recording time I have less delay. What is the maximum send rate you think I should use? 1/2 second look fine but I don't know if that's scalable if I have lots of users. I'm not even sure if 1 second is too often. I'm sending about 20 ints at a time.

Thanks for the advice,

Carl
User avatar
Lapo
Site Admin
Posts: 19601
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: High latency when playing a game

Postby Lapo » 07 Mar 2014, 09:19

You should not worry, sending 2-3 times per second is not heavy for the server at all.
I think you are using in the right approach.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
nik0990
Posts: 40
Joined: 23 Dec 2016, 10:48

Re: High latency when playing a game

Postby nik0990 » 10 May 2017, 13:25

Hi All,

I am having a problem with latency and when player increases than latency increases.

My admin panel having this info.

PFA

Anyone can help me.
Attachments
admin_panel.png
(213.59 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 19601
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: High latency when playing a game

Postby Lapo » 10 May 2017, 14:25

There's nothing wrong with your server, all parameters are fine.
Maybe the latency is due to network issues.

Can you explain how much latency you have and how did you measure it?

thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Carl Lydon
Posts: 298
Joined: 12 Nov 2007, 16:15
Location: NYC
Contact:

Re: High latency when playing a game

Postby Carl Lydon » 10 May 2017, 15:37

How often are you sending info to other players? How much data is in each package you send? Are you sending position and rotational info at a set rate, or is it some other type of system? I'm curious to know other people's experiences with this type of thing.
nik0990
Posts: 40
Joined: 23 Dec 2016, 10:48

Re: High latency when playing a game

Postby nik0990 » 11 May 2017, 06:19

Hi All,

I can see a lot of delay between client and server. Like client request for something and server process it but I can see 1-2 sec of delay at the client.

When Player increases then this problem also increases.

PFA - Admin panel screen shot
Attachments
admin_panel.png
(161.19 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 19601
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: High latency when playing a game

Postby Lapo » 11 May 2017, 07:33

nik0990 wrote:Hi All,

I can see a lot of delay between client and server. Like client request for something and server process it but I can see 1-2 sec of delay at the client.

When Player increases then this problem also increases.

PFA - Admin panel screen shot

You have already posted this. Please take a look at my reply from yesterday above.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Carl Lydon
Posts: 298
Joined: 12 Nov 2007, 16:15
Location: NYC
Contact:

Re: High latency when playing a game

Postby Carl Lydon » 11 May 2017, 17:05

Maybe your client is sending data for all attached players instead of just its own player? If the delay is on the client side then that might be one explanation.

Make sure that the avatar or whatever you're sending data for is isMe before sending.

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 2 guests