rfactorLiveData

1. rfactorLiveData Overview

The rfactorLiveData project was designed to have a direct TCP socket connection to the rfactor Internals plugin. A socket is opened when the game is loaded in single player mode or a dedicated server is started. The Socket connection is generic and any client can be written to interface with the server and request messages.

The message data is defined by a configuration file, which enables the user to configure what data they want to recieve. The message request structure is detailed below.


2. Installation

1. Unzip rfactorLiveData-#.#.r#.zip copy rfactorLiveData.dll to /rfactor/Plugins directory
2. copy rfactorLiveData.ini to /rfactor directory
NOTE: if no configuration file is present the plugin will create a default config file, server port is set to 30000 and all message items are set to 0.


3. Messages

Server Request Messages.

RLC = Reload Configuration file. (note: a time limit has been set so this cannot be repeated excessively. ReloadTimerSeconds=1800)
NCS = Number of Clients connected to the rfactorLiveData server.

Scoring Requesting Messages. (Dedicated Server or in Game Server)

NOTE: Not recommended for single user mode.

SGEN = General
SVD1 = Vehicle data 1
SVD2 = Vehicle data 2
SVDA = Vehicle data 1 + Vehicle data 2

Telemetry Requesting Messages. (Single User Mode or in Game Server)

TVD1 = Vehicle data 1
TVD2 = Vehicle data 2
TVDA = Vehicle data 1 + Vehicle data 2

Pit Control. (Single User Mode or in Game Server)

DISPLAY = Changes Vehicle Status Display.
PITREQ = Requests Pit Stop.
MENUUP = Moves up the Pit menu.
MENUDWN = Moves down the Pit menu.
PITINC = Increments value highlighted.
PITDEC = Decrements value highlighted.

Return messages

MSG-HWOK = Recieved a Pit Control Message.
MSG-UKN = Request message unknown.
MSG-NOD = No data found.


4. Message Structure

Scoring Messsages.

Each mesasge is delimeted by a common and terminated by semi-colon.

General Message Example:

0,Toban Raceway Park Short,1,0.0106821,1230,2147483647,2603.79,0,25.9046,24.9825,0,0,0,0;

Vehicle Message Example:

The number before each player name is there place.

1,EnF0rceR,-1,-1,0,-1,-1,-1,1,0,244.132;2,JesterF1,-1,-1,0,-1,-1,-1,1,0,244.132; ......etc

Telemetry Messages.

Each mesasge is delimeted by a common and terminated by semi-colon.

Telemetry Vehicle Data 1 Example: (Brake Temps and Tyre Pressures)

FL,26.8664,125.889,FR,26.8664,125.889,RL,26.8853,125.888,RR,26.8853,125.888;

The messages are configurable as shown below.


5. Configuration File

The configuration file is split into message groups. Other than the parameter ServerPort use 1 = enables data or 0 = disables data for that specific parameter.

Splitting the messages into groups allows the user to configure different polling speeds to get the exact data the require for their application.

[SERVER]


ServerPort=30000

This is the port number that the client will connect. The default port is 30000.
NOTE: You will need to open this port on any firewall.


MaxConnections=10

Maximum number of client able to connect to the server.


ReloadTimerSeconds=1800

The number of seconds before a config file reload can be completed.


[SCOREGENERAL]


GamePhase

0 Before session has begun
1 Reconnaissance laps (race only)
2 Grid walk-through (race only)
3 Formation lap (race only)
4 Starting-light countdown has begun (race only)
5 Green flag
6 Full course yellow / safety car
7 Session stopped
8 Session over


TrackName


Session

1 = Practice1
2 = Practice2
3 = Practice3
4 = Practice4
5 = Qualify
6 = WarmUp
7 = Race


CurrentTime


EndTime


MaxLaps


LapDist


NumVehicles


Temperatures

Ambient Temperature
Track Temperature


FlagState

Yellow flag states (applies to full-course only)
-1 Invalid
0 None
1 Pending
2 Pits closed
3 Pit lead lap
4 Pits open
5 Last lap
6 Resume
7 Race halt (not currently used)


FlagSector

whether there are any local yellows at the moment in each sector
Sector 1 Flag State
Sector 2 Flag State
Sector 3 Flag State

[SCOREVEHICLEDATA_#] (note: # = 1 or 2 )


There Place and player name will the start of the message.

All times have units of seconds, if the data is not present a -1 will be returned.


VehicleName

SectorTimes

Current Sector 1 Time
Current Sector 2 Time (plus sector 1) if valid


LastSectorTimes

Last Sector 1 Time
Last Sector 2 Time (plus sector 1)
Last Lap Time


BestSector

Best Sector 1 time
Best Sector 2 time (plus sector 1)
Best Lap Time


TotalLaps


LapDist


InPits


PitStops


Penalities

Number of Penalities a driver has outstanding.


TimeBehindNext


TimeBehindLeader


LapsBehindNext


LapsBehindLeader


FinishStatus

0 None
1 Finished
2 DNF
3 DQ

VehiclePitchDeg


VehicleRollDeg


VehicleSpeedKPH


VehiclePosition

X Y Z position information.


[TELEMVEHICLEDATA_#] (note: # = 1 or 2 )


VehicleDeltaTime


VehicleLapStart


VehicleName

TrackName

VehicleLaps


VehicleScheduledStops


VehicleDamage

8 Values are displayed, the order is as follows:
0 Front
1 Front Left
2 Side Left
3 Rear Left
4 Rear
5 Rear Right
6 Side Right
7 Front Right
0 = None 1 = Some 2 = More


VehiclePedalPos

Brake (range 0 to 100.0)
Clutch (range 0 to 100.0)
Throttle (range 0 to 100.0)
Steering (range -100 to 100.0)
Streering Arm Force


VehicleOverTempFlag


VehicleFuel


VehicleGear

-1=reverse, 0=neutral, 1+=forward gears


VehicleEngine

Clutch RPM
Engine Max RPM
Engine Oil Temperature
Engine RPM
Engine Water Temperature


VehicleImpact

Last Impact ET
Last Impact Magnitude
Impact Position X Y Z


VehiclePitchDEG

Converted to Degrees


VehicleRollDEG

Converted to Degrees


VehicleSpeedKPH

Converted to KPH


VehiclePosition

X Y Z


WheelRotation


WheelSuspension

Suspension Deflection
Ride Height


TireLoad

Tire Load
Lateral Force
Grip Fraction


BrakeTemp

Brake Temps (Degrees C)
Tyre Pressure (Kpa)


TireTemp

Left Temperature (Degrees C)
Center Temperature (Degrees C)
Right Temperature (Degrees C)


TireDamage

Detatched
Flat


TireWear


TireSurface

Surface Type (0=dry, 1=wet, 2=grass, 3=dirt, 4=gravel, 5=rumblestrip)
Terrian Name (the material prefixes from the TDF file)



6. Customising Vehicle Data Messages


[SCOREVEHICLEDATA_1] and [SCOREVEHICLEDATA_2] and/or [TELEMVEHICLEDATA_1] and [TELEMVEHICLEDATA_2] parameters can be moved around between themselves to construct a full configurable message.

The order of vehicle data is listed above, this will be the order of how the message is sent.

Example:

Shown below is the default config file:


Shown Below we connect to the server and ask for VD1 and VD2 which is how the data is listed in the above config file.


Say we want to move the last 7 parameters into VEHICLE_1 message, cut and paste the parameters as shown below.


Restart rfactor Server and Connect to the server, ask for VD1 and VD2 and you can see that the messages have change with the new data.


7. Download

You can download the latest version from the Links-->Release or click here.

rfactorPitcontrol is written in C# and may required .NET 3.5 can download here

May require the redistributable package to be istall can download here


8. Known Issues


1. If you are writting a Java Applet to do the connection, you will be required to sign the Applet before it can make a connection to the server.

2. Be aware that configuring all values with large number of vehicles will produce a large messge, make sure you allow enough bytes to receive the data else the messge will be truncated.