EDIT 190922: New GUI version released, see this post:
Web site updated, see https://projectcalc.org.
Always download latest version of PcalcUpdater here: https://projectcalc.org/download.php
Unzip, run exe, do clean laps in timetrial.
If you enjoy time trial on console, I would love to hear what you think.
You no longer need a Raspberry Pi, the small program that sends your laptimes to the database now runs on a Windows PC too. You can still play on Xbox or PS4 though!
The info below is obsolete, from the earlier parts of the project, when everything was run on a local Raspberry Pi. Now most stuff is moved to a server, all you need is the small program linked above.
------------------------------------------------------
TL;DR: Run a Raspberry Pi (very small, cheap computer) that stores your laptimes, fetches PC players laptimes, and displays it all in any browser. Leaderboards per car/track combo for Xbox and PS4!
We all know the sad state of console leaderboards. So with some great help from others, I've built a solution that I call Project CALC – Community Assisted Leaderboards for Consoles. It runs on a Raspberry Pi, and saves all your laps (laptime, sector times etc).
Once the Pi is running, you don't have to do anything. The Pi automatically saves your laps. You can view the leaderboards from any browser. Race Mode changes automatically when you switch car or track. Just leave the Pi running.
This runs on the Pi:
* program that receives UDP data
* database where laps are stored
* Apache2 web server and php pages that displays everything
* Python script that scrapes the cars2-stats-steam page and stores the times in the database
It can use both the old PC1 and the new PC2 udp format.
The program receives and interprets various UDP data from the game. Thank you Zeratall for the library, and all the help! It checks for your current lap record for the car-track combo you are currently running. You could set it to record all laps, or just laps that are valid, or just laps in Time Trial, or whatever you want. Store the data you want. Track temp? Ride height? Tyre temps? Rain density?
The database stores the data, and you could use that data anyway you want. It's a MariaDB, very similar to MySQL, and easy to use.
The php page shows the leaderboards, with dropdown selections for track, car and class. It's also possible to show just your top times for each car for selected track, or show all your stored laps.
There's also a Race Mode, a php page that displays the WR, your best laptime, and the rivals just ahead of you on the leaderboard. All in big LCD letters. This updates automatically if you set a better laptime, or change car or track. I run this on an old tablet next to my monitor, it's really awesome, imho!
This is a huge improvement over in-game leaderboards to me. I'm not a programmer at all, so it has taken a lot of trial and error. I know that there are plenty of computer programs that does this too, probably in a better way. The thing for me is that I don't want my computer turned on all the time, running the program. The Pi on the other hand, can be on all the time. It's slightly larger than a credit card, and costs about $35.
Including data from cars2-stat-steam
I, as many others, have used the cars2-stat-steam page to compare lap times. I found a scraper for this (Thanks Jonas Gulle!), and modified it to scrape all leaderboard pages that I want, and store them in the database. Now i can instantly see where I stand on my tablet: my laptimes are mixed in with the steam laptimes.
For me, the statistics are a big part of racing/gaming. I want to see my lap times and sector times, to analyze it. Now I can! No longer is my (for me) super awesome lap in a Ginetta G40 Junior erased by a crappy lap in a Toyota GT-One. It's all stored, and easily viewed.
Use it freely, and please post any improvements you make here, so others can enjoy it too. As I said, I'm not a programmer, and I have no doubt that things can be done better.
The UDP car/track names sent from the game is not coherent at all. Sometimes there's underscores, sometimes no spaces etc. This means that I have to manually add a line in the UDP program to change it. I have not gone through all cars and tracks, so if you find a strange name, please let me know and I'll fix it. Or maybe someone has a list of car names output by UDP?
Currently there's around 50 tracks and 70 cars in the database. I can add more, but the scraping currently takes around 2 hours. If you want, you can quite easily customize it to your liking. I can provide detailed steps on how to do it.
The future
If you are interested, we could look at running it all on Azure serverless. This way, console players could upload their data to the same database, also including PC players (from scraping). A Grand Unified Leaderboard! JasonSandwich, that has supported me in the development, knows more on this. Console players could use a Raspberry Pi, or small computer application, or an Android app, or something else, that receives the UDP and transmits data to the Azure server. I haven't looked into this yet, but it's an exciting thought. And fairly cheap (psst SMS)
Use at your own risk. I take no responsibility. Have fun!