Page 1 of 1
How To Show Ping From Player To Player
Posted: 10 Jun 2010, 04:16
by -Fantastic-
How To Show Ping From Player To Player
anyone know how to send the delay of player to player?
I know it have to do with smartfox.roundTripBench();
Posted: 10 Jun 2010, 04:59
by Lapo
There is no such thing, because players are not directly connected to one another like in a Peer-to-Peer scenario.
The ping you can measure is between the client and server. See the roundTripBench() API command documentation for more.
Posted: 10 Jun 2010, 15:20
by -Fantastic-
Lapo wrote:There is no such thing, because players are not directly connected to one another like in a Peer-to-Peer scenario.
The ping you can measure is between the client and server. See the roundTripBench() API command documentation for more.
How Would you Use roundTripBench To Show the ping?
I try'd using roundTripBench but, I fail'd using it.
Posted: 10 Jun 2010, 16:47
by rjgtav
First, the user must be connected and in a room. Then you can use this code to measure the ping:
Code: Select all
var totalPingTime:Number = 0;
var pingCount:Number = 0;
smartfox.roundTripBench();
smartfox.onRoundTripResponse = function(elapsed:Number):Void {
// We assume that it takes the same time to the ping message to go from the client to the server
// and from the server back to the client, so we divide the elapsed time by 2.
totalPingTime += elapsed/2;
pingCount++;
var avg:Number = Math.round(totalPingTime/pingCount);
};
Posted: 14 Oct 2010, 06:30
by linfour
I entered a room but still can't receive the elapsed number. What may be the problem?
