View Full Version : UDP questions

30-12-2018, 09:37
I'm working on a leaderboard project for consoles. It currently runs on a Raspberry Pi, and it reads UDP (laptimes etc) and stores everything in a database on the Pi. It also scrapes leaderboards from cars2-stats-steam-page, so now I can see my laptimes mixed with the PC players! Console leaderboards on a per car/track-combo, pretty awesome actually! We're looking at moving as much as possible of it to Azure, so that everyone uses the same db.

Now the questions. The scraper script obviously gets laptimes etc, but also Setup (Default/Custom), Controller (Wheel/Gamepad/Keboard) and Camera (In-car/External). Is there anyway to get/guess these things from UDP?

There's a Joypad and a Dpad field in the UDP. Could one assume that if they are null during the lap, that the player uses a wheel? (Excluding keyboard players, sorry!)

Is there something in the UDP that could reveal that a custom setup is used?

All theories welcome!

Killg0re NL
30-12-2018, 14:28
I am working aswell on an UDP project, when i find something you can use i will let you know.

I am currently struggling with the floats in Arduino

18-03-2019, 11:15
Another question:
Is there anyway to tell if the player is watching a replay?

UDP is sent during replays as well. RaceState is 'Racing', GameState 'In-game playing', SessionState whatever the type is/was (TimeTrial, Practice etc), so no help there.
OdometerKM value continues to grow during replays, but that is not saved when exiting replay.

18-03-2019, 18:02
Joypad and dpad are just bytes in the data (can't remember if they're 1 byte or 2 bytes - maybe joypad is 2 and dpad is one). Each button is represented by a single bit in these bytes and the game sets them for wheels as well as controllers. Not sure about keyboards tho.

So you can't use the presence of non-zero bits in these bytes to indicate that the user is playing with a controller. As far as I know there's no data in the UDP stream that'll give you that info

18-03-2019, 18:05
Thanks. For next game I'd really like them to add info about controller type, and if it's a default or custom setup.

19-03-2019, 00:12
There is GAME_INGAME_REPLAY in PC2 data.

// (Type#1) GameState (to be used with 'mGameState')

It works in my app. Or did I not understand what you were going for?

19-03-2019, 07:43
Sampo, that's exactly what I'm looking for. Do you know if that is available in the old v1 udp format too?
I'll test tonight. Thanks!