Explore GameReplays...

Company of Heroes

replay parser code

Reply to this topic Start new topic
# 1pingtoft Aug 14 2011, 18:07 PM
I wanted to see if I could decode a replay file. As it turns out, I could.
Now, I'm not sure what I want to do with it, so I might as well set it free...

There are a couple of bytes that I have yet to decipher, but it parses 99% of the information.
Attached File coh.replayparser.rar
Size: 6.73k
Number of downloads: 223

Posts: 4,341

Game: Company of Heroes


+
# 2McDrewbs Aug 14 2011, 18:23 PM
Could you (technically) manipulate it so you change the outcome of the match? Given enough understanding of the files lol.

Posts: 109

Game: Company of Heroes


+
# 3pingtoft Aug 14 2011, 18:53 PM
(Very) theroetically, yes

Posts: 4,341

Game: Company of Heroes


+
# 4DevM Aug 14 2011, 20:14 PM
what's this? wacko.gif

Posts: 1,243

Clan: Wheres My Demo

Game: Company of Heroes


+
# 52FAST4YA Aug 14 2011, 21:55 PM
QUOTE(DevM @ Aug 14 2011, 22:14 PM) *
what's this? wacko.gif




+1



Is it something similar to CoHRA?

Posts: 1,868

Game: Company of Heroes


+
# 6pingtoft Aug 14 2011, 22:17 PM
It's a piece of code that will extract commands, messages etc from a replay file.
It is not an application in it self.

Posts: 4,341

Game: Company of Heroes


+
# 7Trainzz Aug 15 2011, 10:49 AM
And for what could you use it?

Posts: 2,429

Clan: Wheres My Demo

Game: Company of Heroes 2


+
# 8pingtoft Aug 15 2011, 15:58 PM
QUOTE(ILikeTrainz @ Aug 15 2011, 12:49 PM) *

And for what could you use it?

to parse replays...

Posts: 4,341

Game: Company of Heroes


+
# 9rollems Aug 15 2011, 16:10 PM
so u posted .cs class files and now what i need to write exe app and use it ?

Posts: 2,019

Clan: SoldiersofLiberty

Game: Company of Heroes


+
# 10ThisIsKindergarten Aug 15 2011, 17:01 PM
Great stuff!!!

To everybody who doesn't know what it does: this is a new engine like the one in CoH Replay Analyzer (COHRA) for which we had no source code.

I tried it and ... have some questions.

What's the supposed format of the actionDefinitions file?
I tried cohra.dat which is in the format Dyxtra used for COHRA and the replay parser didn't like it. Example:
COHRA: 9,0,BUILDING,"Barracks",0x5eb,1
replay parser: 9,0,"Barracks",1

The action type (BUILDING) doesn't seem to be stored anywhere else and 0x5eb is the actual action ID - how can replay parser work without those?

I used aramonkg's cohra.dat file for 2.602

How does one get / set the mod name?
Not directly related to replay parser ofc: replayParser.replay.modName is RelicCoH for a BK mod game.

replayParser.replay.mapDescription wrong?
replayParser.replay.mapDescription: "0990\0$60995\0Ā\0Ā\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0Ȁ\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0Ā但䑌义但\0͚\0\0\0\0\0\0\0䅄䅔䅂䕓\v\0\0\0\0..\0\0\0\0㨵么\0\0\0佃卌\0\0協剓\0呋噐\0\0\0\0Ā\0ꌀ㡲`\0\0\0\0Ā..\0\0\0\0慧敭業潮癲牥楳湯\0\0\0慧敭慭潪癲牥楳湯ɚ\0\0\0\0\t\0慭捴湨浡ᩥ\0最晥捥瑨瘠湯椠慥扴汯桳癥歩s\0\0\0...

This is the map description for Langres.

In any case very impressive work--especially compared to the mess I coded for CohReplayLister. BTW: I can update it to recognize 2.602 replays if anyone is interested.

Oh, thanks a lot for sharing the source code!

This post has been edited by ThisIsKindergarten: Aug 15 2011, 17:07 PM

Posts: 474

Game: Company of Heroes


+
# 11pingtoft Aug 15 2011, 18:47 PM
QUOTE(ThisIsKindergarten @ Aug 15 2011, 19:01 PM) *

Great stuff!!!

To everybody who doesn't know what it does: this is a new engine like the one in CoH Replay Analyzer (COHRA) for which we had no source code.

I tried it and ... have some questions.

What's the supposed format of the actionDefinitions file?

The format is: action type, action id, description, has-location-flag, ie. coordinates on the map.
I haven't gotten around to make a table that maps action type to a description.

QUOTE(ThisIsKindergarten @ Aug 15 2011, 19:01 PM) *

How does one get / set the mod name?

Good question - I only tested with vanilla games and assumed it was the actual name of the mod.

QUOTE(ThisIsKindergarten @ Aug 15 2011, 19:01 PM) *

replayParser.replay.mapDescription wrong?

Hm, interesting. It's 4 bytes off. I haven't seen that before.
It should be $60995

QUOTE(ThisIsKindergarten @ Aug 15 2011, 19:01 PM) *

In any case very impressive work--especially compared to the mess I coded for CohReplayLister. BTW: I can update it to recognize 2.602 replays if anyone is interested.

Oh, thanks a lot for sharing the source code!

Thx and np smile.gif

Btw, feel free to do whatever you want with it.

Edit: My original plan was to combine your idea with cohra with an underlying database (sqlite initially) and add a query interface so you could create statistics.


This post has been edited by pingtoft: Aug 15 2011, 18:53 PM

Posts: 4,341

Game: Company of Heroes


+
# 12ThisIsKindergarten Aug 15 2011, 19:14 PM
QUOTE(pingtoft @ Aug 15 2011, 20:47 PM) *

The format is: action type, action id, description, has-location-flag, ie. coordinates on the map.
I haven't gotten around to make a table that maps action type to a description.

How about using Dyxtra's format even if you don't need all it's fields? That would give us a complete list of action IDs right now.

Of course I could just make the required changes for my own use. But I very much prefer a solution that is readily available to everybody.

QUOTE(pingtoft @ Aug 15 2011, 20:47 PM) *

Hm, interesting. It's 4 bytes off. I haven't seen that before.
It should be $60995

I'll try with other maps.

QUOTE(pingtoft @ Aug 15 2011, 20:47 PM) *

Edit: My original plan was to combine your idea with cohra with an underlying database (sqlite initially) and add a query interface so you could create statistics.

"Was" like "not gonna happen" or like "when I have time"? Getting statistics for tourney after-action-reports and the like would be absolutely awesome.

Let me know if you'd like some help for example a GUI.

This post has been edited by ThisIsKindergarten: Aug 15 2011, 19:15 PM

Posts: 474

Game: Company of Heroes


+
# 13pingtoft Aug 15 2011, 19:27 PM
QUOTE(ThisIsKindergarten @ Aug 15 2011, 21:14 PM) *

How about using Dyxtra's format even if you don't need all it's fields? That would give us a complete list of action IDs right now.

Of course I could just make the required changes for my own use. But I very much prefer a solution that is readily available to everybody.
I'll try with other maps.
"Was" like "not gonna happen" or like "when I have time"? Getting statistics for tourney after-action-reports and the like would be absolutely awesome.

Let me know if you'd like some help for example a GUI.

I don't have the time or energy atm. to finish it and rather than leaving it to fester in my svn, I posted it here in the hope that someone would find use of it.

You're more than welcome to modify the code and if you do I hoe you post the updated code, so I and others can benefit from it.

Posts: 4,341

Game: Company of Heroes


+
# 14Qvazar Sep 25 2011, 12:18 PM
QUOTE(ThisIsKindergarten @ Aug 15 2011, 18:01 PM) *

In any case very impressive work--especially compared to the mess I coded for CohReplayLister. BTW: I can update it to recognize 2.602 replays if anyone is interested.


Yes please! smile.gif
Or just give some pointers to what changes there might be smile.gif

Posts: 47

Game: Company of Heroes


+
# 15ThisIsKindergarten Sep 25 2011, 15:05 PM
QUOTE(Qvazar @ Sep 25 2011, 14:18 PM) *

Yes please! smile.gif
Or just give some pointers to what changes there might be smile.gif

Problem is I failed to find out what distinguishes 2.602 replays from 2.601 ones. Main Version and chunk format specifier are the same.

Posts: 474

Game: Company of Heroes


+
# 16Qvazar Sep 27 2011, 15:56 PM
QUOTE(ThisIsKindergarten @ Sep 25 2011, 16:05 PM) *

Problem is I failed to find out what distinguishes 2.602 replays from 2.601 ones. Main Version and chunk format specifier are the same.

Ah, so I am right in assuming that this code is fully compatible with 2.602 replays as well? Great! biggrin.gif

Posts: 47

Game: Company of Heroes


+
# 17ThisIsKindergarten Sep 27 2011, 21:00 PM
QUOTE(Qvazar @ Sep 27 2011, 17:56 PM) *

Ah, so I am right in assuming that this code is fully compatible with 2.602 replays as well? Great! biggrin.gif

Well, ReplayLister doesn't explode if you tell it to list 2.602 replays--it will show them as being 2.601 replays. But one of it's duties is to show you whether a replay will work with your CoH install. And 2.601 replays don't work with a 2.602 install.

There is a bug with filtering for the russian faction though. But as nobody complained yet I take it no one uses it anyway tongue.gif .

In case you are referring to pingtoft's code: I guess it's compatible with 2.602 replays but haven't checked.

This post has been edited by ThisIsKindergarten: Sep 27 2011, 21:04 PM

Posts: 474

Game: Company of Heroes


+
# 18pingtoft Sep 28 2011, 07:13 AM
QUOTE(ThisIsKindergarten @ Sep 27 2011, 23:00 PM) *

Well, ReplayLister doesn't explode if you tell it to list 2.602 replays--it will show them as being 2.601 replays. But one of it's duties is to show you whether a replay will work with your CoH install. And 2.601 replays don't work with a 2.602 install.

There is a bug with filtering for the russian faction though. But as nobody complained yet I take it no one uses it anyway tongue.gif .

In case you are referring to pingtoft's code: I guess it's compatible with 2.602 replays but haven't checked.

I tested my code solely on 2.602 replays.

Posts: 4,341

Game: Company of Heroes


+

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)