Shared Memory API

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

  1. Robert Holm

    Robert Holm KW Studios Developer

    Joined:
    Jan 15, 2015
    Ratings:
    +162 / 0 / -0
    Wondering how you guys want the sector delta times to work, for example sector_time_delta_self[3]?

    Should it be current lap sector times vs previous lap sector times? If so, and car for example is in sector 2, should I set deltas for sector 2 and 3 to -1.0?

    Or should it be previous lap sector times vs the lap before that?
     
  2. Stefan Mizzi

    Stefan Mizzi Well-Known Member

    Joined:
    Feb 6, 2015
    Ratings:
    +625 / 0 / -0
    I never use delta sector times in my apps so I'll let the others comment.

    Though I just noticed that you have sector_time_previous_self[3] and not sector_time_current_self[3].

    Does that mean you'll output the sectors of the previous lap or its just a naming issue and sectors will be or current lap?

    Thanks!
     
  3. mr_belowski

    mr_belowski Well-Known Member Beta tester

    Joined:
    Apr 23, 2015
    Ratings:
    +1,307 / 0 / -0
    Would it be easier to just have the most recent sector times for each car (including the player)? These are -1 at the start of the session but after that they get updated as the car crosses the relevant sector line. Perhaps they might get set to -1 if that sector was invalid.

    Then if client apps want to do stuff with sector deltas (delta self, delta leader, delta best lap, etc) it's up to the client app to maintain the required state and do the maths.

    It gets really messy if you're trying to second guess what the client apps might want to do with the sector data
     
  4. le_poilu

    le_poilu Well-Known Member

    Joined:
    Jan 30, 2015
    Ratings:
    +278 / 0 / -0
    Usually we need to compare Sector time from a lap to another Lap, mostly the best one.

    There you can have 2 differents way:
    Compare the sector time to the best sector time
    Compare the sector to the same sector on the best lap (sector time might not be the best overall, but it's the one done while doing the best lap time)

    I think we don't really need mote than current sector time and best sectore time (best sector or best lap sector). Maybe if you can have previous one it's also a good thing.
    From that, every app should be able to keep a record of all sector times.
     
  5. Robert Holm

    Robert Holm KW Studios Developer

    Joined:
    Jan 15, 2015
    Ratings:
    +162 / 0 / -0
    I went with this change:

    typedef struct
    {
    r3e_driver_info driver_info;
    r3e_finish_status finish_status;
    r3e_int32 place;
    r3e_float32 lap_distance;
    r3e_vec3_f32 position;
    r3e_int32 track_sector;
    r3e_int32 completed_laps;
    r3e_int32 current_lap_valid;
    r3e_float32 lap_time_current_self;
    r3e_float32 sector_time_current_self[3];
    r3e_float32 sector_time_previous_self[3];
    r3e_float32 sector_time_best_self[3];
    r3e_float32 time_delta_front;
    r3e_float32 time_delta_behind;
    r3e_pitstop_status pitstop_status;
    r3e_int32 in_pitlane;
    r3e_int32 num_pitstops;
    r3e_cut_track_penalties penalties;
    r3e_float32 car_speed;
    r3e_int32 tire_type;
    } r3e_driver_data_1;

    sector_time_current_self[2] will always be -1 though, since the instant you cross finishline it's not the current lap anymore :)
    from these you can calc deltas yourself. also added:

    // Sector times of fastest lap by anyone in session
    r3e_float32 session_best_lap_sector_times[3];
     
    • Like Like x 2
  6. Stefan Mizzi

    Stefan Mizzi Well-Known Member

    Joined:
    Feb 6, 2015
    Ratings:
    +625 / 0 / -0
    Awesome!!! Thanks mate :)
     
  7. le_poilu

    le_poilu Well-Known Member

    Joined:
    Jan 30, 2015
    Ratings:
    +278 / 0 / -0
    No best lap value ?
     
  8. Robert Holm

    Robert Holm KW Studios Developer

    Joined:
    Jan 15, 2015
    Ratings:
    +162 / 0 / -0
    There is r3e_float32 sector_time_best_self[3] for every car,
    and there is r3e_float32 session_best_lap_sector_times[3] for the best lap set by any car.
    You miss something else?
     
  9. le_poilu

    le_poilu Well-Known Member

    Joined:
    Jan 30, 2015
    Ratings:
    +278 / 0 / -0
    Ok, didn't saw that ;)
     
    • Like Like x 1
  10. rbn

    rbn Well-Known Member

    Joined:
    May 31, 2015
    Ratings:
    +69 / 0 / -0
    [shame mode]
    Jeez, I searched a few pages back, but its only one post above mine....
    [/shame mode]

    Anyway good to see a lot of stuff being added to the api.
    I can use the pit-limiter option for my Arduino sli dash.
     
    • Like Like x 1
  11. Phyllip Hardt

    Phyllip Hardt New Member

    Joined:
    Jul 14, 2015
    Ratings:
    +1 / 0 / -0
    Hello,
    I have two questions,
    1- how can I get the track name the pilot's name and the car that the player is running.
    2 is possible to use to get the Dedicaded Server data?

    Thank you so much!
     
    • Like Like x 1
  12. Robert Holm

    Robert Holm KW Studios Developer

    Joined:
    Jan 15, 2015
    Ratings:
    +162 / 0 / -0
    1.) For all those id's we'll supply, we need to add look up tables for. Name will be a string.
    2.) Not sure what you mean.
     
    • Like Like x 1
  13. Robert Holm

    Robert Holm KW Studios Developer

    Joined:
    Jan 15, 2015
    Ratings:
    +162 / 0 / -0
    Added this as well for current vehicle (when applicable):

    typedef struct
    {
    r3e_int32 available;
    r3e_int32 engaged;
    r3e_int32 amount_left;
    r3e_float32 engaged_time_left;
    r3e_float32 wait_time_left;
    } r3e_push_to_pass;
     
    • Like Like x 1
  14. Zappadoc

    Zappadoc New Member

    Joined:
    Jun 29, 2015
    Ratings:
    +3 / 0 / -0
    WOW!, I wanted to thank you sincerely for the upcoming update of the API!
    The new API is an huge step and was really needed to increase the gaming experience and immersion of racers using simracing rig! Impatient to make the update of the plugin for SLIMax Manager. ;)
    Cheers,
    Zappadoc
     
    • Like Like x 1
  15. le_poilu

    le_poilu Well-Known Member

    Joined:
    Jan 30, 2015
    Ratings:
    +278 / 0 / -0
    I think he would like to get the same datas from Dedicated server.
    Those who don't run the game, so don't have access to the live datas.
     
    • Like Like x 1
  16. Robert Holm

    Robert Holm KW Studios Developer

    Joined:
    Jan 15, 2015
    Ratings:
    +162 / 0 / -0
    I've now added support for dedi to write to shared mem, but consider it unofficially. Much less data exists in dedi, so many entries will remain -1. But there is the important stuff, track/layout id's, tracklength, bestlaptime and then all data for each driver.
     
    • Like Like x 2
    • Winner Winner x 1
    • Wonderful Wonderful x 1
  17. mr_belowski

    mr_belowski Well-Known Member Beta tester

    Joined:
    Apr 23, 2015
    Ratings:
    +1,307 / 0 / -0
    While you've got the shared memory stuff in bits, could you have a quick look at the oil and water temps? I think the problem is with the game, rather than the shared memory, but these values tend to be quite low for some cars (like, oil is about 50 Celsius after a few hard laps in the gt2 ruf).
     
  18. J-F Chardon

    J-F Chardon KW Studios Developer

    Joined:
    Jan 15, 2015
    Ratings:
    +5,041 / 0 / -0
    I think you're right there, it's probably the values fed in the game that should be double checked. We will have a look at what can be done for that.
     
    • Like Like x 1
  19. le_poilu

    le_poilu Well-Known Member

    Joined:
    Jan 30, 2015
    Ratings:
    +278 / 0 / -0

    Nice.
    Now we'll only need a little app that can read this datas.
    Thanks
     
  20. Gil Ritter

    Gil Ritter Well-Known Member

    Joined:
    Feb 26, 2015
    Ratings:
    +91 / 0 / -0
    Robert, these are really great news. When can we expect this feature?