The online racing simulator
champstat
(21 posts, started )
#1 - expr
champstat
champstat is an application that creates HTML presentation out of your well-preserved league replays, both race and qualifying. For each event, separate results pages are created, and additionally all results are combined in a series summary. To use this tool, you must create a directory for the executable (and conf), and then put all event replays into their own subdirectories (one per event – the name is ignored).
Then run the application (if everything goes according to plan, the application will run only very briefly, and you should have your HTML – errors may need acknowledging, but there's no user interface per se.)


Directory structure

champstat/
champstat/champstat.exe
champstat/champstat.conf
champstat/directory-names-dont-matter/neither-does-this.mpr
champstat/directory-names-dont-matter/or-this.mpr
champstat/event2/champstat.conf <-- event-specific rules
champstat/event2/q1.mpr
champstat/event2/q2.mpr
champstat/event2/race.mpr

Additionally, you can define your own scoring system by creating a file named champstat.conf. Also, event subdirectories can contain event-specific rules which by default inherit global rules. An example main configuration is included in the archive (lines starting with a semicolon are comments, and ignored by the application, but you should probably read them the first time). A word of caution: configuration files are not Windows Notepad files; you might be able to use Notepad to edit them, but you should not put any options on the first line because Notepad may add invisible extra characters at the beginning of the file, which prevents options from working.

The app is still very much in alpha stage, so bugs can be expected (especially with the Windows Console and its quirks). Suggestions are welcome.

Change log:
2020-03-31: Release 0.2c fixes some reported issues with penalties.
2021-03-05: Release 0.2d fixes an issue with 0.6V replays
2021-04-06: Release 0.3 includes a (very) limited templating system
2023-01-21: Release 0.4 adds support for vehicle mods
Attached files
champstat-0.2.zip - 271.2 KB - 649 views
champstat-0.2b.zip - 275.7 KB - 678 views
champstat-0.2c.zip - 346.8 KB - 518 views
champstat-0.2d.zip - 340.1 KB - 393 views
champstat-0.3.zip - 347.9 KB - 385 views
champstat-0.4.zip - 347.7 KB - 279 views
Works like a charm
I managed to get it running feeding with Fragmaster's League replays.
Please consider adding more settings for awarding shared points. For example
shared-points-fastest-lap-mode
shared-points-highest-climber-mode

It will avoid manually adding and removing points according to league rules.
#4 - expr
Quote from jackson93 :I managed to get it running feeding with Fragmaster's League replays.
Please consider adding more settings for awarding shared points. For example
shared-points-fastest-lap-mode
shared-points-highest-climber-mode

It will avoid manually adding and removing points according to league rules.

More granular options are now available (shared-points-mode-fastest-lap, shared-points-mode-fastest-qualifier, shared-points-mode-highest-climber).

Release 2 also has options for customising output table columns and their order.

(edit: oh, and just a reminder: there are existing tools – like mpres AFAIK – that can get you much fancier statistics from MPRs. Despite the generic description in the opening post, this tool is mostly about a very simple way of keeping track of points, where it should be okay as long your scoring system is simple enough and requires finish results anyway. Although I first started this tool to extract "silly" stats like gear change counts from replay data, I decided against using data from the undocumented parts of MPRs because, again, there are already tools for that... although I'd really like to fix that issue with fastest laps :-)...)
Hello there,

I have been using this great tool for tracking multiple seasons (http://borntorace.eu/fmgtileagues/, https://lfs-points.000webhostapp.com/so/) of leagues and it works great. Thank you, expr. So if anybody needs some tracking program based on LFSW names I can recommend champstat for you.

One thing that I think was omitted during development was information about amount of laps/time scheduled in the race.

---
EDIT

Hello again,

I found one bug with highest-climber-with-qualifying-time. In qualifying racer B2マ Skattle scored 18th position, but started the race from the back. He then got high climber for that. In race it says grid 34.
Replay qualifying.
Replay race.
Global config.
Event config.
#6 - expr
Quote from jackson93 :Hello there,

I have been using this great tool for tracking multiple seasons (http://borntorace.eu/fmgtileagues/, https://lfs-points.000webhostapp.com/so/) of leagues and it works great. Thank you, expr. So if anybody needs some tracking program based on LFSW names I can recommend champstat for you.

One thing that I think was omitted during development was information about amount of laps/time scheduled in the race.

---
EDIT

Hello again,

I found one bug with highest-climber-with-qualifying-time. In qualifying racer B2マ Skattle scored 18th position, but started the race from the back. He then got high climber for that. In race it says grid 34.
Replay qualifying.
Replay race.
Global config.
Event config.

Hi, I must've missed the notification on this one. I agree that the current behaviour is not optimal, so as a quick fix I added yet another option, highest-climber-from-qualifying-position, that can only be awarded to drivers whose grid position is equal (or better) than their qualifying result. Admitted, it's not a perfect fix in case the starting grid is massively smaller than qualifying. I might implement a more thorough check when I have the time.

Also included race duration info on race result pages (hoping I didn't break anything in the process) :-)
#7 - expr
I've released a new version, 0.2c, that (hopefully) fixes a bug that occurred in certain cases when custom penalties were used. If you use the penalties functionality, you should probably upgrade. As the naming might suggest, there are few other changes.

The keen-eyed amongst us may have noticed that the application has bumped up in size. This unfortunate, albeit perhaps insignificant change is due to a change to a 64-bit release. While not a technical necessity, this was the only way I could avoid some rather disturbing false positives that plagued the 32-bit executable when scanned at an online anti-malware service. I've checked the now-released 64-bit version, and also the zip archive, and they shouldn't have any – shouldn't, indeed!

Hoping that this will not be an issue in 2020, all the future releases will be 64-bit exclusive as well, should there be any. Cheers!
Hey expr!

Thank you for the program. It works really great and I am a big fan of it. I also might have done a bit of advertisment across various discords in different contexts.
I love the support of rational numbers in addition to natural numbers for the point scoring. I played around with it as rational numbers are inherent to the Open Endurance Cup (Nürburgring Endurance Series) point system.


There are two features that might be handy:
  • Custom bonus/penalty points: In OEC I award bonus points to teams and drivers that use a skin with all official elements. I could do a work-around by using the modify-points options, but if I understand the option correctly, it overrides any points scored in the event, so I still have to calculate the points scored for the position plus the bonus or minus the malus by hand.
  • One feature that I'd like to see is support for endurance races with driver changes as currently it only lists the driver finishing the race, but not the driver(s) that drove the car in earlier stints. Again for now I help me with modify-points but team standings become inflated.
Keep up the great work!


EDIT: Never mind what I said as first point was wrong, it obiously works
#9 - expr
Quote from TFalke55 :There are two features that might be handy:
  • Custom bonus/penalty points: In OEC I award bonus points to teams and drivers that use a skin with all official elements. I could do a work-around by using the modify-points options, but if I understand the option correctly, it overrides any points scored in the event, so I still have to calculate the points scored for the position plus the bonus or minus the malus by hand.
  • One feature that I'd like to see is support for endurance races with driver changes as currently it only lists the driver finishing the race, but not the driver(s) that drove the car in earlier stints. Again for now I help me with modify-points but team standings become inflated.

Hi,

Good thing we got that first thing sorted out already :-)

Unfortunately, the situation regarding your second request is more complicated. Currently, champstat lacks several features I'd like to include because it only reads the documented header of MPR files, which contains only so much information. As you might guess, among other things missing, it doesn't have any data about co-drivers.

However, I'm not completely ruling out the possibility of including data from the undocumented MPR body in possible future releases. The format has been rather well figured out by other add-on devs in the past, and based on that I actually implemented my own "undocumented MPR" parser back in 2018 for use in this app, and got it at least sort of working; I just never tested it all that much, so I left it and features depending on it out (truth be told, I have inadequate tests as is, which is why I've been a bit hesitant of making much changes at all).

I assume your intention is to have all co-drivers getting the points for the car's finishing position (which are currently awarded only to the driver who drives the car to the finish line)?
Thanks for your quick answer!

Yeah, after all it was a typical user error. Face -> palm

Too bad it is not in the MPR header. If you get arround and test your mpr-body paser and maybe thereby come around to implement features you want to add and maybe even the one I suggested, that would be awesome! Smile
Yes your assumption is correct. I come from the perspective of running Open Endurance Cup, where we're giving all co-drivers the same points as the finishing driver would get for the classified posission.
#11 - expr
Quote from TFalke55 :Yes your assumption is correct. I come from the perspective of running Open Endurance Cup, where we're giving all co-drivers the same points as the finishing driver would get for the classified posission.

I have some additional thoughts on your improvement idea. Currently, a team's points is simply a sum of all its drivers' points. Even if the application automatically awarded co-drivers with points, it would still lead to “inflated” team standings. If what we want is to have a team and all its drivers to have the same amount of points, we need a new team mode.

My idea for this new mode would be as follows: for each specified point category (e.g. race), the best result of a team's members is considered the “team's result”, which is awarded to all the members of that team, and counted for the team standings only once. I think you could use this kind of mode to achieve what you want with a bit less manual work. You'd still need to manually keep list of each team's drivers, but as LFS has no concept of teams, you'd need to do this anyway (even if champstat parsed driver changes from the replays) if you want to use the named teams function of the application.
Even if champstat as of now is not designed to deal with endurance races, it was a great help in providing quick championship updates for Sim Broadcasts in the Open Endurance Cup Five (with its deliberately convoluted points system)! I only used the teams' championship and worked around the fact that it is a multi-class league. It worked very well and made it easy to provide results right after the race finished.

If interested, I put a zip archive with the champstat folders into my dropbox: https://www.dropbox.com/s/tg25 ... 3/OEC5_champstat.zip?dl=0
Hello,

I noticed today that since new LFS version release champstat doesn't recognize qualify and race replays. I put replays from two sessions as I always have and I get following error
entering event directory: event09
event-specific options detected.
parsing MPR: 9_FRAGMASTER_AS4R_GTI_Q.mpr
parsing MPR: 9_FRAGMASTER_AS4R_GTI_R.mpr
fatal error: multiple race replays in .\event09

It looks that champstat doesn't recognize qualifications replays from race replays.

What I did next:
I removed point settings about qualifications and removed qualify file and ran champstat again. I got race results correctly (attachment race.html)
Decided to see how putting qualify file back and removing race file will affect things. Result was getting qualify result formatted as it was a race (attachment fake_race.html).

I'm gonna link you replays pre 0.6V which were working correctly and two from event day on 0.6V.
pre-0.6V qualify: http://borntorace.eu/fragmaster/mpres/replays/fm/gti/2021/FRAGMASTER_08_q.mpr
pre-0.6V race: http://borntorace.eu/fragmaster/mpres/replays/fm/gti/2021/FRAGMASTER_08_r.mpr
post-0.6V qualify: http://borntorace.eu/fragmaster/mpres/replays/fm/gti/2021/FRAGMASTER_09_q.mpr
post-0.6V race: http://borntorace.eu/fragmaster/mpres/replays/fm/gti/2021/FRAGMASTER_09_r.mpr

I hope you find some workaround (also what would be nice is to champstat work seamlessly with replays from both versions at the same time).
Attached files
event09.zip - 4 KB - 269 views
#14 - expr
Quote from jackson93 :It looks that champstat doesn't recognize qualifications replays from race replays.

That seems to have been the case; I hope the new release fixes the issue, and better yet, doesn't introduce any new ones. Fortunately the problem was very minor: a condition which no longer applied for qualifying replays. Removing such a condition should not cause problems with older replays, either, so the new release should be fully backwards-compatible. I also added an indicator to the program output for all input files to make such an issue easier to recognise (should it happen again in the future).
Thank you,
it is working as intended now. champstat gives correct results on replays from 0.6V and replays before new LFS release provide same results as on version c so no bug reports about backwards compatibility from me.
#16 - expr
For the first time in a long while, a new version with new features instead of just bug fixes!

I recently received a very reasonable feature request regarding the possibility of using a custom stylesheet in the generated output files. This feature was always supposed to come with the full templating system; however, that has yet to be implemented so for the time being, the new version includes a very limited templating system that can be used to achieve this particular feature (but not much else).

The new release includes example template files that you can customise to suit yourself (in a very limited fashion). Note that to use a custom template file, you need to specify it in champstat.conf (see updated champstat.conf for details). Without custom templates, the behaviour should be close to the previous version, although there have been slight changes in the generated files to fix past oversights.

(There has been quite a bit of changes behind the scenes, which also leaves a realistic chance for new bugs and unwanted behaviour. A change which is supposed to be a feature and not a bug is that in the positive case where there are no warnings and errors, the diagnostic output is saved to champstat.log instead of printed on the screen. I noticed that printing hundreds of lines – the case when there are several dozen events – to the Windows command prompt took several seconds by itself, and the output is not that interesting anyway.)
Thank you expr.
Even though I am fine with default champstat styles this new update will save me some time from adding basic responsiveness every week to event's files.
<meta name="viewport" content="width=device-width, initial-scale=1.0">

I guess it's time to dig into some css styling as this will be much easier.
Hey! I just tested champstat on (Autocross) Multi-Lap Time Trails. Sadly it detects those as "qualifying" rather then "race" session. It also only shows the fastest lap time rather then the complete finishing time.
I did the test at FE1 using a Mod (SWIRL SPORT 06~020).
Is there any way to prevent this or can I do anything?

Results html:
<!doctype html>
<meta charset=UTF-8>
<title>Qualifying at FE1 on Mon Apr 4 06:02 2022 (UTC)</title>
<style>
.qualifying-results,
.race-results {
font-family: sans;
}
.no-team::before,
.no-handicap::before {
content: "(None)";
}
.no-grid::before,
.no-change::before {
content: "N/A";
}
.dsq,
.no-team,
.no-grid,
.no-handicap,
.no-change {
color: gray;
font-size: x-small;
}
.up::before {
content: "↑";
}
.down::before {
content: "↓";
}
.eq::before {
content: "↔";
}
</style>
<table class=qualifying-results><caption>Qualifying at FE1 on Mon Apr 4 06:02 2022 (UTC)</caption>
<thead><tr><th><abbr title=Position>Pos</abbr><th>Driver<th>Team<th>Car<th>Time<th>Handicap</thead>
<tbody>
<tr><td>1<td title="TFalke55">HoR Falke<td class=no-team><td>´ߦ<td>1:27.93<td class=no-handicap></tr>
</tbody></table>

Attached files
TT_Test.mpr - 87.5 KB - 137 views
#19 - expr
Quote from TFalke55 :Hey! I just tested champstat on (Autocross) Multi-Lap Time Trails. Sadly it detects those as "qualifying" rather then "race" session. It also only shows the fastest lap time rather then the complete finishing time.
I did the test at FE1 using a Mod (SWIRL SPORT 06~020).
Is there any way to prevent this or can I do anything?

It is April, so I guess it's undeniable it would be a time for the annual update. After all, the last time we've missed the April update was in 2019, and boy, somehow 2019 feels like a long time ago.

Anyway, does this happen with other replays there and not just with this particular one?

The technical problem here is that the documented header portion of an MPR file does not contain information on whether the file contains a qualification or a race session. The current heuristics consider replays where every driver has completed 0 laps and the finishing order is the same as the best lap order as qualifications.

For some reason, this particular replay file indicates that you didn't complete any laps; I don't know the reason. I guess I could provide a method to override a file as a race (as an event-specific option), but even that couldn't fix if there were some other problems with the results.
#21 - expr
Quote from jackson93 :Hello,
to continue yearly tradition of champstat updates I think it's time to mention a long overdue thing, which I just noticed. And that thing is mods. Here's one of most extreme replays with over 15 different mods used and a result file to help debugging. As you can see it's same situation as in airio, names just look wrong.
https://www.lfs.net/attachment/422996
http://borntorace.eu/fragmaster/secret/race.html

Release 0.4 fixes the corrupted output when replays contain vehicle mods. By default, modified vehicles show up as "MOD" in the car column, with the mod id available as a tooltip on hover. Additionally, by default the MOD text is a link to the vehicle mod page on lfs.net. You can modify the generated output with the new mods section in champstat.conf and the car-links option in the output section (see updated example configuration for details).

champstat
(21 posts, started )
FGED GREDG RDFGDR GSFDG