Thursday, April 21, 2011

netKar PRO Log File Parser and Ballast Manager

You can download the netKar PRO server log file parser that I have written to display the race results on this blog here:

You can view server results as HTML with drill-down sections for detailed lap statistics, or as plain text, or display the raw log file. You can either browse for server log files, or drag and drop them onto the parser window. If you want to use the HTML results for your own web site, you can click the Export button and then save the HTML.

The "Move" column shows how many positions each driver has lost or gained at the end of a race compared to their starting position on the grid. The start position comes from the preceding qualifying session (if there is one), or from a server config file (selected with the "Read Config" button), if the grid is set in the config file.

You can also save a "Gap to Leader" chart image for a race which shows each drivers' gap to the leader for each lap, as well as each drivers' flags (yellow squares), contacts (red stars) and fastest laps (green squares).  See the screen shots below for an example.

Ballast Manager
Once you have opened a log file, you can use the Ballast Manager (the "Ballast" button) to set the ballast for the next race based on the results of the last race.

The first time you use the Ballast Manager, you have to set the folder where your server config files are kept, and also the ballast changes you want to make for each finishing position.

In the Ballast Manager, you first select the server config file that contains the ballast for the race that you've just opened (the "Config File From"). You then select the config file for the next race (the "Config File To") which might be a different config file, or it could be the same config file that was used for the first race.  Once you're happy with the calculated ballast changes (you can override any changes with the "Ballast Override" if you wish), you click the "Update Ballast" button to update the grid and ballast settings in the "Config File To".

You can also choose to alter the grid order in the next race, by reversing it, or reversing the first so many positions. The ballast changes are still based on the race finish positions.

If the "Config File To" has the USEFORGRID option set, so that the config file controls the order of the grid, then the Ballast Manager will only update the grid's ballast.  It won't change the order of the grid or add or remove any drivers.  If the USEFORGRID option is not set, so that only the ballast is set for the grid but not the grid order, then the Ballast Manager will replace the grid with what is shown in the "Ballast Changes" panel.  I.e. the grid will be in the shown order, and will only contain the displayed drivers.

Ballast by Lap Time
As well as adjusting ballast by racers' finishing positions, you can also choose to adjust ballast by racers' best race lap times.  The way this works is:
  1. The Ballast Manager looks at each racer's best lap time in a race and calculates the average 'best lap time' (using only best lap times within 5 seconds of the fastest best lap time, to avoid too slow racers from skewing the ballast changes).
  2. Next, the Ballast Manager works out the difference between each racer's best lap time and the average 'best lap time'.  If a racer was faster than the average 'best lap time', they will have ballast added.  If a racer was slower than the average 'best lap time', they will have ballast removed.  The amount of the ballast change is the difference in seconds multiplied by the kg of ballast per second that you set.
For example, if you set the ballast change to be 50 kg per second difference, and the average 'best lap time' was 1:35, then a racer whose best lap time was 1:34 will get 50 kg (50 kg x 1 sec) of ballast added, and a racer whose best lap time was 1:35.5 will get 25 kg (50 kg x 0.5 sec) of ballast removed.

This method of setting ballast by lap time is more accurate than by position, since even if a racer is faster than most other racers, but spins out on the last lap and comes last, they will still have ballast added to even the field.

If you have any questions, feature requests or bug reports, you can email me at the address displayed in the program's about box.

Command Line Parsing
You can call the log parser from a Windows command line to silently produce an HTML file for a server log file. An example is:

netKarPROLogParser.exe -i d:\nkserverlog[01_08_15_35]_Server1.txt
-o c:\temp\raceresults.html

You can also optionally specify a server config file (to achieve the same effect as clicking on the "Read Config" button in the parser window):

netKarPROLogParser.exe -i d:\nkserverlog[01_08_15_35]_Server1.txt
-o c:\temp\raceresults.html -c d:\race1.ini

The command line usage is:

netKarPROLogParser.exe -i <inputLogFile> -o <htmlFile>
[ -c <configFile> ]

Screen Shots

Gap to Leader chart
Ballast Manager

You can see more examples on this blog: e.g.

Change Log
June 20, 2013, version
- Added command line parsing.

June 14, 2013, version
- Added the "Move" column to race results.

October 21, 2012, version Added Gap to Leader charts.

September 20, 2011, version Displays details about pit speed infractions and jump starts in the 'Flags' column.

August 20, 2011, version
- Better internationalisation - supports global number formats properly.

August 18, 2011, version
- Fixed sorting of lap times longer than 10 minutes.

July 30, 2011, version
- Handle racers with only one name.
- Fixed sessions always showing "NO LAP".

July 3, 2011, version
- Fixed a quirky netKar bug where one racer's lap numbers started from 3 instead of 1, even though he was present at the start of the race.

June 16, 2011, version
- Ballast Manager now supports ballast changes based on racers' best lap time as well as finishing position.

June 5, 2011, version
- Added the Ballast Manager, which you can use to set the ballast between races.
- Fixed some parsing errors.

May 19, 2011, version
- Added "Gap To Prev" which is the gap to the car behind, at the end of every lap.
- Added "Cons" (consistency) which is a measure of how consistent a racer's lap times are.  The smaller the number, the more consistent the times are.  This is actually the standard deviation of the lap times, so the number means that 68% of the racer's lap times are within that many seconds of their average.  This excludes the opening lap, which is normally slower than the rest.
- Added some stats at the end of a race session:
  • Most consistent racer
  • "Hunter" - the racer that was closest to the car in front, on average
  • "Hunted" - the racer that had cars closest behind them, on average
  • "Busiest" - the racer that was in the thick of the action, with cars close in front and behind
  • "Loneliest" - the racer that was furthest from cars in front and behind.

May 14, 2011, version
- Added "Gap To Next" which is the gap to the car in front, at the end of every lap and at the end of the race. In the detailed lap statistics in the HTML results, you can hover the mouse over a gap time and it will show you the name of the racer that the gap is to.

Apr 26, 2011, version
- Added Export button to export results to file.

Apr 22, 2011, version
- Original version


  1. Thank you very much ..! Wally
    looks good, is what I need for my league.

  2. Amazing tool, well done. Thanks

  3. Hi Friends,
    I have a question...
    As I get and copy the HTML for viewing in
    because We create and we can't do run correctly the html
    This is our goal.


    Many thank for help me !!