Custom Championship tool (SP & MP races) (creates HTML reports)

Discussion in 'Community Workshop' started by pixeljetstream, Jan 29, 2015.

  1. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +371 / 0
    (cross-posting this from RD thread)

    Hi,

    in case you like flexibly combining independent single races to a championship rather than using the built-in championship, or want to track multiplayer races as seson, this tool is for you :)

    The open-source project can be found here https://github.com/pixeljetstream/r3e-open-championship

    As you do multiple "singlerace" events their results are tracked as championship. A HTML report like the one below is generated (imagine it would append more and more races as you keep racing).

    http://htmlpreview.github.io/?https...open-championship/blob/master/doc/sample.html
    (click url above for more details)

    [​IMG]

    It works as follows
    • A small program tracks edits to "My Games/SimBin.../Results/raceresults.txt" which contains the results of the last race (no matter what kind of race it was). If a race was too short (say < 5 minutes) it is discarded.
    • Based on the content of the file a unique "championship" is created (hash based on starter-field). That means if you choose always the same starter-field config (vehicle class and number of opponents) in your single player race, it shall treat it as a single championship
    • For every completed race, the results are appended to the championship file (a simple text file storing the results for every race) and a HTML file is generated with the current standings, see image above

    The championship is open, as none of the settings are really frozen, you can keep going and mix tracks however you want, change AI... It really is just pseudo championship based on your individual races, but it's better than doing it by paper ;)
    To start over, one can delete (or rename) the old championship file.

    Just run the tool while r3e is running as well, it will detect changes to the file, or you can trigger them manually

    [​IMG]

    A few caveats:
    • Simply do not run the app if you do races you don't want to track (or toggle the tracker off). If something is accidentally added somewhere you can always manually edit the championship files and remove the last entry.
    • Since the tracknames are not stored in the result file (only track lengths), we need a mapping of track lengths to track names. Thanks to two community members (heppsan and tAz-07) most tracks are in there. If you see the number instead of a track name, please help complete the mapping (just edit the r3e-... lua file on very top).
    • The generated html is not ultra fancy. A single "point rule set" is applied to all races, so purists who would want dtm 92 to have not the current FIA scoring, would have to edit that part.

    Which actually leads me to the next topic, the whole thing is scripted via Lua, so it only takes a text editor to make changes to how it works. Don't like the html generated, easy to change...

    All relevant logic is in this file
    https://github.com/pixeljetstream/r3e-open-championship/blob/master/r3e-open-championship.lua

    I hope it's useful to some of you for "chaining" events. It is as accurate as the raceresults.txt generated by r3e itself.

    Special thanks to heppsan and tAz-07 for their contributions.

    UPDATE: for server/multiplayer usage use the commandline options

    The tool now supports json and xml result files as generated via the server api. Use the commandline options to append the resutls to a "season" and update the season file

    Code:
    luajit.exe r3e-open-championship.lua -addrace ./results/season1.lua 201511030659.json -makehtml ./results/season1.lua ./results/season1.html
    Simpler Server Usage:
    Pass the result file (json or xml) onto the myleague.bat file, it will append the race to "myleague" database, generate and show the resulting html report. By copy & renaming the batch file to another name, you also change the database.

    For eaxample "myleague.bat" copied and renamed to "GTR3 Summer Season 2014.bat" would use the "GTR3 Summer Season 2014".lua/html files.

    -Christoph
     
    • Like Like x 12
    • Winner Winner x 11
    Last edited: Mar 25, 2017
  2. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +371 / 0
    as people mentioned on RD forum, the tool can also be used for tracking multiplayer races, I may need to refine the logic a bit to allow combining events with not 100% the same drivers, but once dedicated servers are out and people have concrete plans how it should work, can be upgraded to cover that as well :)
     
    • Like Like x 4
  3. ::SKRO::

    ::SKRO:: Well-Known Member

    Joined:
    Jan 29, 2015
    Ratings:
    +971 / 0
    That's exactly what I was thinking (and writing on RD forum) ;)
     
  4. heppsan

    heppsan Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +1,040 / 0
    Here are the number codes for Sonoma. :)
    WTCC: 4101.1851
    Sprint: 3208.6384
    Long: 4046.4993
    IRL: 3706.5615
     
    • Like Like x 1
  5. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +371 / 0
    great thanks! updated git accordingly
     
    • Like Like x 2
  6. David Plummer

    David Plummer Member

    Joined:
    Jan 30, 2015
    Ratings:
    +10 / 0
    Great tool @pixeljetstream, works really well i did how ever encounter a bug in the game, i finished first but the results showed that i didnt even finish is there a way to edit the results to correct the bug?
     
  7. Chmul Khom

    Chmul Khom Well-Known Member

    Joined:
    Feb 24, 2015
    Ratings:
    +172 / 0
    @David Plummer
    yes there is ...

    In the folder "results" you open the file "xxx .... xxx.lua" with the program "TextWrangler " or similar.

    Now you are looking for entries that are behind a round ...

    These entries you add the Racetime with the BestLap time. (Racetime + BestLap = new Racetime)

    Now even replace the Racetime against the new Racetime, and update the number of rounds.

    Caution: Do not change the order of the entries ...

    Finally, in the folder "results" delete the file "xxx .... xxx.html", and with the R3E Open Championship - function "Rebuild all HTLM stats" rebuild a new html file.
     
  8. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +371 / 0
    with dedicated servers out, I'd like to know who is interested in using this tool to track results of leagues, as I am about to change the "championship" database key to be more tolerant, to make it usable for multi-player where ordering of drivers and number of drivers may change a bit.

    one question can it be assumed that you have to race with the same car&team within a season?
     
    • Like Like x 1
    • Winner Winner x 1
  9. ::SKRO::

    ::SKRO:: Well-Known Member

    Joined:
    Jan 29, 2015
    Ratings:
    +971 / 0
    That'd be awesome.
    As suggested by @Tim Cannon a while ago, it'd be very cool to randomly sort players and assign them to cars and team when participating to a Champ/League.
    You're the boss man! Make us drool
     
  10. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +371 / 0
    not sure I understood you, so you want that any driver can use any car in any race during the championship, so the only identifier to match is the name?
    if I detect such cases, I can basically remove "team" standings as they become meaningless. my strategy would be to find championships with similar driver names (some percentage) merge with that, and fill in "DNFs" for drivers not attending some races.
     
  11. ::SKRO::

    ::SKRO:: Well-Known Member

    Joined:
    Jan 29, 2015
    Ratings:
    +971 / 0
    Nope I meant that at the beginning of a Champ players are assigned to a car and team (randomly) and then they maintain the same car throughout the whole season. So no please don't remove the team "class"!
     
  12. Joshua Spann Jr

    Joshua Spann Jr Active Member

    Joined:
    Jan 16, 2015
    Ratings:
    +31 / 0
    Is there a way you could make this work with multi-class for leagues
     
    • Useful Useful x 1
  13. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +371 / 0
    The tool doesn't know anything about classes, only gets a list of "driver name, team name, car name", so yes should work.

    Edit: thinking about this more, I guess what you mean is having dedicated standings for the classes, and not all be thrown in a single standings. Certainly doable (what isn't hehe) but will have to wait a bit.
     
    Last edited: Jun 13, 2015
  14. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +371 / 0
    In preparation for better multiplayer support, I added some eye-candy (so much about priorities of important features hehe):
    Icons are now part of the report and are directly linked from the game's website server (thx s3s for allowing it)

    Noticed that Salzburgring and Shanghai tracks are missing, will add numbers tomorrow. One request to the community if someone can send me their "raceresults.txt" after a multiplayer race, would be cool.
     
    • Winner Winner x 3
    • Like Like x 1
    Last edited: Jun 13, 2015
  15. ::SKRO::

    ::SKRO:: Well-Known Member

    Joined:
    Jan 29, 2015
    Ratings:
    +971 / 0
    This is really really nice @pixeljetstream. Keep up the great job. I'll try to see if we can export tonight's results for ADAC 2014 @ Laguna
    I'll pm you in a few cause I want to ask you something ;-)
     
  16. ::SKRO::

    ::SKRO:: Well-Known Member

    Joined:
    Jan 29, 2015
    Ratings:
    +971 / 0
    weird @pixeljetstream
    this is what i got when i launched the program:
    [​IMG]
    is it working?
     
    Last edited: Jun 14, 2015
  17. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +371 / 0
    oops, fixed that, grab latest (btw when you run exe from commandline, errors are printed there)
     
  18. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +371 / 0
    • Like Like x 2
    • Winner Winner x 1
    • Love it! Love it! x 1
  19. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +371 / 0
    improved logic of html generator to cope with missing (called "non-starter") or different "internal order" of participants, which is the big step for better MP support and actually allows you to copy paste races from the database files together already. The second part coming next is trying to combine races with similar drivers + matching cars to a season.

    There is two ways
    1. "manual" only try to add to a user-specified database (fail if field is too different, i.e. cars and team don't match up...)
    2. "automatic-tolerance" iterate existing database files and find the one that has a minimun and the most in common with the current race
    1. is less work and avoids loading files that are not interesting anyway, so I will pursue that first. Basically the UI get's a textbox where you define the database "key" (the md5 string) manually.

    Another feature I will add is generating specific database, and adding results via commandline so that in future the tool can be run on the server easily without UI.
     
    • Informative Informative x 1
  20. pixeljetstream

    pixeljetstream Well-Known Member Beta tester

    Joined:
    Jan 29, 2015
    Ratings:
    +371 / 0
    The manual database override has been added as well as commandline options. The database override is best used to combine multiplayer results of a certain league/season. Simply fill the textbox with some name that can be used as filename prior racing in multiplayer, or prior clicking on check-results if you start the tool after the race has been completed.

    If you have missed recording a certain race to a specific season file, simply try to find the race in one of the autogenerated database files (the ones named after car + hashstring) and copy paste the results of the last race into your custom season file.

    Community: if someone does a multiplayer race with mixed classes, please send me your raceresults.txt (typically: C:\Users\USERNAME\Documents\My Games\SimBin\RaceRoom Racing Experience\UserData\Log\Results) after you finished the race.
     
    Last edited: Jun 20, 2015