Results 1 to 4 of 4

Thread: Project CALC - car/track leaderboards for consoles

  1. #1
    Superkart Pilot Maskmagog's Avatar
    Join Date
    Sep 2017
    XBOX1 X

    Project CALC - car/track leaderboards for consoles

    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 uses the newer 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.

    Click image for larger version. 

Name:	sugo-procar.jpg 
Views:	5 
Size:	122.4 KB 
ID:	263504

    Click image for larger version. 

Name:	oulton-ginetta.jpg 
Views:	1 
Size:	124.1 KB 
ID:	263507

    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!

    Click image for larger version. 

Name:	oulton_lotus_racemode.jpg 
Views:	0 
Size:	105.7 KB 
ID:	263506

    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 would still need a Raspberry Pi, or desktop application, 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!
    Last edited by Maskmagog; Yesterday at 18:29. Reason: added info about udp format
    Thrustmaster TX, Italia 458 wheel, 2 pedals, Firmware 54, Xbox One X, public OS, 24" 1080 monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.
    The following 5 users likes this Post: beetes_juice, blinkngone, Chawabax, cpcdem, JasonSandwich

  2. #2
    Superkart Pilot Maskmagog's Avatar
    Join Date
    Sep 2017
    XBOX1 X

    How to use it

    What you need:
    Raspberry Pi. There's several variations. I run it on a Raspberry Pi 3.
    Power supply. Around 2-2.5A. Depends slightly on the version of RPi. Most places that sell the pi sells appropiate power supplys too. An old phone charger might work.
    Case for the Pi (optional).
    Micro SDHC card. I suggest 32GB or bigger. The image is done from a 16GB card, but if you're unlucky, another manufacturers 16GB card might be slightly smaller.
    Ethernet cable between RPi and router. Might work with WiFi too, but wired will probably be more stable.

    A computer with a SDHC card reader/writer.
    For Windows there's a program called Etcher for writing images onto SDHC cards.

    Grab the file from the link below, unpack it, and write the image file to your sdhc card, then insert it in your Raspberry Pi.

    I *think* the rest will be automatic. The program should get your gamertag automatically from the UDP stream.

    Find the ip of the Pi on your network.
    Browse to <your-rpi-ip>/index.php. Hopefully you'll see the leaderboard!
    Bottom left it link to settings. At the moment the program only accepts valid laps, set in timetrial. If you want to, you can change that here.

    Link to image file, last updated 190115:

    If you want to change stuff yourself on the Pi:
    EDIT: SSH should already be active, so adding the ssh file should not be needed (Add an empty file called 'ssh' to the root of the sdhc card, while it's still in your computer. This activates SSH on the Pi.)
    To login to the Raspberry pi, I use the program 'putty'. Username is 'pi'. PM me for password. You can later change password etc by entering 'sudo raspi-config' when logged in.

    The MariaDB can be accessed by 'sudo mysql -p'. Pass PG3Dnq4m2BVFaaLC.

    The scraper is in /home/pi/pc2scraper/, and can be edited via putty with the command 'sudo nano /home/pi/pc2scraper/', or (preferrably) on a regular computer. I use WinSCP to login and move files to/from the Pi.
    Copy the cars/tracks you want from the bottompart of the python file (excluding the #) and paste into either customtracks or customvehicles (row 178-179).
    Run the scraper with 'sudo python /home/pi/pc2scraper/'. With around 70 cars and 50 tracks, it takes around 2 hours. It's currently run automatically every tuesday at 01:30.

    The UDP script, which is built with Visual Studio, is in /home/pi/pc2udp/pc2udp.exe. Should start automatically, as a service, and run in the background.
    The command 'sudo systemctl status pc2udp' will show if the udp program is running in the background, and show the latest output.

    All source files are here:
    Last edited by Maskmagog; 14-01-2019 at 22:58. Reason: changed link to updated version
    Thrustmaster TX, Italia 458 wheel, 2 pedals, Firmware 54, Xbox One X, public OS, 24" 1080 monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.
    The following user likes this Post: JasonSandwich

  3. #3
    WMD Member ian2726's Avatar
    Join Date
    May 2015
    why cant I be smarter!!!
    Samsung 65" 4k TV, XB1X, Fanatec CSW V2, CSP V3, Xbox universal hub, Fanatec shifter, Fanatec handbrake, Vesaro gamer rig, Elite controller, Buttkicker gamer extreme, BBJ button box. Turtle beach XO4, Onkyo Dolby Atmos receiver, Onkyo Dolby Atmos 5.1.2 speakers,

  4. #4
    Superkart Pilot Maskmagog's Avatar
    Join Date
    Sep 2017
    XBOX1 X
    Once it is setup, you don't have to do anything. The Pi (hopefully ) takes care of everything: storing your laps, updating laptimes from Steam leaderboard, updates the program, getting your gamertag etc. While the program is free to use, you need some hardware (Raspberry Pi, charger, sdhc card, short ethernet cable) but totally worth it to me, as I enjoy time trial. I run it on a Raspberry Pi 3, but it would probably run fine on an older Raspberry Pi 2, if you have one lying around.

    Please feel free to ask any questions about it, or any ideas that come to mind. I'd be happy to provide detailed instructions on what to buy and how to set it up.

    Hopefully we can evolve this into something really good!
    Thrustmaster TX, Italia 458 wheel, 2 pedals, Firmware 54, Xbox One X, public OS, 24" 1080 monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.

Similar Threads

  1. Leaderboards on consoles
    By simsimsheree in forum General Discussion
    Replies: 23
    Last Post: 22-03-2018, 22:52
  2. Project CARS Leaderboards - a development request?
    By pippinfort in forum General Discussion
    Replies: 6
    Last Post: 18-12-2015, 12:40
  3. How to pick spring rates? (and how do they interact with Jussi's calc?)
    By Gibbon in forum The Garage - Car Setup Talk
    Replies: 10
    Last Post: 28-10-2015, 13:31
  4. [Consoles] More groups / filtering on Leaderboards
    By Ma5hEd in forum Feature Suggestions
    Replies: 12
    Last Post: 15-08-2015, 13:35
  5. Anyone here got this on BOTH consoles?
    By chris4652009 in forum Project CARS on Playstation 4
    Replies: 6
    Last Post: 12-05-2015, 08:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts