• Welcome to PiBoSo Official Forum. Please login or sign up.
 
May 25, 2019, 11:02:17 pm

News:

World Racing Series beta14 available! :)


Output plugins

Started by PiBoSo, February 17, 2013, 06:19:35 pm

Previous topic - Next topic

PiBoSo

February 17, 2013, 06:19:35 pm Last Edit: July 05, 2018, 10:04:55 pm by PiBoSo
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.
"Obviously your ambition outweighs your talent".

PiBoSo

Example source code updated to the latest interface.
"Obviously your ambition outweighs your talent".

PiBoSo

Example source code updated to the latest interface.
"Obviously your ambition outweighs your talent".

PiBoSo

Example source code updated to the latest interface.
"Obviously your ambition outweighs your talent".

HornetMaX

@Piboso: in SPluginsCarData_t, what are the materials that correspond to m_aiWheelMaterial ?
0 = not in contact, but the others ?

MaX.

PiBoSo


Example source code updated to the latest interface.
"Obviously your ambition outweighs your talent".

HornetMaX

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.

PiBoSo

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
"Obviously your ambition outweighs your talent".

RiccoChicco

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

HornetMaX

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.

PiBoSo

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?
"Obviously your ambition outweighs your talent".

HornetMaX

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 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.

HornetMaX

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.

PiBoSo


Example source code updated to the latest interface.
"Obviously your ambition outweighs your talent".

HornetMaX

Had a quick look (I'm on vacation for a week), it seems exactly what was needed, thanks.

MaX.