BigBang1112 / gbx-net

General purpose library for Gbx files - data from Nadeo games like Trackmania or Shootmania, written in C#/.NET. It supports high performance serialization and deserialization of 200+ Gbx classes.
https://explorer.gbx.tools
86 stars 20 forks source link

Can't retrieve input from Trackmania 2020 replay #25

Closed Fahersto closed 1 year ago

Fahersto commented 3 years ago

hey,

In tmnf I can parse input just fine (CGameCtnGhost.ControlEntries). Im running into issues when parsing Trackmania 2020 replay files though. The CGameCtnGhost node in my test replay is only 125 bytes in length (according to GameBoxReader). I did look at some other chunks etc but couldn't find anything input related easily. Did they change the replay format, move input elsewhere or is something broken? Any help appreciated.

BigBang1112 commented 3 years ago

Hello, reader position sometimes isn't a reliable thing (I barely remember how things are even read these days), just to first point that out. You have a reader that reads through the file first, and then you have readers reading MemoryStreams of each skippable chunk. More debugging features should come in the near future.

TM2020 inputs aren't available in replays or ghosts the same way as in the previous Trackmanias. According to Wirtual's last stream, they are stored there but encrypted, we will have to look into that further. In 0.10.0 which is coming on Tuesday, I have written summaries to each ControlEntries property:

CGameCtnGhost

Inputs (keyboard, pad, wheel) of the ghost from TMU, TMUF and TM2. For inputs stored in TM1.0, TMO, Sunrise and ESWC: see CGameCtnReplayRecord.ControlEntries. TM2020 and Shootmania don't have inputs available at all in replays and ghosts.

CGameCtnReplayRecord

Inputs (keyboard, pad, wheel) of the replay from TM1.0, TMO, Sunrise and ESWC. For inputs stored in TMU, TMUF and TM2: see CGameCtnGhost.ControlEntries in Ghosts. TM2020 and Shootmania don't have inputs available at all in replays and ghosts.

Fahersto commented 3 years ago

Wow that was fast and thank you very much :) So currently is is not possible to detect cheated TM2020 runs the same way donadigo did for tmnf.

BigBang1112 commented 3 years ago

From what we currently know, it isn't possible. And I wish it was, I looked through every buffer, maybe there are some potential values, but nothing really hints at anything exact. And the note that they are encrypted doesn't make it any easier. :D

BigBang1112 commented 2 years ago

There's one potential way to display the rough inputs of a TM2020 player. This idea has been thought of and possibly figured out by MKuijpers and the TMDojo devs (big thanks to these lads).

It actually makes sense very much to just take the values that are used to visualize the ghost. It turns out that the visual/audio part of the ghost uses values that match the inputs. It is still questionable how much the values are accurate (due to samples having frequency somewhere between just 20-50 times a second [instead of 100], and due to steering values ranging from 0 to 255 [instead of -65536-65536]), but this is probably the best we can get from Trackmania 2020 inputs.

The first progress of this approach has been published in GBX.NET 0.14 (007e230ee6fc104029cb976fa5f17e17f9c33a10) inside CGameCtnGhost.RecordData.Samples (BufferType == 4) as Gear, RPM, Steer, Brake, Gas and it would mean a world to us if anyone else joined the ghost sample data exploration.

BigBang1112 commented 1 year ago

GBX.NET 1.1.0 will receive partial support for TM2020 inputs. How it goes is explained here: https://github.com/BigBang1112/gbx-net/wiki/Extracting-input-data-from-ghosts#extracting-inputs-from-tm2020-replays

Inputs are still corrupt through if you have the mouse bound in the Control settings (which is a case pretty much always). If anyone wants to help debunking, join the GameBox Sandbox Discord server.

BigBang1112 commented 1 year ago

Reading TM2020 inputs is now fairly stable under a lot of conditions, coming in 1.1.1