Page 1 of 1

GBXChallInfo class

Posted: 16 Apr 2010 09:37
by Xymph
As part of my Dedimania database anti-cheat scans and consistency checks, I recently wrote a script to obtain the number of checkpoints on a track. This count cannot be extracted from the track's .challenge.gbx file, the only reliable way is to load the track into a server and invoke the GetCurrentChallengeInfo method on it. To make this more generally accessible I put the entire process into a PHP class, which I'm now releasing here in case someone else finds it useful.

This GBXChallInfo class requires a recent TMF dedicated server (build 2009-05-04 or newer), and the GbxRemote module. You need to configure the class with the server port and SuperAdmin password, as usual for any script talking to the dedicated.

The process contained in the class takes a challenge file somewhere under the server's .../GameData/Tracks/ directory, adds it to the track list, loads it as the next challenge, calls GetCurrentChallengeInfo on it, and removes it from the track list again. Obviously you don't want to do this on a public server where players are racing, so it's best to set up a private test server for this.

The return data includes all of the GetCurrentChallengeInfo fields, the desired one being $nbcps, the number of checkpoints in TimeAttack mode. And there is an extra $nbrcps field, the number of checkpoints in Rounds (and Team, Cup & Laps) mode. For multilap tracks with more than one lap, it's the number of laps times the number of checkpoints, and otherwise it's the same as the TA number of checkpoints.

Download the GBXChallInfo class here. Cheers. :)

Re: GBXChallInfo class

Posted: 17 Aug 2011 19:24
by Xymph
While an update of this class wasn't needed for TrackMania² Canyon, a new idea led to another update. Previously the class was unable to get info from a track that was already on the server; the process was to add a track / get the info / remove the track. Now it can get info from a track in the server's challenge list, and in that case doesn't remove it either.

The download link can be found on the XAseco site.