PDA

View Full Version : New additions to shared memory and UDP data



mr_belowski
30-11-2017, 10:15
All,

One of the SMS development crew was kind enough to share some information about the API changes in patch 1.3 last week. I was hoping that these changes would have been formally documented now but this doesn't appear to be the case. So this post is to pass on the information I received.

Before I start, please understand this this isn't official documentation and reflects the state of the API changes before the patch went live, so there's a chance that something is out of date. I'm also aware that I'm passing on information that wasn't intended (at the time) to be public. But as we've had no other documentation I feel compelled to do this to allow other app developers to make their apps compatible with patch 1.3. I will remove this post immediately if requested to do so, or when SMS update their documentation.



Changes to Shared memory in Patch 3

* bumped shared memory version to 9
* added brake bias field
* added Turbo boost pressure field
* Added tyre compound names for viewed participant
* Added pit schedules for all participants
* Added highest flag colours and reasons for all participants
* Added participant nationalities
* Added snow density field

These are added after mTranslatedTrackVariation, so the end of the struct now looks like this:

int mEnforcedPitStopLap; // [ UNITS = in which lap there will be a mandatory pitstop] [ RANGE = 0.0f->... ] [ UNSET = -1 ]
char mTranslatedTrackLocation[STRING_LENGTH_MAX]; // [ string ]
char mTranslatedTrackVariation[STRING_LENGTH_MAX]; // [ string ]
float mBrakeBias; // [ RANGE = 0.0f->1.0f... ] [ UNSET = -1.0f ]
float mTurboBoostPressure; // RANGE = 0.0f->1.0f... ] [ UNSET = -1.0f ]
char mTyreCompound[TYRE_MAX][TYRE_COMPOUND_NAME_LENGTH_MAX];// [ strings ]
unsigned int mPitSchedules[STORED_PARTICIPANTS_MAX]; // [ enum (Type#7) Pit Mode ]
unsigned int mHighestFlagColours[STORED_PARTICIPANTS_MAX]; // [ enum (Type#5) Flag Colour ]
unsigned int mHighestFlagReasons[STORED_PARTICIPANTS_MAX]; // [ enum (Type#6) Flag Reason ]
unsigned int mNationalities[STORED_PARTICIPANTS_MAX]; // [ nationality table , SP AND UNSET = 0 ]
float mSnowDensity; // [ UNITS = How much snow will fall ] [ RANGE = 0.0f->1.0f ], this will be non zero only in Snow season, in other seasons whatever is falling from the sky is reported as rain

TYRE_COMPOUND_NAME_LENGTH_MAX is 40

The nationalities data is in a separate lookup table which I can provide if necessary.



Changes to UDP in patch 3:

Please note I've not tested these changes or integrated them into my app, and this information is a combination of what was sent to me and my own correction for the addition of sLocalParticipantIndex to sTimingsData


* sTelemetryData now contains new fields sTurboBoostPressure, sFullPosition ( position of the viewed participant with full precision) and sBrakeBias
* sParticipantsData now contains sNationality field for participants and session unique sIndex for each participant for better pairing in MP races
* sParticipantStatsInfo now contains sParticipantOnlineRep for each participant and sMPParticipantIndex ( matching sIndex from sParticipantsData) in the participant data
* sParticipantInfo now have sMPParticipantIndex ( matching sIndex from sParticipantsData) in the participant data, and sLocalParticipantIndex which identifies which of the participants is the local player
* sTimingsData now have sLocalParticipantIndex which identifies which of the participants is the local player. I don't know how this works


So the end of sTelemetryData now looks like this:

unsigned int sJoyPad0; // 376 4
unsigned char sDPad; // 377 1
char sTyreCompound[4][TYRE_NAME_LENGTH_MAX]; // 378 160
float sTurboBoostPressure; // 538 4
float sFullPosition[3]; // 542 12 -- position of the viewed participant with full precision
unsigned char sBrakeBias; // 554 1 -- quantized brake bias


sParticipantsData now looks like this:

struct sParticipantsData
{
static const unsigned int sPacketSize = 1136;
PacketBase sBase; // 0 12
unsigned int sParticipantsChangedTimestamp; // 12 4
char sName[PARTICIPANTS_PER_PACKET][PARTICIPANT_NAME_LENGTH_MAX];// 16 1024
unsigned int sNationality[PARTICIPANTS_PER_PACKET]; // 1040 64
unsigned short sIndex[PARTICIPANTS_PER_PACKET]; // 1104 32 -- session unique index for MP races
};


sParticipantStatsInfo now looks like this

struct sParticipantStatsInfo
{
float sFastestLapTime; // 0
float sLastLapTime; // 4
float sLastSectorTime; // 8
float sFastestSector1Time; // 11
float sFastestSector2Time; // 16
float sFastestSector3Time; // 20
unsigned int sParticipantOnlineRep; // 24 (u16 rank type + u16 strength, 0 in SP races)
unsigned short sMPParticipantIndex; // 28 -- matching sIndex from sParticipantsData
};



sParticipantInfo now looks like this

struct sParticipantInfo
{
signed short sWorldPosition[3]; // 0 --
signed short sOrientation[3]; // 6 -- Quantized heading (-PI .. +PI) , Quantized pitch (-PI / 2 .. +PI / 2), Quantized bank (-PI .. +PI).
unsigned short sCurrentLapDistance; // 12 --
unsigned char sRacePosition; // 14 -- holds the race position, + top bit shows if the participant is active or not
unsigned char sSector; // 15 -- sector + extra precision bits for x/z position
unsigned char sHighestFlag; // 16 -- (enum 3 bits/enum 2 bits) Flag colour and reason
unsigned char sPitModeSchedule; // 17 -- (enum 3 bits/enum 2 bits) Pit mode and Pit schedule
unsigned short sCarIndex; // 18 -- top bit shows if participant is (local or remote) human player or not
unsigned char sRaceState; // 20 -- race state flags + invalidated lap indication --
unsigned char sCurrentLap; // 21 --
float sCurrentTime; // 22 --
float sCurrentSectorTime; // 26 --
unsigned short sMPParticipantIndex; // 30 -- matching sIndex from sParticipantsData
};


sTimingsData now looks like this

struct sTimingsData
{
static const unsigned int sPacketSize = 1059;
PacketBase sBase; // 0 12
signed char sNumParticipants; // 12 --
unsigned int sParticipantsChangedTimestamp; // 13 --
float sEventTimeRemaining; // 17 // time remaining, -1 for invalid time, -1 - laps remaining in lap based races --
float sSplitTimeAhead; // 21 --
float sSplitTimeBehind; // 25 --
float sSplitTime; // 29 --
sParticipantInfo sPartcipants[UDP_STREAMER_PARTICIPANTS_SUPPORTED]; // 33 1024
unsigned short sLocalParticipantIndex; // 1057 -- identifies which of the MP participants is the local player
};