Getting lap times from server result.txt file.

Post your questions here
Awc
Posts: 3
Joined: Sun Jun 02, 2019 8:56 pm
Team: Privateer

Getting lap times from server result.txt file.

Postby Awc » Sun Jun 02, 2019 9:13 pm

Hello!

I am working on a small tool to extract and save the lap times from my own server that I host for me an a friend when we want to play together. An idea that came to us was that it would be nice to be able to track our progress and save the fastest lap time for each track locally every time we finish a track.

So I started looking into extracting this from the results.txt file that is generated from each race. I have the logic made to the point where I understand it.

The times are registered in the txt file like this:
0 0 2704
0 1 3923
0 2 4403
and so on

From what I understand, the first number is the player number. The second number is the timestamp number ( I'm guessing when the pitboard updates? ) and the last is the actual timestamp itself.

To these I also see the firstlap and normallap. Indicating how many of these timestamps are for the first out lap, and then each real lap. So my thought would be, ignore the firstlap times, then compare the first real lap time to the last real lap time and get the time from there. However when doing so, it seems to always be off from the real time, and I'm struggling to make sense of this.

Am I missing something obvious? Or did I misunderstand something about this? Even when I compare the server results.txt to the singleplayer results.txt the numbers I'm taking for the time is way off.

If at all helpful I can provide the code I threw together, its all PHP if someone wants to look at it. Or if anyone has some finished code for this already that I can look at.

Thankful for any help at all!

jlv
Site Admin
Posts: 13337
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Getting lap times from server result.txt file.

Postby jlv » Mon Jun 03, 2019 1:11 am

Here's the code the stats site uses:

http://mxsimulator.com/racestats.js

If you're getting numbers that are slightly off maybe you're off by one for the finish gate and showing lap times based on the next gate after or before the finish.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

Awc
Posts: 3
Joined: Sun Jun 02, 2019 8:56 pm
Team: Privateer

Re: Getting lap times from server result.txt file.

Postby Awc » Mon Jun 03, 2019 5:48 am

Thank you a ton. I'll try this out after work today and see if i can fix it. I have tried to change the gates aswell, but i must be doing something wrong. But thank you for the code example!

Awc
Posts: 3
Joined: Sun Jun 02, 2019 8:56 pm
Team: Privateer

Re: Getting lap times from server result.txt file.

Postby Awc » Mon Jun 03, 2019 10:44 am

Thank you so much, the code example helped a ton. The key thing i missed was g_steps_per_second = 128. I assumed it was logged as hundreds of a second :)


Return to “Help / Troubleshooting”

Who is online

Users browsing this forum: No registered users and 2 guests