( search forums )
Ping reading issues
Soldat Forums - Soldat Talk - Developers Corner
Deleted User
September 3, 2005, 12:32 pm
Hey, I've started making yet another Soldat admin program and I have some problems with getting players ping info. At forst it looked ok, as raw numbers, but then I added "lag-o-meter" graph that shows avarage players ping.

So what's the problem?
Basically no matter how big bandwith load I have, it shows almost the same values. It's expecially visible when I download or upload a lot, when I see what's situation in game and players are just disapearing and aperaing in other places and it still shows similiar values. I know it's coded properly as raw data number s are similiar and match data from other programs.

So I think that 1 byte lag info may be the reason. Is there a reliable way to check real player lag? And what do these ping numbers represent when lag is over 255? My upload is pretty bad and getting reliable ping readouts might help me and others with similiar situation with running Soldat servers in some better way.

If it's impossible to get that data from Soldat server, what to do then? I've also checked gamestat.txt file - it looks like it can show ping values greater than 255, so in theory I could use it, but on the other hand it's not the best way for someone who links to server remotely.

In advance, thanks for all your help.

Michal Marcinkowski
September 7, 2005, 4:53 pm
The ping is coded in 1 byte, but that number does not represent the ping value in ms. It is the ping in ticks (in Soldat 60 ticks = 1 second). I may not be right now but I think 1 tick is 33ms. There is no way of reading the real value of ping unless you ping the players yourself, but for the server it is pointless since it runs according to ticks not ms.

Deleted User
September 8, 2005, 12:37 am
Actually, the ping is 2 bytes O.o

To ping the server, you need to use the UDP protocol
Send to Server: "i" & chr(0) (Null char)
You will Receive: "j" & Chr(0) (Another Null char)

If you use the GetTickCount API you could accurately calculate the time between you and the server, just record the current TickCount when you send the ping, and then record the current TickCount when you receive the reply, then take the second recorded TickCount from the first TickCount and you should have the correct MS between you and the server... Or am I crazy and explaining somthing you arent trying to do? What language are you using?

Deleted User
September 9, 2005, 12:14 pm
Thanks for response. I thought that that 1-byte data is msec value... I'll try ticks aproach right now.

EnEsCe - guys @ #soldat suggested contacting you, so probably we'll have some discussion. Anyway I didn't need pinging server but reading ping values from REFRESH command. Admining program I'm making now is made from scratch C# / .Net. I missed several features in current programs so I started making my own. When it's stable and functional I should release it to public. Some programs (like ARSSE which I used) are extended with scripts - it's easy, but limits functionality, so I'll try to make it extendable with dlls.

// EDIT //
Ok, I checked pings from REFRESH and pings that I can see when I connect to game as player/spectator. When pings are <256, data is the same, when they're 256+, REFRESH number is (ping % 256). So player has ping reported in game = 100, in REFRESH it's 100, when in game it's 530, in REFRESH it's 18.

Deleted User
September 9, 2005, 1:59 pm
ohhh I got a completely different idea, to get pings just use somthing like this..
(sData being the REFRESH packet)
Player(1).Ping = Asc(Mid(sData, 961, 1))
Player(2).Ping = Asc(Mid(sData, 962, 1))
Player(3).Ping = Asc(Mid(sData, 963, 1))