soong-construction / dirt-rally-time-recorder

Stage time recorder for DiRT Rally [2.0]
Other
18 stars 2 forks source link

Try to resolve ambiguities in UDP data #12

Closed maxbechtold closed 4 years ago

maxbechtold commented 4 years ago

In discussions with @ErlerPhilipp, there was the idea to use car placement data to distinguish cars with identical RPM values. I took some test measurements at the start line of Sweet Lamb, Wales:

Mustang (Rally GT):

(lowest ride height)
suspension_pos (-1.905299425125122, 3.7120466232299805, 5.390767574310303, 6.850743770599365)

(highest ride height)
suspension_pos (-38.70351791381836, -33.791297912597656, -31.959556579589844, -30.863815307617188)

Skoda Fabia R5:

(lowest ride height)
suspension_pos (15.552978515625, 23.418739318847656, 25.486906051635742, 28.704988479614258)

(highest ride height)
suspension_pos (-22.921934127807617, -15.182136535644531, -12.683180809020996, -9.558659553527832)

VW Polo GTI R5:

(lowest ride height)
suspension_pos (-26.68341636657715, -20.02265167236328, -17.466567993164062, -15.502795219421387)

(highest ride height)
suspension_pos (-66.94920349121094, -60.528465270996094, -57.2760009765625, -55.434288024902344)

While the suspension position is highly varying with ride height, the value range is different even with the very similiar R5 cars. This could be a way to tell those cars apart.

It should be checked

maxbechtold commented 4 years ago

Playing around with the Polo R5 at Sweet Lamb, I observed the following values when changing a single spring setting (with a fixed minimum ride height):

(spring rate: soft)
suspension_pos (-28.600671768188477, -21.187694549560547, -16.182153701782227, -13.523907661437988)

(spring rate: firm)
suspension_pos (-24.968305587768555, -19.47877311706543, -18.102201461791992, -17.04927635192871)
(anti-rollbar: soft)
suspension_pos (-28.9309139251709, -19.193330764770508, -18.637378692626953, -14.313410758972168)

(anti-rollbar: firm)
suspension_pos (-25.643489837646484, -20.56610679626465, -16.82781410217285, -16.080617904663086)

Except for rebound, no damper setting changed the values considerably:

(slow rebound: soft)
suspension_pos (-27.727893829345703, -21.049787521362305, -17.898944854736328, -15.977967262268066)

(slow rebound: firm)
suspension_pos (-25.89530372619629, -19.417036056518555, -16.95511245727539, -15.140246391296387)

Even with combined changes to the default settings, the numbers do not change considerably:

(min. ride height, all spring settings: soft)
suspension_pos (-31.912084579467773, -19.235877990722656, -18.412721633911133, -11.280620574951172)

(max. ride height, all spring settings: firm)
suspension_pos (-64.31338500976562, -59.90061569213867, -57.67582321166992, -57.28327941894531)

Camber angle has a miniscule effect on the suspension values (~0.1 delta). I didn't check further tuning options.

maxbechtold commented 4 years ago

Damage to a single wheel unsurprisingly breaks the left/right symmetry (which is restored with both wheels punctured):

(front left: puncture)
suspension_pos (-11.293641090393066, -32.106544494628906, -36.23552703857422, -12.355406761169434)
maxbechtold commented 4 years ago

Pitch angle will put more or less load on suspensions. Starting at Sweet Lamb means the car is pitched forward. Las Juntas, Argentina, is an even start with similar values for all wheels, while Verbundsring starts with a backward pitch.

(forward pitch, min. ride height)
suspension_pos (-26.68341636657715, -20.02265167236328, -17.466567993164062, -15.502795219421387)

(neutral pitch, min. ride height)
suspension_pos (-18.741600036621094, -17.807144165039062, -18.943653106689453, -18.13006591796875)

(backward pitch, min. ride height)
suspension_pos (22.591493606567383, 22.277315139770508, 20.892213821411133, 21.00955581665039)

Verbundsring gives another insight: The suspension settings for asphalt are relatively higher than those for gravel:

(asphalt, min. ride height)
suspension_pos (22.591493606567383, 22.277315139770508, 20.892213821411133, 21.00955581665039)

(asphalt, max. ride height)
suspension_pos (-19.351659774780273, -19.305038452148438, -17.77704429626465, -17.793943405151367)
maxbechtold commented 4 years ago

The above could lead to the assumption that any car will exhibit a suspension position in a certain value range, e.g. [-67,-11] for the Polo GTI on gravel. If this is disjoint from that of any other car with identical RPM values, the correct car could be identified.

At least for the gravel suspension settings of the Subaru WRX STI (ca. [-41,9]) and the Fiat Abarth (ca. [-38,15], both report the same RPM values) this is not true.
In that case, not even maxGears would be of any help (both these cars have 5 gears).

maxbechtold commented 4 years ago

By including the top gear of each car (cf. https://github.com/soong-construction/dirt-rally-time-recorder/releases/tag/v2.5.1), only a few pairs of ambiguous cars remain.

Except for the Fiat 131 Abarth Rally and the Subaru WRX STI NR4 (both 5-speed H-pattern vehicles), these pairs can be told apart by their gearbox. It is either sequential or H-pattern. In the latter case, the timerecorder could test for non-sequential gear changes (e.g. 4>2 or 3>R). If any occur till the end of a stage, this indicates H-pattern shifting and it would be safe to assume which car was driven (disregarding substantial drop-outs in UDP telemetry).

In the case an H-pattern vehicle is driven without skipping gears or with the game configured to use sequential shifting instead, no false assumption is made.

joaosantos87 commented 4 years ago

Hello. I've found this project last week and I have decided to take a look and use the UDP packages from DR2. I am currently facing this issue where there are several cars that cannot be distinguished by the "max rpm", "idle rpm" and "top gear" combination.

How can you distinguish between for example Peugeot 208 R2 and the evo X?

Thanks for your attention.

maxbechtold commented 4 years ago

Hi there! That's right, and I'm not sure you really can tell every car apart just by the UDP data with 100% certainty. I'm going for a supervised approach with heuristics in #25.

If you are willing to crunch data hard, there's probably some things you can do by tracing values over time. In your example, the R2 is FWD and the Evo X is 4WD. Since you should never observe wheel spin on the rear wheels, this would indicate the R2. But for the two R5 cars (VW and Skoda), I really have no clue. Maybe https://github.com/ErlerPhilipp/dr2_logger can help you. If you find some smart way to do it, let me know :)

ErlerPhilipp commented 4 years ago

These heuristics are probably unreliable. I'm only playing with sequential gamepad (poor PhD student) , so the shift patterns won't work. Also, the wheel slip might be tricky. You would need to check driving backwards, crashes and bad drifts. There are probably some other cases that no one thinks about.

Maybe, we can get the attention of Codemasters if we write a thread in their forum or on social media. It would be a trivial change for them to give us e.g. unique idle_rpm values.

joaosantos87 commented 4 years ago

Yes, I do agree that it would be quite easy for them to provide that kind of unique values. One thing that comes to my mind is to use the "acceleration"/"braking" speed calculations that would probably distinguish between cars if they are too different. Between the Skoda and VW I have no ideia on how to break them apart as they should have very similar values on acceleration/braking.

maxbechtold commented 4 years ago

Let's talk about heuristics in #25, your input is really appreciated.

Concerning Codemasters, I'm not so sure since I believe they don't have many people working on this game anymore, and perhaps nothing more than a patch in their pipeline. Also, I think the RPM values are tied to the car physics and audio engine, so maybe it's more than just changing a number in some config file. It might be worth a try though.

maxbechtold commented 4 years ago

cf. https://forums.codemasters.com/topic/50218-a-letter-to-the-dirt-rally-20-community/