GBXChallInfo class

This is the place where you can find everything related to the dedicated server, control scripts and community tools.

Moderators: Pit Crew, TM-Patrol

Post Reply
Xymph
Pit Crew
Pit Crew
Posts: 5645
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

GBXChallInfo class

Post by Xymph » 16 Apr 2010 09:37

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. :)
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

Xymph
Pit Crew
Pit Crew
Posts: 5645
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: GBXChallInfo class

Post by Xymph » 17 Aug 2011 19:24

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.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

Post Reply

Who is online

Users browsing this forum: Exabot [Bot] and 7 guests