This is a Example of Capturing UDP-Packets which comes from a PS/4 game while doing a race.
It is using RandomAccessfile to parse the Different UDP-Packets.
You can find the UDP-Specifications here.
Each of the described UDP-Packets are parsed by the Class into different CustomTypes and holding two Global Maps.
glData: This Map contains a Live capture of the active Session.
There is a Session key which holds Information about the Session itself.
And for each driver in the race there is a Map with all additional infos about this Driver/Car.
All the Carsetup-Infos, Car-Status, Car Telemetry Data, Raceposition, best lap time and so on.
RaceDriverMap: Holds a Map for each RaceDriver(customtype). This map is used to get all drivers, sort them by Position (in the race) using list.sorttype and then update the Table in the other window.
It seems that is does work fine with local games captured... It is me who is playing the game on my Playstation.
But i fear it does not work correctly with a Online Race. Basically one should be able to recognize a driver with the given Grid-Position. It should not change while in session.
---- Setup PS/4 - F1 2018 Settings ------
- In the Game you need to go to the game settings. Here you find a Telemetry setting
Use the IP from your PC running the B4J Project.
- Port 20777
- UDP-Format should be set to 2018
I´m not sure if everything is working as expected ;-)
Dependencies:
- It is only interesting if you own the Codemasters Game F1 2018 for your Playstation.
- It may be possible to use it in the PC-Version of the Game too.
- You must have configured the game to send the UDP Telemetry Data to your PC.
What i did not understand as of now (need help with it).
- I get in the Data all drivers WorldPositionX/Y/Z
The values ranged from -xxx.xxxx to +xxx.xxxx
and i´m wondering if i could "paint" the position on a Canvas but i´m not able to convert the positions into a canvas position to draw something like a track.
Unfortunately i do not have any Trackgraphics which i could use. Also if i had them; i still needed to underastand how to convert the WorldPositions to a Bitmap-Pixelposition.
For ex:
results in
maxX maxY maxZ minX minY minZ
1022.2056 3.7142 1047.0760 -819.6987 -143.0191 -603.8157
Any help rthis regarding is higly appreciated. I´m doing this project for a friend.
Feel free to play with the tool. If you find any problem and know a Fix for it. Post the fix so anyone can apply them.
Have fun!
It is using RandomAccessfile to parse the Different UDP-Packets.
You can find the UDP-Specifications here.
Each of the described UDP-Packets are parsed by the Class into different CustomTypes and holding two Global Maps.
B4X:
Public glData As Map
Public RaceDriverMap As Map
glData: This Map contains a Live capture of the active Session.
There is a Session key which holds Information about the Session itself.
And for each driver in the race there is a Map with all additional infos about this Driver/Car.
All the Carsetup-Infos, Car-Status, Car Telemetry Data, Raceposition, best lap time and so on.
RaceDriverMap: Holds a Map for each RaceDriver(customtype). This map is used to get all drivers, sort them by Position (in the race) using list.sorttype and then update the Table in the other window.
It seems that is does work fine with local games captured... It is me who is playing the game on my Playstation.
But i fear it does not work correctly with a Online Race. Basically one should be able to recognize a driver with the given Grid-Position. It should not change while in session.
---- Setup PS/4 - F1 2018 Settings ------
- In the Game you need to go to the game settings. Here you find a Telemetry setting
Use the IP from your PC running the B4J Project.
- Port 20777
- UDP-Format should be set to 2018
I´m not sure if everything is working as expected ;-)
Dependencies:
- It is only interesting if you own the Codemasters Game F1 2018 for your Playstation.
- It may be possible to use it in the PC-Version of the Game too.
- You must have configured the game to send the UDP Telemetry Data to your PC.
What i did not understand as of now (need help with it).
- I get in the Data all drivers WorldPositionX/Y/Z
The values ranged from -xxx.xxxx to +xxx.xxxx
and i´m wondering if i could "paint" the position on a Canvas but i´m not able to convert the positions into a canvas position to draw something like a track.
Unfortunately i do not have any Trackgraphics which i could use. Also if i had them; i still needed to underastand how to convert the WorldPositions to a Bitmap-Pixelposition.
For ex:
B4X:
SELECT max( `live_worldPositionX` ) AS maxX, max( `live_worldPositionY` ) AS maxY, max( `live_worldPositionZ` ) AS maxZ, min( `live_worldPositionX` ) AS minX, min( `live_worldPositionY` ) AS minY, min( `live_worldPositionZ` ) AS minZ
FROM `f1_live_data`
WHERE `live_sessionID` =458
maxX maxY maxZ minX minY minZ
1022.2056 3.7142 1047.0760 -819.6987 -143.0191 -603.8157
Any help rthis regarding is higly appreciated. I´m doing this project for a friend.
Feel free to play with the tool. If you find any problem and know a Fix for it. Post the fix so anyone can apply them.
Have fun!
Attachments
Last edited: