Login

russian armor

Replay analyzer internals

11 Jul 2013, 22:02 PM
#1
avatar of RageWithTheMachine

Posts: 8

Some technical notes for people who are interested in making a COH2 replay analyzer.

In closed beta I reversed the savefile protocol. There've been only minor
changes in release. There are 3 layers of packets within packets with their own
headers. It's very much like analyzing a stack of IP protocols in Wireshark. I
made a console app that breaks it down and dumps out messages that are strings
of bytes; there is one message for every command or every thing that every
player does, with a timestamp. Like Dyxtra's 'COHRA Helper' which is still
available from http://dyxtra.com/coh.

Before it's useful, somebody would need to do the slightly autistic job of
mapping specific numbers to all specific units and commands. Staring at the
strings you can see that a certain column has the 'command' byte where one
number should be 'move' and another 'build' etc. For 'build', another column has
specific numbers for grenadier, mg42 etc.

The file header contains players' name and faction. As far as I can tell, the
actual messages in the replay file link to specific map positions (0-7), rather
than specific players. It's a separate problem to link players to map positions.

You could see this problem when trying to use Dyxtra's pretty titties program on
a 4-8 player COH1 game with random positions turned on; he interpreted the
command logs right, but they could be randomly assigned to the wrong player. He
used a partial hack; if you typed a chat message during the game, he'd obtain
the player ID from that. Chat messages are not stored in COH2 replays.
Furthermore, all COH2 games are random position.

In your user directory there's a subdirectory 'LogFiles', and inside there's a
number called 'RandomStreamSeed' for each game. You find that 32-bit integer in
the replay file header. If you modify it with a hex editor, you'll see that the
players map positions are swapped around before the replay goes OOS. This means
the same RNG stream that determines whether a grenadier hits, misses or crits is
also used for mapping the players. Unless I missed some data in the header, you
can't make a working replay analyzer for 4-8 player games without disassembly.
I'd have to beat the program into submission for running under debugger and
trace the code that seeds the RNG and produces something to map the players.
Essentially the same treatment administered by 'crackers' and other hostiles.

Alternatively one could use the 'social' kind of engineering instead of
'reverse', like, just ask relic to put the numbers in the header. For 1v1 games
there should be no problem, as you can just see which log produces
german/russian units and figure the correct player.

I was kinda half done with the other thing in beta but had a hardware failure,
it was time to buy new comp anyway and it takes me several weeks to install and
configure a new workstation with vsice and the whole circus. Also, I loose
interest in hacking during summer, so the protocol analyzer's been sitting on my
drive for 2 months and isn't going anywhere until winter. And now that I've seen
the released game, I'm starting to ask 'why bother?'. Where the hell is the
leaderboard and the ELO rating system. All I see is xp rewards for playing, not
winning. Who are these people who require virtual rewards every 40 minutes, even
when loosing, and why would I want to play a game with them? You'd think a real
person could go for a couple days without a reward.

If somebody else is into hexadecimal and C coding in summer, I could possibly
send over the source code for the protocol analyzer app. It currently just organizes
the data into strings with no interpretation of specific units, commands.
30 Oct 2013, 11:52 AM
#2
avatar of thomasthetankengine

Posts: 3

Hello RageWithTheMachine, would it possible to get a copy of the source? I would like to have a play with it and see what kinda of tools I can come up with.
30 Oct 2013, 12:02 PM
#3
avatar of OnkelSam
Honorary Member Badge

Posts: 1582 | Subs: 4

There's already a replay analyzer released by now

http://www.coh2.org/news/9268/coh2-replay-analyzer
30 Oct 2013, 12:54 PM
#4
avatar of thomasthetankengine

Posts: 3

Thanks, wasn't aware of this. It is looks interesting but I would like to take the analyser in different direction which looks at the balance of game.
1 user is browsing this thread: 1 guest

Livestreams

unknown 24
unknown 18
unknown 1
Germany 981
Russian Federation 2

Ladders Top 10

  • #
    Steam Alias
    W
    L
    %
    Streak
Data provided by Relic Relic Entertainment

Replay highlight

VS
  • U.S. Forces flag cblanco ★
  • The British Forces flag 보드카 중대
  • Oberkommando West flag VonManteuffel
  • Ostheer flag Heartless Jäger
uploaded by XXxxHeartlessxxXX

Board Info

457 users are online: 457 guests
0 post in the last 24h
8 posts in the last week
34 posts in the last month
Registered members: 49112
Welcome our newest member, Buchh647
Most online: 2043 users on 29 Oct 2023, 01:04 AM