Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Player ping value
Player ping value
2005-12-07, 2:28 PM #1
Quick question: is there a verb for acquiring a player's ping at any given moment? If not I guess it could be easily acquired by timing a trigger/response round trip.

[edit]or wait... no way to get a time stamp is there...
Dreams of a dreamer from afar to a fardreamer.
2005-12-07, 2:44 PM #2
Using GetLevelTime() might help.

:)
2005-12-07, 3:27 PM #3
Hmm, right, I guess that could work... I need to know the duration of a one-way server-to-client trip (isn't there a technical term for that?). I could trigger the clients and have them send me back their level time, which I would compare with their join time - which would have to be an stored in an array on the server (added when joined message is called). Does that make any sense?

Bear with me, I've been out of it for a while :)

The purpose is to schedule an event that would start on all clients simultaneously.. I thought of triggering to each client a "delay" value which is inversely proportional to the server-to-client trip duration for that client, so that if ClientA 1/2 ping = 100ms and ClientB 1/2 ping = 200 ms, I'd trigger 100ms to ClientA and 0ms to ClientB, effectively causing ClientA to wait for ClientB to get the message.

[edit] Oh wait, there's also GetGameTime I see... is that sync'ed for all players?

I better get back to work
Dreams of a dreamer from afar to a fardreamer.
2005-12-07, 4:01 PM #4
You could have the server get it's time, send a message to the client which in turn sends a message back to the server which makes the server get the time again and compare it to the first time. Then divide the time in half to get a decent timing on the delay from server to client.
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2005-12-07, 4:22 PM #5
I guess I could do that... but (and I'm not too knowledgeable here), can't there be significant differences between the duration of the outbound and inbound messages?
Dreams of a dreamer from afar to a fardreamer.
2005-12-07, 4:36 PM #6
There could. But there's no other way I can think of for you to check the delay between the sending of the message to the recieving of it. For example, the game clock might not be syncronized or the computer times may be different, and if they are then the only way to find the delay is to send a message back to the server and have the server run both time checks to make sure that the check is from the same clock time. The inherent problem is, of course, what if the delay between the server to the client is different from the client to the server delay.

I can't think of any other way however, but maybe someone else is more skilled than I am with JK's netcode.
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2005-12-07, 4:56 PM #7
Re-read my second post... this is how I can measure the exact outbound trip duration (assuming client and server clocks are running at the same speed):

Player joins game.
Server adds GetLevelTime to an array of playerTimes (playerTime[playerNum] = GetLevelTime()).

When scheduling event:
Server records level time (= beforeStamp).
Server requests time from player.
Player sends back local GetLevelTime (= playerStamp on server).
Server gets difference between playerTime[playerNum] + playerStamp and beforeStamp. (delay = beforeStamp - (playerTime[playerNum] + playerStamp))
Dreams of a dreamer from afar to a fardreamer.
2005-12-07, 5:13 PM #8
Ping times continually change.

:)
2005-12-07, 5:15 PM #9
Obviously... but this would give me a closer estimate if I run it right before scheduling the event

[edit] in any case the point is to get an animation to start playing at the same time on all clients. The 3do will be involved in gameplay so it has to be in sync. Maybe there's a better way to force a .key to play in sync? (or at least "snap" to sync every now and then?) A manual (and bandwidth hogging) method is to divide the animation into several segments and have the server notify the clients when it's done playing a segment - the clients will then stop whatever they were playing and snap to the server's anim. More segments = better sync but more bandwidth consumption.
Dreams of a dreamer from afar to a fardreamer.
2005-12-08, 12:57 PM #10
Why does the animation has to be in sync? Wouldn't it be enough to pause the last frame until everyone has seen the whole thing?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-12-09, 2:27 PM #11
It has to be in sync because it's going to be an object that players can stand on.
Dreams of a dreamer from afar to a fardreamer.

↑ Up to the top!