PiBoSo Official Forum

World Racing Series => Mods => Plugins => Topic started by: PiBoSo on February 17, 2013, 06:19:35 PM

Title: Output plugins
Post by: PiBoSo on February 17, 2013, 06:19:35 PM
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.
Title: Re: Output plugins
Post by: PiBoSo on December 15, 2013, 11:16:02 PM
Example source code updated to the latest interface.
Title: Re: Output plugins
Post by: PiBoSo on June 25, 2014, 09:48:03 AM
Example source code updated to the latest interface.
Title: Re: Output plugins
Post by: PiBoSo on May 25, 2015, 12:36:47 PM
Example source code updated to the latest interface.
Title: Re: Output plugins
Post by: HornetMaX on July 25, 2015, 09:13:05 PM
@Piboso: in SPluginsCarData_t, what are the materials that correspond to m_aiWheelMaterial ?
0 = not in contact, but the others ?

MaX.
Title: Re: Output plugins
Post by: PiBoSo on October 14, 2015, 06:15:11 PM

Example source code updated to the latest interface.
Title: Re: Output plugins
Post by: 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.
Title: Re: Output plugins
Post by: PiBoSo on October 14, 2015, 09:23:36 PM
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
Title: Re: Output plugins
Post by: RiccoChicco on October 14, 2015, 09:42:08 PM
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
Title: Re: Output plugins
Post by: HornetMaX on October 14, 2015, 09:43:36 PM
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.
Title: Re: Output plugins
Post by: 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).

MaX.

What data do you get?
Title: Re: Output plugins
Post by: HornetMaX on October 14, 2015, 10:30:40 PM
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?

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.
Title: Re: Output plugins
Post by: HornetMaX on October 16, 2015, 07:08:58 PM
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:

MaX.
Title: Re: Output plugins
Post by: PiBoSo on October 21, 2015, 11:10:48 PM

Example source code updated to the latest interface.
Title: Re: Output plugins
Post by: HornetMaX on October 22, 2015, 08:31:17 AM
Had a quick look (I'm on vacation for a week), it seems exactly what was needed, thanks.

MaX.
Title: Re: Output plugins
Post by: PiBoSo on December 09, 2015, 09:54:04 PM

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.
Title: Re: Output plugins
Post by: HornetMaX on December 09, 2015, 10:16:17 PM
Makes sense. Thx for adding m_fTrackPos, it will be useful !
Title: Re: Output plugins
Post by: PiBoSo on September 06, 2016, 01:07:28 PM

Example source code updated to the latest interface.
Title: Re: Output plugins
Post by: PiBoSo on October 01, 2016, 02:10:25 PM

Example source code updated to fix a couple comments about penalties.
Title: Re: Output plugins
Post by: PiBoSo on November 22, 2016, 08:29:26 PM

Example source code updated to the latest interface.
Removed the "semaphore" session state only.
Title: Re: Output plugins
Post by: PiBoSo on February 17, 2017, 10:42:12 AM

Example source code updated to the latest interface.
Title: Re: Output plugins
Post by: 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 ?
Title: Re: Output plugins
Post by: PiBoSo on February 17, 2017, 09:13:16 PM
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.
Title: Re: Output plugins
Post by: 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 ?

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 ?
Title: Re: Output plugins
Post by: PiBoSo on February 18, 2017, 10:44:10 AM
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.
Title: Re: Output plugins
Post by: HornetMaX on February 18, 2017, 11:16:46 AM
Thanks a lot for the infos !
Title: Re: Output plugins
Post by: PiBoSo on July 05, 2018, 10:03:15 PM

Example source code updated to the latest interface.
Title: Re: Output plugins
Post by: PiBoSo on July 05, 2018, 10:05:26 PM

Please note that, starting with Beta13, output plugins must be compiled for 64 bit.