UDP Output Setup

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Setting up UDP output for DiRT 4

June 6, 2017
Contents

1 Overview 2

2 D-BOX 3
2.1 Config Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3 UDP 4
3.1 Config Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

4 Custom UDP 5
4.1 Config Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.2 XML Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.3 Available Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

5 Fanatec 13
5.1 Config Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

6 Appendix 1: Custom UDP for UDP mode 0 14

7 Appendix 1: Custom UDP for UDP mode 1 15

8 Appendix 1: Custom UDP for UDP mode 2 16

9 Appendix 1: Custom UDP for UDP mode 3 18

1
1 Overview

Most of Codemasters racing titles export telemetry data from the players vehi-
cle in order to support 3rd party motion platforms, telemetry applications and
steering devices. Over the years, the number of export formats has grown. This
document aims to describe the legacy data formats exported from games such
as DiRT Rally and Grid 2.

There have also been additions for DiRT 4 which should open up the telemetry
export for a wider range of 3rd party applications, which will be outlined later.

The motion platform setup can be found in the %userprofile%\Documents\


My Games\DiRT 4\hardwaresettings\hardware_settings_config.xml, which
will contain the XML extract below.
<hardware_settings_config version="..." deviceId="...">
.
.
<motion_platform>
<dbox
enabled="false" />
<udp
enabled="false"
extradata="0"
ip="127.0.0.1"
port="20777"
delay="1" />
<custom_udp
enabled="false"
filename="example_udp_channel_data.xml"
ip="127.0.0.1"
port="20777"
delay="1" />
<fanatec
enabled="false"
pedalVibrationScale="1.0"
wheelVibrationScale="1.0"
ledTrueForGearsFalseForSpeed="true" />
</motion_platform>
.
.
</hardware_settings_config>

2
2 D-BOX

2.1 Config Setup

To enable exporting to D-BOX, simply set enabled to true in the dbox XML tag.
<dbox enabled="true" />

Ensure you have the latest motion codes from D-BOX. Motion codes and drivers
can be downloaded at their website at

http://www.d-box.com/corporate-page/downloads/

3
3 UDP

3.1 Config Setup

UDP data is probably the primary way of getting telemetry data from the game,
and almost certainly the least understood.

It is possible to export to multiple devices by simply adding more instances of the


udp tag, for example

<motion_platform>
<udp enabled="true" extradata="0" ip="...." port="20777" delay="1" />
<udp enabled="true" extradata="0" ip="...." port="20888" delay="1" />
<udp enabled="true" extradata="2" ip="...." port="20999" delay="1" />
</motion_platform>

The tag attributes are:

enabled

Set to true to enable the UDP export to this IP/port, false otherwise.

extradata

The network packet type to export. 0 for LiveForSpeed compatible pack-


ets, 1-3 for other packets. (Detailed descriptions of all existing packet for-
mats are included at the end of this document.)

ip

The 32-bit numeric IP address to export the data to.

port

The port number to export the data to.

delay

The delay between network packets, measured in 1/100th of a second.

4
4 Custom UDP

To improve the flexibility of the system, custom UDP data packets can now be
defined, enabling 3rd parties to be more selective about the telemetry channels
they are interested in. The behaviour is exactly the same as the legacy UDP
options, and examples of how to replicate the legacy UDP data packets with
the new system can be found at the end of this document.

4.1 Config Setup

As with UDP, multiple ports can be exported to by adding more custom udp tags
to the settings.

The tag attributes are:

enabled

Set to true to enable the UDP export to this IP/port, false otherwise.

filename

The XML filename within the motionplatforms folder which contains the net-
work packet format.

ip

The 32-bit numeric IP address to export the data to.

port

The port number to export the data to.

delay

The delay between network packets, measured in 1/100th of a second.

5
4.2 XML Layout

UDP packet definition files must be located in the %userprofile%\Documents\


My Games\DiRT 4\motionplatforms\ folder, and contain the following struc-
ture

<custom_udp>
<uint32 channel="...." scale="...." />
<int32 channel="...." scale="...." />
<float channel="...." scale="...." />
<fourcc text="...." />
</custom_udp>

where the type tags uint32, int32, float, and fourcc are the only supported
types, which represent 32 bit unsigned integers, 32 bit signed integers, 32 bit float-
ing point numbers, and 4 byte strings respectively. All exported data types are
currently 4 bytes in size, and up to 100 telemetry channels are supported per
packet.

Numeric types must specify a channel which must match one of the supported
channels below.

An optional scale modifier can be specified, and will typically be used for chang-
ing units or types.

The fourcc data must define a 4-character string in the text attribute.

Examples of use can be found at the end of this document.

4.3 Available Channels

In alphabetical order, here is a list of all the available telemetry channels that
can be exported from the game. Channels that are not supported by a game
will return zero.
abs

Not supported in DiRT4

acceleration x
acceleration y
acceleration z

Returns the x, y or z component of the world space acceleration of the


vehicle (in m/s2 )

6
angular velocity x
angular velocity y
angular velocity z

Returns the x, y or z component of the world space angular velocity of the


vehicle (in radians/s)

brake input

Returns the level of brake input applied through the controller. A value
between 0 and 1.

brake temp bl
brake temp br
brake temp fl
brake temp fr

Returns the brake temperature in Centigrade of the specified wheel. (bl =


Back Left Wheel, br = Back Right, fl = Front Left, fr = Front Right

clutch input

Returns the level of clutch input applied through the controller. A value
between 0 and 1.

drs

Not supported in DiRT4

engine rate

Returns the engine rotation rate in radians/second.

forward dir x
forward dir y
forward dir z

Returns the x, y or z component of the forward direction of the car in world


space (in metres).

fuel capacity

Not supported in DiRT4

fuel in tank

Not supported in DiRT4

7
gear

Returns the current gear number. 0 for neutral, -1 for reverse.

gforce lateral
gforce longitudinal
gforce vertical

Returns the G-Force in the lateral, longitudinal or vertical direction.

idle rpm

Returns the idle rate of the engine in radians/second.

in pits

Not supported in DiRT4

kers level max

Not supported in DiRT4

kers level

Not supported in DiRT4

lap distance

Returns the distance of the track, in metres.

lap time

Returns the current lap time, in seconds.

lap

Returns the current lap number.

last lap time

Returns the time of the last lap, in seconds.

left dir x
left dir y
left dir z

Returns the x, y or z component of the left direction of the car in world


space (in metres).

8
local velocity x
local velocity y
local velocity z

Returns the x, y or z component of the linear velocity of the car in car local
space (in metres).

max gears

Returns the number of forward gears available in the vehicle.

max rpm

Returns the maximum engine rate, in radians/second.

paused

Returns 1 if the game is paused, 0 otherwise.

pitch

Returns the pitch of the vehicle, in radians.

pitch velocity

Returns the pitch velocity of the vehicle (in radians/second).

pitch acceleration

Returns the pitch acceleration of the vehicle (in radians/second2 ).

position x
position y
position z

Returns the x, y or z component of the world space position of the car (in
metres).

race position

Returns the current position within the race.

race sector

Returns the number of splits in the lap.

9
roll

Returns the roll of the vehicle, in radians.

roll velocity

Returns the roll velocity of the vehicle (in radians/second).

roll acceleration

Returns the roll acceleration of the vehicle (in radians/second2 ).

sector time 1
sector time 2

Returns the first or second split time, in seconds.

speed

Returns the magnitude of the vehicles linear velocity, in m/s

steering input

Returns the level of steering input applied through the controller. A value
between -1 and 1.

suspension position bl
suspension position br
suspension position fl
suspension position fr

Returns the vertical position of the wheel from rest (in car space), measured
in metres.

suspension velocity bl
suspension velocity br
suspension velocity fl
suspension velocity fr

Returns the vertical velocity of the wheel from rest (in car space), measured
in m/s.

suspension acceleration bl
suspension acceleration br
suspension acceleration fl
suspension acceleration fr

Returns the vertical acceleration of the wheel from rest (in car space), mea-
sured in m/s2 .

10
throttle input

Returns the level of throttle input applied through the controller. A value
between 0 and 1.

total distance

Returns the race distance, in metres.

total laps

Returns the number of laps in the race.

total time

Returns the amount of time since the race session begun, in seconds.

track length

Returns the length of the track, in metres.

traction control

Not supported in DiRT4

tyre pressure bl
tyre pressure br
tyre pressure fl
tyre pressure fr

Not supported in DiRT4

velocity x
velocity y
velocity z

Returns the x, y or z component of the linear velocity of the car in world


space (in metres).

wheel patch speed bl


wheel patch speed br
wheel patch speed fl
wheel patch speed fr

Returns the speed of the contact patch of the specified wheel, in me-
tres/second.

11
yaw

Returns the yaw of the vehicle (in radians).

yaw velocity

Returns the yaw velocity of the vehicle (in radians/second).

yaw acceleration

Returns the yaw acceleration of the vehicle (in radians/second2 ).

12
5 Fanatec

5.1 Config Setup

Included in the motion platform system is the Fanatec wheel and pedal exten-
sions, which allow you to control vibration to pedals and LED displays.

The tag attributes are:

enabled

Set to true to enable the Fanatec specific extensions, false otherwise.

pedalVibrationScale

An optional scalar for the rumble motors in the pedals, currently set to rum-
ble when anti-lock brakes kick in. A value between 0 and 1.

wheelVibrationScale

An optional scalar for the rumble motors in the wheel (separate to regu-
lar force feedback motors). Currently set to rumble at high RPM. A value
between 0 and 1.

ledTrueForGearsFalseForSpeed

Set to true if you wish the LED display on the wheel to show you the current
gear, false if you would prefer to see the transmission speed of the vehicle.
The units of speed will be either km/h or mph, depending on the in-game
setting for the OSD.

13
6 Appendix 1: Custom UDP for UDP mode 0

<custom_udp>
<uint32 channel="total_time" scale="1000.0" />
<float channel="angular_velocity_x" scale="-1.0" />
<float channel="angular_velocity_z" scale="1.0" />
<float channel="angular_velocity_y" scale="1.0" />
<float channel="yaw" scale="1.0" />
<float channel="pitch" scale="1.0" />
<float channel="roll" scale="1.0" />
<float channel="acceleration_x" scale="-1.0" />
<float channel="acceleration_z" scale="1.0" />
<float channel="acceleration_y" scale="1.0" />
<float channel="velocity_x" scale="-1.0" />
<float channel="velocity_z" scale="1.0" />
<float channel="velocity_y" scale="1.0" />
<int32 channel="position_x" scale="-65535.0" />
<int32 channel="position_z" scale="65535.0" />
<int32 channel="position_y" scale="65535.0" />
<fourcc text="ToCA" />
</custom_udp>

14
7 Appendix 1: Custom UDP for UDP mode 1

<custom_udp>
<float channel="total_time" scale="1.0" />
<float channel="lap_time" scale="1.0" />
<float channel="lap_distance" scale="1.0" />
<float channel="total_distance" scale="1.0" />
<float channel="position_x" scale="1.0" />
<float channel="position_y" scale="1.0" />
<float channel="position_z" scale="1.0" />
<float channel="speed" scale="1.0" />
<float channel="velocity_x" scale="1.0" />
<float channel="velocity_y" scale="1.0" />
<float channel="velocity_z" scale="1.0" />
<float channel="left_dir_x" scale="-1.0" />
<float channel="left_dir_y" scale="-1.0" />
<float channel="left_dir_z" scale="-1.0" />
<float channel="forward_dir_x" scale="1.0" />
<float channel="forward_dir_y" scale="1.0" />
<float channel="forward_dir_z" scale="1.0" />
<float channel="suspension_position_bl" scale="1000.0" />
<float channel="suspension_position_br" scale="1000.0" />
<float channel="suspension_position_fl" scale="1000.0" />
<float channel="suspension_position_fr" scale="1000.0" />
<float channel="suspension_velocity_bl" scale="1000.0" />
<float channel="suspension_velocity_br" scale="1000.0" />
<float channel="suspension_velocity_fl" scale="1000.0" />
<float channel="suspension_velocity_fr" scale="1000.0" />
<float channel="wheel_patch_speed_bl" scale="1.0" />
<float channel="wheel_patch_speed_br" scale="1.0" />
<float channel="wheel_patch_speed_fl" scale="1.0" />
<float channel="wheel_patch_speed_fr" scale="1.0" />
<float channel="throttle_input" scale="1.0" />
<float channel="steering_input" scale="1.0" />
<float channel="brake_input" scale="1.0" />
<float channel="clutch_input" scale="1.0" />
<float channel="gear" scale="1.0" />
<float channel="gforce_lateral" scale="1.0" />
<float channel="gforce_longitudinal" scale="1.0" />
<float channel="lap" scale="1.0" />
<float channel="engine_rate" scale="1.0" />
</custom_udp>

15
8 Appendix 1: Custom UDP for UDP mode 2

<custom_udp>
<float channel="total_time" scale="1.0" />
<float channel="lap_time" scale="1.0" />
<float channel="lap_distance" scale="1.0" />
<float channel="total_distance" scale="1.0" />
<float channel="position_x" scale="1.0" />
<float channel="position_y" scale="1.0" />
<float channel="position_z" scale="1.0" />
<float channel="speed" scale="1.0" />
<float channel="velocity_x" scale="1.0" />
<float channel="velocity_y" scale="1.0" />
<float channel="velocity_z" scale="1.0" />
<float channel="left_dir_x" scale="-1.0" />
<float channel="left_dir_y" scale="-1.0" />
<float channel="left_dir_z" scale="-1.0" />
<float channel="forward_dir_x" scale="1.0" />
<float channel="forward_dir_y" scale="1.0" />
<float channel="forward_dir_z" scale="1.0" />
<float channel="suspension_position_bl" scale="1000.0" />
<float channel="suspension_position_br" scale="1000.0" />
<float channel="suspension_position_fl" scale="1000.0" />
<float channel="suspension_position_fr" scale="1000.0" />
<float channel="suspension_velocity_bl" scale="1000.0" />
<float channel="suspension_velocity_br" scale="1000.0" />
<float channel="suspension_velocity_fl" scale="1000.0" />
<float channel="suspension_velocity_fr" scale="1000.0" />
<float channel="wheel_patch_speed_bl" scale="1.0" />
<float channel="wheel_patch_speed_br" scale="1.0" />
<float channel="wheel_patch_speed_fl" scale="1.0" />
<float channel="wheel_patch_speed_fr" scale="1.0" />
<float channel="throttle_input" scale="1.0" />
<float channel="steering_input" scale="1.0" />
<float channel="brake_input" scale="1.0" />
<float channel="clutch_input" scale="1.0" />
<float channel="gear" scale="1.0" />
<float channel="gforce_lateral" scale="1.0" />
<float channel="gforce_longitudinal" scale="1.0" />
<float channel="lap" scale="1.0" />
<float channel="engine_rate" scale="1.0" />
<float channel="native_sli_support" scale="1.0" />
<float channel="race_position" scale="1.0" />
<float channel="kers_level" scale="1.0" />
<float channel="kers_level_max" scale="1.0" />
<float channel="drs" scale="1.0" />
<float channel="traction_control" scale="1.0" />
<float channel="abs" scale="1.0" />
<float channel="fuel_in_tank" scale="1.0" />
<float channel="fuel_capacity" scale="1.0" />
<float channel="in_pits" scale="1.0" />
<float channel="race_sector" scale="1.0" />
<float channel="sector_time_1" scale="1.0" />

16
<float channel="sector_time_2" scale="1.0" />
<float channel="brake_temp_bl" scale="1.0" />
<float channel="brake_temp_br" scale="1.0" />
<float channel="brake_temp_fl" scale="1.0" />
<float channel="brake_temp_fr" scale="1.0" />
<float channel="tyre_pressure_bl" scale="1.0" />
<float channel="tyre_pressure_br" scale="1.0" />
<float channel="tyre_pressure_fl" scale="1.0" />
<float channel="tyre_pressure_fr" scale="1.0" />
<float channel="laps_completed" scale="1.0" />
<float channel="total_laps" scale="1.0" />
<float channel="track_length" scale="1.0" />
<float channel="last_lap_time" scale="1.0" />
</custom_udp>

17
9 Appendix 1: Custom UDP for UDP mode 3

<custom_udp>
<float channel="total_time" scale="1.0" />
<float channel="lap_time" scale="1.0" />
<float channel="lap_distance" scale="1.0" />
<float channel="total_distance" scale="1.0" />
<float channel="position_x" scale="1.0" />
<float channel="position_y" scale="1.0" />
<float channel="position_z" scale="1.0" />
<float channel="speed" scale="1.0" />
<float channel="velocity_x" scale="1.0" />
<float channel="velocity_y" scale="1.0" />
<float channel="velocity_z" scale="1.0" />
<float channel="left_dir_x" scale="-1.0" />
<float channel="left_dir_y" scale="-1.0" />
<float channel="left_dir_z" scale="-1.0" />
<float channel="forward_dir_x" scale="1.0" />
<float channel="forward_dir_y" scale="1.0" />
<float channel="forward_dir_z" scale="1.0" />
<float channel="suspension_position_bl" scale="1000.0" />
<float channel="suspension_position_br" scale="1000.0" />
<float channel="suspension_position_fl" scale="1000.0" />
<float channel="suspension_position_fr" scale="1000.0" />
<float channel="suspension_velocity_bl" scale="1000.0" />
<float channel="suspension_velocity_br" scale="1000.0" />
<float channel="suspension_velocity_fl" scale="1000.0" />
<float channel="suspension_velocity_fr" scale="1000.0" />
<float channel="wheel_patch_speed_bl" scale="1.0" />
<float channel="wheel_patch_speed_br" scale="1.0" />
<float channel="wheel_patch_speed_fl" scale="1.0" />
<float channel="wheel_patch_speed_fr" scale="1.0" />
<float channel="throttle_input" scale="1.0" />
<float channel="steering_input" scale="1.0" />
<float channel="brake_input" scale="1.0" />
<float channel="clutch_input" scale="1.0" />
<float channel="gear" scale="1.0" />
<float channel="gforce_lateral" scale="1.0" />
<float channel="gforce_longitudinal" scale="1.0" />
<float channel="lap" scale="1.0" />
<float channel="engine_rate" scale="1.0" />
<float channel="native_sli_support" scale="1.0" />
<float channel="race_position" scale="1.0" />
<float channel="kers_level" scale="1.0" />
<float channel="kers_level_max" scale="1.0" />
<float channel="drs" scale="1.0" />
<float channel="traction_control" scale="1.0" />
<float channel="abs" scale="1.0" />
<float channel="fuel_in_tank" scale="1.0" />
<float channel="fuel_capacity" scale="1.0" />
<float channel="in_pits" scale="1.0" />
<float channel="race_sector" scale="1.0" />
<float channel="sector_time_1" scale="1.0" />

18
<float channel="sector_time_2" scale="1.0" />
<float channel="brake_temp_bl" scale="1.0" />
<float channel="brake_temp_br" scale="1.0" />
<float channel="brake_temp_fl" scale="1.0" />
<float channel="brake_temp_fr" scale="1.0" />
<float channel="tyre_pressure_bl" scale="1.0" />
<float channel="tyre_pressure_br" scale="1.0" />
<float channel="tyre_pressure_fl" scale="1.0" />
<float channel="tyre_pressure_fr" scale="1.0" />
<float channel="laps_completed" scale="1.0" />
<float channel="total_laps" scale="1.0" />
<float channel="track_length" scale="1.0" />
<float channel="last_lap_time" scale="1.0" />
<float channel="max_rpm" scale="1.0" />
<float channel="idle_rpm" scale="1.0" />
<float channel="max_gears" scale="1.0" />
</custom_udp>

19

You might also like