Shared Memory API

Discussion in 'Community Workshop' started by Mikael Hermansson, Jun 7, 2015.

  1. Mikael Hermansson

    Mikael Hermansson Well-Known Member

    Joined:
    May 3, 2015
    Ratings:
    +47 / 0
    Good thing you caught that, 'cause I'm not sure I would have. I'll be sure to fix that in the final version. Please let me know if you find any other discrepancies like that.
     
  2. mr_belowski

    mr_belowski Well-Known Member Beta tester

    Joined:
    Apr 23, 2015
    Ratings:
    +1,283 / 0
    There's at least one more I think - but it'll be tomorrow before I can check them
     
  3. Sascha Brandenburg

    Sascha Brandenburg Well-Known Member

    Joined:
    Feb 17, 2015
    Ratings:
    +56 / 0
    @ Tom Shane as i see your name here inside these thread my heart begans to spring. If i'm right that you are planning a profiler like the pcars profiler ?? Please say YES :D
     
  4. Tom Shane

    Tom Shane Active Member

    Joined:
    Feb 15, 2015
    Ratings:
    +30 / 0
    NO. :) I hate to disappoint you, but this time the plan is rather real-time only telemetry display (dashboard-like) for Windows 10 ecosystem.
     
    • Like Like x 3
    • Informative Informative x 1
  5. mr_belowski

    mr_belowski Well-Known Member Beta tester

    Joined:
    Apr 23, 2015
    Ratings:
    +1,283 / 0
    Here's what I've found so far with the shared memory block...

    For rolling starts, the SessionPhase variable starts at 'Green' (5). I was expecting this to be Countdown (4) or (more correctly I guess) Formation (3) before crossing the start line. For standing starts it works as expected (it's Countdown (4) until the lights change then it's Green (5)).

    There's another value in the PitWindow enum. I think the game uses Unavailable = -1, Disabled = 0, Closed = 1, Open = 2, StopInProgress = 3, Completed = 4. In the example you have Completed = 3 but I see the status change to 3 when I'm waiting in the pit box and then it stays at 4 after I've pitted.

    When you start a sector, the sectorTimeDeltaSelf value for that sector seems to get reset to -1 sometimes, and 0 other times. Not quite sure what to expect - perhaps the game sets this to -1 is there's no previous data for that sector, and 0 if there is previous data for that sector but I'm not sure. I have to code for either value.

    What does EventIndex contain?


    That's all I've found out so far - I've not even looked at any of the other new stuff :)
     
  6. Craig

    Craig Member

    Joined:
    Jul 2, 2015
    Ratings:
    +12 / 0
    Just wondering if there a c version of the updated shared memory struct yet so i don't need to convert the c# one?
     
  7. Mikael Hermansson

    Mikael Hermansson Well-Known Member

    Joined:
    May 3, 2015
    Ratings:
    +47 / 0
    I'm gonna update the GitHub repo with the proper ones soon enough. If you still want the undocumented one though, you can find it here.
     
  8. Craig

    Craig Member

    Joined:
    Jul 2, 2015
    Ratings:
    +12 / 0
    Thanks Mikael
     
  9. Craig

    Craig Member

    Joined:
    Jul 2, 2015
    Ratings:
    +12 / 0
    Do the tire fields in the car damage structure represent tire wear or actual damage to the tire/rim/suspension? The reason i ask is that there is a field for tire_wear_active but no obvious fields for actual tire wear..
     
  10. Mikael Hermansson

    Mikael Hermansson Well-Known Member

    Joined:
    May 3, 2015
    Ratings:
    +47 / 0
    It's tire wear, yeah. Again, documentation is on its way. :)
     
  11. Craig

    Craig Member

    Joined:
    Jul 2, 2015
    Ratings:
    +12 / 0
    Another thing for the request list would be to have wheel speed (rps) per wheel so we can detect lockups and wheel spin, or alternatively a wheel_state which can be normal, locked or slipping for example.
     
  12. Craig

    Craig Member

    Joined:
    Jul 2, 2015
    Ratings:
    +12 / 0
    FYI I'm in the process of making a version of my "pCars Dash" app for Project Cars that will work with R3E. I have got alot of the features from that app working with the new api already, Kjell is helping me test it.
     
    • Like Like x 8
    • Love it! Love it! x 1
  13. Craig

    Craig Member

    Joined:
    Jul 2, 2015
    Ratings:
    +12 / 0
    Ive noticed that when you get a penalty that the api stops outputting the the current lap time (so the time just appears to freeze). At the end of the lap the lap_time_previous_self gets updated to the complete lap time for the invalid lap. Previously it would set it to -1. Preferably the lap timer should continue to count up but there should be some indicator that the lap is invalid such as a lap_invalid = 1 field, or possibly by making the lap delta -1 once the lap goes invalid. At the moment there isnt really any good way to detect invalid laps as previous lap is no longer -1 and the delta's always seem to be -1 (im guessing those aren't implemented yet)
     
  14. Gil Ritter

    Gil Ritter Well-Known Member

    Joined:
    Feb 26, 2015
    Ratings:
    +91 / 0
    Mikael, is it possible to add 'track name' and 'car name/type' in the near future?
     
  15. mr_belowski

    mr_belowski Well-Known Member Beta tester

    Joined:
    Apr 23, 2015
    Ratings:
    +1,283 / 0
    Its already on the list of stuff they're working on.

    As for invalid laps and sectors, I thought the current version put a -1 in for lapTimePrevious if that lap was invalid. I'll have to check it in my app.

    The sector deltas do work but you need 2 consecutive valid times for that sector. I'm using this to work out which sector the players car is in. Not ideal but it does (kind of) work
     
  16. Mikael Hermansson

    Mikael Hermansson Well-Known Member

    Joined:
    May 3, 2015
    Ratings:
    +47 / 0
    We're looking into having some JSON blob for looking up asset IDs hosted on the portal side of things, mainly to help with the spectator overlay stuff. If that comes to fruition then it's likely we'll add car, track, layout, livery and all that stuff to the shared memory. If not, I suppose I could come to terms with adding a couple of statically sized buffer for the string names, coupled with the length of said strings.

    Summer time has rolled in on Sweden though, which means the entire country pretty much shuts down for two months, so don't expect an update in the very near future. :)

    EDIT: Documentation will be in sometime this weekend though!
     
  17. Craig

    Craig Member

    Joined:
    Jul 2, 2015
    Ratings:
    +12 / 0
    It used to set -1 for previous lap, but it no longer does as of the latest patch
     
  18. mr_belowski

    mr_belowski Well-Known Member Beta tester

    Joined:
    Apr 23, 2015
    Ratings:
    +1,283 / 0
    It does in qualifying sessions. Not checked the behaviour in the race, but in qual it sets the currentLap to -1, and when you cross the line it sets the previous lap to -1
     
  19. Craig

    Craig Member

    Joined:
    Jul 2, 2015
    Ratings:
    +12 / 0
    ok i will have to check that. In races it just pauses the current lap time and at the end of the lap the "previous lap" becomes the full lap time from the invalidate lap.

    "S3 delta" is also bugged. It seems to be outputting the overall lap delta relative to the very first lap. "S1 Delta, S2 Delta and Lap Delta" seem about right.
     
  20. mr_belowski

    mr_belowski Well-Known Member Beta tester

    Joined:
    Apr 23, 2015
    Ratings:
    +1,283 / 0
    I must admit to having seen some weird values in these sector deltas - sometimes they're -1, sometimes 0, not sure what the rules are here. I'm currently just using them to make a guess as to what sector the player is currently in but it's a bit hit-and-miss.

    If you do find that the previousLap value is behaving differently when in a race session, can you post on here? I've not got time to check it myself right now but it'd be helpful get a heads-up so I can try and work around it in my app