Author Topic: Output plugins  (Read 4309 times)

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2190
    • View Profile
Output plugins
« 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 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.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2190
    • View Profile
Re: Output plugins
« Reply #1 on: December 15, 2013, 11:16:02 PM »
Example source code updated to the latest interface.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2190
    • View Profile
Re: Output plugins
« Reply #2 on: June 25, 2014, 09:48:03 AM »
Example source code updated to the latest interface.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2190
    • View Profile
Re: Output plugins
« Reply #3 on: May 25, 2015, 12:36:47 PM »
Example source code updated to the latest interface.

HornetMaX

  • Hero Member
  • *****
  • Posts: 5588
    • View Profile
Re: Output plugins
« Reply #4 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.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2190
    • View Profile
Re: Output plugins
« Reply #5 on: October 14, 2015, 06:15:11 PM »

Example source code updated to the latest interface.

HornetMaX

  • Hero Member
  • *****
  • Posts: 5588
    • View Profile
Re: Output plugins
« Reply #6 on: October 14, 2015, 09:15:10 PM »
An inconsistency I've found (maybe limited to the comments:

In SPluginsCarSession_t definition we have:
Code: [Select]
int m_iSession; /* testing: always 0. Race: 0 = waiting; 1 = practice; 2 = qualify; 3 = warmup; 4 = race */
While in SPluginsRaceSession_t we have:
Code: [Select]
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 2190
    • View Profile
Re: Output plugins
« Reply #7 on: October 14, 2015, 09:23:36 PM »
An inconsistency I've found (maybe limited to the comments:

In SPluginsCarSession_t definition we have:
Code: [Select]
int m_iSession; /* testing: always 0. Race: 0 = waiting; 1 = practice; 2 = qualify; 3 = warmup; 4 = race */
While in SPluginsRaceSession_t we have:
Code: [Select]
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

RiccoChicco

  • Sr. Member
  • ****
  • Posts: 423
  • Bultaco lover
    • View Profile
Re: Output plugins
« Reply #8 on: October 14, 2015, 09:42:08 PM »
The best programmer I ever worked with once said: "99% of the bugs are due to cut & paste"  ;D

True story  ;D

HornetMaX

  • Hero Member
  • *****
  • Posts: 5588
    • View Profile
Re: Output plugins
« Reply #9 on: October 14, 2015, 09:43: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

  • Administrator
  • Hero Member
  • *****
  • Posts: 2190
    • View Profile
Re: Output plugins
« Reply #10 on: October 14, 2015, 10:07:43 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?

HornetMaX

  • Hero Member
  • *****
  • Posts: 5588
    • View Profile
Re: Output plugins
« Reply #11 on: October 14, 2015, 10:30:40 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:

Code: [Select]
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

  • Hero Member
  • *****
  • Posts: 5588
    • View Profile
Re: Output plugins
« Reply #12 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:
  • No calls to EventInit and TrackCenterline
  • The data passed to RaceVehicleData is wrong/incompleted (as reported above)

MaX.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2190
    • View Profile
Re: Output plugins
« Reply #13 on: October 21, 2015, 11:10:48 PM »

Example source code updated to the latest interface.

HornetMaX

  • Hero Member
  • *****
  • Posts: 5588
    • View Profile
Re: Output plugins
« Reply #14 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.