Results 1 to 10 of 10

Thread: PCARS Data API (PCARS2 Suggestion and Possible PCARS1 Project)

  1. #1
    Superkart Pilot SenorPez's Avatar
    Join Date
    Jan 2016
    Location
    Place
    Posts
    237
    Platform
    PS4

    PCARS Data API (PCARS2 Suggestion and Possible PCARS1 Project)

    I thought about putting this in the PCARS 2 forum, but since it's more developer-focused, I figured it would find more traction here.

    One thing I'd like to see in PCARS 2 (it's probably a little late in the cycle for PCARS, but maybe I'll poke around since the Replay Enhancer seems to be fairly stable) is a cars and event REST API. There were a lot of community attempts at creating car databases, with varying degrees of usability and correctness. Ideally, this API information would be published and available from SMS and the PCARS website, but if we have to do it as a community project for the full-stack, I think we can manage that.

    The API would deliver JSON data, a fairly common exchange format that, while not easy on the eyes, is easy to process in just about any programming language. From this API, application developers could then build applications using this "source of truth" data, rather than having to reinvent the wheel because there's no way to import data from an Excel spreadsheet into a Python script (not easily, anyway).

    A few examples... note that the URL is hideous because I'm not masking the AWS data and it's likely to stop working at some point (just because I bring the instance down)... also the data structures are fairly pedestrian at this point... but it's a proof-of-concept:

    Car list (note that this isn't actually the full car list, nor a full set of data, but you get the idea): http://www.projectcars.senorpez.com/v1/cars
    Track list: http://www.projectcars.senorpez.com/v1/tracks
    Event list: http://www.projectcars.senorpez.com/v1/events

    Events also support drilling down.
    Cars allowed for a specific event: http://www.projectcars.senorpez.com/v1/events/2/cars
    Rounds in a specific event: http://www.projectcars.senorpez.com/...nts/15/rounds/
    Specific round in a specific event: http://www.projectcars.senorpez.com/...nts/1/rounds/3

    Like I said: This would be most effective coming directly from SMS, as they're going to have all the data available, correct, and can put it out there. But as a community, I think we can do it, too. Let's make it happen.

    If you have WMD: Maybe pitch this idea? (I regret not getting in on WMD2.)
    If you want to help, even just data entry, for PCARS 1 stuff: Let me know. There's a non-trivial chance I expand this moving forward to support PCARS for no reason but my own curiosity.
    Last edited by SenorPez; 12-04-2017 at 21:22. Reason: New URLs.
    Project CARS Replay Enhancer (Thread): http://forum.projectcarsgame.com/sho...eplay-Enhancer
    Kobernulf Monnur's Driver Journey: https://www.youtube.com/playlist?lis...mO1D9jU200jcWJ

  2. #2
    Moderator Ryzza5's Avatar
    Join Date
    Oct 2011
    Location
    Melbourne, Australia
    Posts
    1,032
    Platform
    PC
    I'm sure one of the devs would have noticed this anyway, but I have linked to this thread in the WMD2.0 forums on your behalf.

    MB Asus P8Z77-V Deluxe // CPU Intel i5 3570K // RAM G.Skill 16GB DDR3 @2133MHz // GPU Gigabyte nVidia Titan X // HDD 4x 2TB Western Digital // SSD Samsung 850 Evo 1TB

    CPU Cooler Corsair H80 // Case CoolerMaster 650 Silencio // Display ASUS PG34Q 34" 3440x1400 100Hz G-SYNC LCD // Speakers Logitech Z5500-D 5.1ch // OS Windows 10 Pro x64// Build Default Parameters

    VR Oculus Rift CV1 // Wheel Fanatec CSR Elite // Pedals Fanatec Clubsport // Shifter Thrustmaster TH8RS with InterfaceOne wheel adapter // Head Tracking TrackIR v4 // Audio Transducer ButtKicker Gamer v2.0 // Seat PlaySeat Executive
    The following user likes this Post: SenorPez


  3. #3
    Superkart Pilot SenorPez's Avatar
    Join Date
    Jan 2016
    Location
    Place
    Posts
    237
    Platform
    PS4
    Updated lead post. Made the API a little more mature, cleaned up some of the URLs, and enabled pretty printing so the output is less harsh on human eyes.
    Project CARS Replay Enhancer (Thread): http://forum.projectcarsgame.com/sho...eplay-Enhancer
    Kobernulf Monnur's Driver Journey: https://www.youtube.com/playlist?lis...mO1D9jU200jcWJ

  4. #4
    WMD Member MikeyTT's Avatar
    Join Date
    Jul 2012
    Location
    Crewe, UK
    Posts
    817
    Platform
    PC
    It's a great idea and much of this is actually encompassed in my suggested API variables, I've posted to the PC2 API section. But not the REST bit

    Are you aware that some of the car and track data is available directly from the Dedicated Server today, and may well be extended in PC2?

    You tag on something like "/api/list/tracks" to the DS address and you get back this:

    Code:
    {
      "result" : "ok",
      "response" : {
        "description" : "All known track ids",
        "list" : [      
          {
            "id" : 999,
            "name" : "Some Location Circuit",
            "gridsize" : 20
          },
          {
            "id" : 998,
            "name" : "Some Place GP",
            "gridsize" : 38
          },
    Note: This is from the PC2 DS, so I've changed things to be on the safe side

    You can do this for tracks, car classes, cars, plus weather and a few others I can't recall. But, in relation to your OP, it doesn't necessarily do all of the extra "what this session is configured like" you're asking for, or at least yet.

    For your ref, I've compiled a spreadsheet of the API changes I'd like to see, which also covers off a lot of what was collected for PC1, that didn't make the cut. It's in the post here in my vrHive thread: http://forum.projectcarsgame.com/sho...=1#post1326207

    The key for me is being able to get access to the setup data, as the user is in the pits. That way, for my app, you can actually automate things like saving the setup data against each of the laps the player is taking. Then you can compare that with previous runs, setups, weather data, etc.
    Processor: Intel i7-4790 @ 3.6GHz Mainboard: Asus Maximus VI Memory: 32GB DDR3 Videocard: MSI 980ti Motherboard Sound/Headphones: Creative SB Z + M/B Sound for SimVibe / Onkyo 5.1 Surround + Astro A50 Headphones Monitors: 3 x Asus 27" VN279H PSU: OCZ ZX1250W Keyboard+Mouse: Corsair Gaming K70 RBG / Logitech G700 Mouse Gamepad/Wheel: Fanatec CSWv2 + BMW Rim, Fanatex CSPv2, Fanatec CS Shifter SQ v1.5 OS: Win7 Ult x64 Storage: 256GB SSD + 3TB HDD
    Resolution: 5040x1080@60Hz Texture Res: High Texture Filter: 4x V-Sync: No AA: MSAA4x FXAA & SMAA: Off Reflections: Low Vehicle Detail: Ultra World Detail: High Shadow Detail: Low Motion Blur: None
    My vrHive Telemetry and Dash App (PC/PS4/XB1) - Forum Page: http://forum.projectcarsgame.com/sho...nt-Server-more
    My vrHive Telemetry and Dash App (PC/PS4/XB1) - Web Site: www.vrhive.co.uk
    My YouTube Channel: http://www.youtube.com/user/TR7V8Mike?feature=mhee
    My Twitch Channel: http://www.twitch.tv/mikeytt
    The following 2 users likes this Post: bradleyland, SenorPez


  5. #5
    Superkart Pilot SenorPez's Avatar
    Join Date
    Jan 2016
    Location
    Place
    Posts
    237
    Platform
    PS4
    Quote Originally Posted by MikeyTT View Post
    It's a great idea and much of this is actually encompassed in my suggested API variables, I've posted to the PC2 API section. But not the REST bit

    Are you aware that some of the car and track data is available directly from the Dedicated Server today, and may well be extended in PC2?
    I actually wasn't, and I'll have to check it out. My main platform is PS4, so I've not ever touched the Dedicated Server, but if its outputting some data, that's useful! I'll have to check it out.

    Quote Originally Posted by MikeyTT View Post
    For your ref, I've compiled a spreadsheet of the API changes I'd like to see, which also covers off a lot of what was collected for PC1, that didn't make the cut. It's in the post here in my vrHive thread: http://forum.projectcarsgame.com/sho...=1#post1326207
    And I'm really hoping a lot of that comes in, and glad you're spearheading it. There's definitely room for improvement, and if PCARS2 wants to continue app support, we'll love them for doing it!

    Quote Originally Posted by MikeyTT View Post
    The key for me is being able to get access to the setup data, as the user is in the pits. That way, for my app, you can actually automate things like saving the setup data against each of the laps the player is taking. Then you can compare that with previous runs, setups, weather data, etc.
    That would be really, really, really cool if something like that could be implemented. "Okay, I changed my springs, what's my 3-lap average delta?" It could really help people get a handle on the black art of tuning... assuming they can turn consistent laps.

    I think something like what I proposed would run right alongside that. For example, once your app identifies that I'm driving a Mustang Cobra TransAm, it can pull the static data (weight, wheelbase, etc.) and combine it with the session-specific data (track temperature, tuning settings, etc.). That way, you don't have to worry about data entry or processing for the cars; you can focus on the session information and your front end.
    Project CARS Replay Enhancer (Thread): http://forum.projectcarsgame.com/sho...eplay-Enhancer
    Kobernulf Monnur's Driver Journey: https://www.youtube.com/playlist?lis...mO1D9jU200jcWJ
    The following user likes this Post: MikeyTT


  6. #6
    Superkart Pilot SenorPez's Avatar
    Join Date
    Jan 2016
    Location
    Place
    Posts
    237
    Platform
    PS4
    Updated the URLS. They're pretty now.

    Also did a bunch of data entry, so it's more robust. Have a look.

    If you find errors, or if you want to help fill in the gaps, the project is on Github. You can clone it or edit the data.json file and submit it to the project for inclusion!
    https://github.com/SenorPez/project-...tree/0.1-devel

    Let me know if you have questions!
    Project CARS Replay Enhancer (Thread): http://forum.projectcarsgame.com/sho...eplay-Enhancer
    Kobernulf Monnur's Driver Journey: https://www.youtube.com/playlist?lis...mO1D9jU200jcWJ

  7. #7
    Superkart Pilot SenorPez's Avatar
    Join Date
    Jan 2016
    Location
    Place
    Posts
    237
    Platform
    PS4
    I added most of the cars data. Enjoy.

    There's also some rudimentary documentation located at: http://www.projectcars.senorpez.com/swagger-ui.html
    Project CARS Replay Enhancer (Thread): http://forum.projectcarsgame.com/sho...eplay-Enhancer
    Kobernulf Monnur's Driver Journey: https://www.youtube.com/playlist?lis...mO1D9jU200jcWJ

  8. #8
    Superkart Pilot SenorPez's Avatar
    Join Date
    Jan 2016
    Location
    Place
    Posts
    237
    Platform
    PS4
    Good news: I'm not dead. (There was some job-drama, but that's typical American dream these days, right?)

    Better news: While there's still some data gaps, the PCARS API is far more mature and stable now.

    If you're interested, check it out at:
    http://www.projectcars.senorpez.com/

    From there, it's self-documenting. Okay, not entirely. I've not actually written the documentation that should be at the documentation links yet (which is funny, since that's my real-life job). But the link names should give you an idea of what's there, and where you can go next.

    There's some probably-out-of-date Swagger documentation at: http://www.projectcars.senorpez.com/swagger-ui.html

    Notes
    This will all work out of a web browser for now, but if you really want to use this in an application, you should set your request Accept header to "application/vnd.senorpez.pcars.v1+json". Why? Because when I roll out data for PCARS2, you'll use the same URLs, but the Accept header will change to "application/vnd.senorpez.pcars2.v1+json" in order to get PCARS2 data. And the "application/json" that's currently being served into a web browser will fallback to PCARS2 since that'll be the latest game version + API version.

    There's data missing! If you see a track with a length of 0, that means it hasn't been verified with in-game telemetry capture (for length and what the game calls it in telemetry). If you see an event with "verified: false," that means it hasn't been verified, so the round names and car eligibility could be wrong. If you want to help, you can do so. Please use verified telemetry or screenshot data, though... there are some quirks between what you might think is right and what the game internally uses. The object of this is to align with that captured telemetry, so that there's nothing lost in translation! I wanted to get to this last month, but the job-drama has kept me from playing PCARS for a month.

    v1 is currently unstable. If you build an app against this, expect it to be broken. (That being said, v1's probably pretty close to being finished.)

    Help is always appreciated. I'm far from a professional programmer, but I'm getting better... and I'd love to learn from you, and in turn, make something awesome for PCARS2.

    The API is designed to be HAL compliant. http://stateless.co/hal_specification.html

    Questions
    I can't seem to get a complete list of, say, cars.
    That's correct. HAL and REST are somewhat expected to be "chatty." For example, you can get a list of all tracks at http://www.projectcars.senorpez.com/tracks, but to see individual track data, aside from the name and ID, you need to open each link. That's intended behavior. Keep in mind:
    • The chunks of data opening each track is a tiny web transaction, and it's running on a Java+Spring backend, which will optimize the calls even further. Transferring huge files is bad.
    • The API isn't really intended for human consumption, so "clicking" 100 links to get data for all 100 tracks in the game isn't actually all that onerous if you're a machine. And since, as above, the chunk for each track is small, you can also do this in parallel, making it fast and efficient, at the expense of you hitting my webserver 101 times instead of 1.
    Last edited by SenorPez; 02-06-2017 at 21:23.
    Project CARS Replay Enhancer (Thread): http://forum.projectcarsgame.com/sho...eplay-Enhancer
    Kobernulf Monnur's Driver Journey: https://www.youtube.com/playlist?lis...mO1D9jU200jcWJ

  9. #9
    Superkart Pilot SenorPez's Avatar
    Join Date
    Jan 2016
    Location
    Place
    Posts
    237
    Platform
    PS4
    I've added in data from the list of (sort-of) confirmed cars and tracks for Project CARS 2. You can access them by setting the GET request Accept header to "application/vnd.senorpez.pcars2.v0+json; charset=UTF-8".
    Project CARS Replay Enhancer (Thread): http://forum.projectcarsgame.com/sho...eplay-Enhancer
    Kobernulf Monnur's Driver Journey: https://www.youtube.com/playlist?lis...mO1D9jU200jcWJ

  10. #10
    Superkart Pilot SenorPez's Avatar
    Join Date
    Jan 2016
    Location
    Place
    Posts
    237
    Platform
    PS4
    As of right now, I'm calling the data model for PCARS done. Once the data integrity test is complete (it takes about 24 hours), I'll release this as V1.0.

    Note that this does not mean the data won't change. I'm still working on verifying what I can. But unless there's a serious issue, the structure in which that data is presented through the API will not change, at least not without a version update.

    Now, to see if I can get this up and running in time for PCARS2? Unfortunately, I've already got plans for a few days after the 22nd, so I'll miss the initial rush... and I should find a job that actually pays me before then. *sigh*
    Project CARS Replay Enhancer (Thread): http://forum.projectcarsgame.com/sho...eplay-Enhancer
    Kobernulf Monnur's Driver Journey: https://www.youtube.com/playlist?lis...mO1D9jU200jcWJ

Similar Threads

  1. Some Pcars2 questions in relation to Pcars
    By Leper Messiah in forum General Discussion
    Replies: 38
    Last Post: 01-06-2017, 23:41
  2. Importing Pcars profile into PCars2
    By Saloei in forum General Discussion
    Replies: 13
    Last Post: 02-03-2017, 14:11
  3. Pcars 2 - Suggestion for Sr. Mgmt…
    By VFX Pro in forum General Discussion
    Replies: 0
    Last Post: 06-01-2017, 22:49
  4. Replies: 9
    Last Post: 29-04-2016, 00:21
  5. Suggestion for pCARS 2
    By Javaniceday in forum General Discussion
    Replies: 2
    Last Post: 28-10-2015, 01:11

Posting Permissions

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