It is possible to write a DLL that receives data from the simulated car in realtime.
Example source code can be downloaded at http://www.worldracingseries.net/?page=downloads
Please note that all function calls are blocking, so control should be returned to simulation as soon as possible to avoid framerate issues.
The DLL must be compiled for 64 bit.
The plugin must have the file extension renamed to DLO and it must be copied to the "wrs/plugins" directory in World Racing Series installation folder.
NOTE: a license is not needed to add plugins.
Example source code updated to the latest interface.
Example source code updated to the latest interface.
Example source code updated to the latest interface.
@Piboso: in SPluginsCarData_t, what are the materials that correspond to m_aiWheelMaterial ?
0 = not in contact, but the others ?
MaX.
Example source code updated to the latest interface.
An inconsistency I've found (maybe limited to the comments:
In SPluginsCarSession_t definition we have:
int m_iSession; /* testing: always 0. Race: 0 = waiting; 1 = practice; 2 = qualify; 3 = warmup; 4 = race */
While in SPluginsRaceSession_t we have:
int m_iSession; /* testing: always 0. Race: 0 = waiting; 1 = practice; 2 = qualify; 3 = pre-final; 4 = final */
Tempted to say it's just a comment bug (and the 1st comment is the correct of the two). Right ?
MaX.
Quote from: HornetMaX on October 14, 2015, 09:15:10 PM
An inconsistency I've found (maybe limited to the comments:
In SPluginsCarSession_t definition we have:
int m_iSession; /* testing: always 0. Race: 0 = waiting; 1 = practice; 2 = qualify; 3 = warmup; 4 = race */
While in SPluginsRaceSession_t we have:
int m_iSession; /* testing: always 0. Race: 0 = waiting; 1 = practice; 2 = qualify; 3 = pre-final; 4 = final */
Tempted to say it's just a comment bug (and the 1st comment is the correct of the two). Right ?
MaX.
The first comment is the correct one.
The best programmer I ever worked with once said: "99% of the bugs are due to cut & paste" ;D
Quote from: PiBoSo on October 14, 2015, 09:23:36 PM
The best programmer I ever worked with once said: "99% of the bugs are due to cut & paste" ;D
True story ;D
Quote from: PiBoSo on October 14, 2015, 09:23:36 PM
The best programmer I ever worked with once said: "99% of the bugs are due to cut & paste" ;D
:)
I've spotted another strange behaviour:
RaceVehicleData is called both while on track and during replays (yeah baby !), but the passed data is OK while on track but not OK during replays (not even the car number is set properly).
MaX.
Quote from: HornetMaX on October 14, 2015, 09:43:36 PM
I've spotted another strange behaviour: RaceVehicleData is called both while on track and during replays (yeah baby !), but the passed data is OK while on track but not OK during replays (not even the car number is set properly).
MaX.
What data do you get?
Quote from: PiBoSo on October 14, 2015, 10:07:43 PM
Quote from: HornetMaX on October 14, 2015, 09:43:36 PM
I've spotted another strange behaviour: RaceVehicleData is called both while on track and during replays (yeah baby !), but the passed data is OK while on track but not OK during replays (not even the car number is set properly).
What data do you get?
- iRaceNum seems always zero (instead of proper car number).
- iGear seems always zero.
- The other seems OK (tested with 1 car only, so ...).
They are both fine when
RaceVehicleData is called "on track".
Another weirdness (already discussed here (http://forum.kartracing-pro.com/index.php?topic=5477.0) for KRP):
In
SPluginsRaceEvent_t we have:
int m_iType; /* 0 = testing; 1 = race */
But it seems that while testing, iType is at 1 (which agrees with your comment in KRP forum, i.e. "testing -> 1; race -> 2; challenge -> 4").
MaX.
Damn, I figured out most of it.
I was using a
saved replay. Loading it from the main menu, without ever going to track leads to two issues:
- No calls to EventInit and TrackCenterline
- The data passed to RaceVehicleData is wrong/incompleted (as reported above)
MaX.
Example source code updated to the latest interface.
Had a quick look (I'm on vacation for a week), it seems exactly what was needed, thanks.
MaX.
Example source code updated to the latest interface.
The only change is the addition of m_fTrackPos to SPluginsRaceTrackPosition_t
Since this structure was probably still unused, no changes have been made to version checking, to preserve compatibility.
Makes sense. Thx for adding m_fTrackPos, it will be useful !
Example source code updated to the latest interface.
Example source code updated to fix a couple comments about penalties.
Example source code updated to the latest interface.
Removed the "semaphore" session state only.
Example source code updated to the latest interface.
Quote from: PiBoSo on February 17, 2017, 10:42:12 AM
Example source code updated to the latest interface.
Thanks. Any special logic with the invalid lap indicator ? 0 = valid, anything else = invalid ?
Also, I think before the laptime was zero (or negative) for invalid laps: has this changed ?
Quote from: HornetMaX on February 17, 2017, 11:05:04 AM
Quote from: PiBoSo on February 17, 2017, 10:42:12 AM
Example source code updated to the latest interface.
Thanks. Any special logic with the invalid lap indicator ? 0 = valid, anything else = invalid ?
Also, I think before the laptime was zero (or negative) for invalid laps: has this changed ?
During testing and practice sessions, an invalid lap is still reset to zero.
During races, invalid laps are marked with m_iInvalid set to 1.
Quote from: PiBoSo on February 17, 2017, 09:13:16 PM
During testing and practice sessions, an invalid lap is still reset to zero.
During quali too I guess, right ?
Quote from: PiBoSo on February 17, 2017, 09:13:16 PM
During races, invalid laps are marked with m_iInvalid set to 1.
So you will have a positive m_iLapTime (not zeroed out) but m_iInvalid set to 1 ?
And will the invalid lap count in the race ? I mean, I've done 4 laps, 6 to go. If my 5th lap is invalid, do I still have 6 laps to go ?
Also how does one triggers an invalid lap in a race ? Missing a checkpoint ?
Quote from: HornetMaX on February 17, 2017, 10:07:12 PM
Quote from: PiBoSo on February 17, 2017, 09:13:16 PM
During testing and practice sessions, an invalid lap is still reset to zero.
During quali too I guess, right ?
Right.
Quote
Quote from: PiBoSo on February 17, 2017, 09:13:16 PM
During races, invalid laps are marked with m_iInvalid set to 1.
So you will have a positive m_iLapTime (not zeroed out) but m_iInvalid set to 1 ?
And will the invalid lap count in the race ? I mean, I've done 4 laps, 6 to go. If my 5th lap is invalid, do I still have 6 laps to go ?
Yes.
Yes, it will count for the race, but a time penalty will be added.
Quote
Also how does one triggers an invalid lap in a race ? Missing a checkpoint ?
Yes, missing a checkpoint.
The lap is not registered at all if a split or the speedtrap are missed.
Thanks a lot for the infos !
Example source code updated to the latest interface.
Please note that, starting with Beta13, output plugins must be compiled for 64 bit.