Explore GameReplays...

CNC Zero Hour

Logging Victory/Defeat in game replay log txt

Reply to this topic Start new topic
# 1landsmannen Nov 17 2020, 12:58 PM
This one is probably directed to @xezon and/or other developers.

I am a big CnC Generals fan as well as a machine learning practitioner. I got the idea to explore whether it is possible to use Generals replay files as a time series input and use a neural net to predict the outcome of a game (win/lose). First step would be for it to work offline, but it could also be possible to make a real-time "needle-style" win/lose predictor. In that case I think it could be very cool plugin for the replay viewer!

The nice thing about a neural net approach is that I probably won't have to parse commands in the replay files, but rather let the neural net itself figure out which indicators help predict the outcome. I am really fascinated by the massive amount of possible training data being uploaded to the gentool site every day. The only thing I am missing is an indicator for whether a player won (victorious) or lost (defeated and possibly also exit game). Such an indicator would be a requirement to be able to set up the training of the neural net. From my research on the replay files they seem to not include a win/lose indicator. I cannot find any such flag in the replay log txt that is being uploaded together with the replay files.

Do you have any ideas of how to get a hold of information about which player won/lost? If the information is not available in the replay files, would it be possible for gentool to save this information in the replay txt file? Amy eventual work I would do on this project will be open source with a permissive license :-)

Posts: 10


+
# 2xezon Nov 17 2020, 18:29 PM
I am not aware about Replay storing winning player. GenTool also does not keep track of winning and losing players.

Posts: 22,380

Clan: MENTAL

Game: CNC Zero Hour


+
# 3landsmannen Nov 17 2020, 20:50 PM
Thanks for the quick reply xezon :-)

That is what I thought. Is logging of win/loss something you have considered implementing in gentool? May be other reasons than mine to do that :-)

Just for fun I loaded up Windows Resource Monitor, turned on logging, started a generals skirmish game and immediately sold my command center. Attached is a screenshot of the resource log. Would gentool be able to use the loading of "Defeated" image and the "Victorious" image to flag the player with a loss/win?


Attached thumbnail(s)
Attached Image

Posts: 10


+
# 4xezon Nov 17 2020, 22:20 PM
Good thinking with the texture, but that does not sound very reliable because this is probably a resource that is setup in an *.ini file and could be subject to change in a 3rd party Mod.

Posts: 22,380

Clan: MENTAL

Game: CNC Zero Hour


+
# 5landsmannen Nov 18 2020, 09:44 AM
Hmm... Good point. Have you got any other ideas for indicators of a win/loss? I know there are many corner cases where people exit games, are disconnected, mismatch etc, but if one just focuses on "proper" victory, defeat first :-)

Maybe a small pilot where when these requirements are met, gentool can flag a win/loss?
  • Game Version: Zero Hour 1.04 *
  • Install Type: Normal Game Install
  • Match Type: 1v1

Appreciate you taking the time to discuss this with me :-)

Posts: 10


+
# 6McNuBtY Nov 18 2020, 13:57 PM
Maybe for your use case you could correlate win/loss data from Shatabrick with the associated replays on the GenTool website?

Posts: 113

Game: CNC Zero Hour


+
# 7FiRe^ArM Nov 18 2020, 14:22 PM
QUOTE(McNULLty @ Nov 18 2020, 19:27 PM) *

Maybe for your use case you could correlate win/loss data from Shatabrick with the associated replays on the GenTool website?

No, Never. I hate Shatabrick. It never records my wins. sad.gif

Posts: 2,434

Clan: WbG

Game: CNC Zero Hour


+
# 8McNuBtY Nov 18 2020, 15:29 PM
QUOTE(FiRe^ArM @ Nov 18 2020, 15:22 PM) *

No, Never. I hate Shatabrick. It never records my wins. sad.gif

I could say that for me, too, but in my case that's not a sign of Shatabrick not working mellow.gif

Posts: 113

Game: CNC Zero Hour


+
# 9landsmannen Nov 18 2020, 18:53 PM
That might be a good idea! I can live with some misclassifications/noise.

Btw is the site down at the moment or is it just me? No stats when I click on players

Posts: 10


+
# 10landsmannen Nov 19 2020, 09:06 AM
QUOTE(landsmannen @ Nov 18 2020, 18:53 PM) *

That might be a good idea! I can live with some misclassifications/noise.

Btw is the site down at the moment or is it just me? No stats when I click on players


Never mind, it seems to be working again today :-)

I think this might be a very good idea and enough for me to at least see if the prediction is possible!

I'm only playing with friends over GameRanger and on physical LANs so not so familiar with the online ranking system. Is the win/loss registration on shatabrick mostly working? Would be nice to just have a rough idea of how many erroneous wins/losses there are out there. Just a ballpark assessment :-) I'll fire it up myself and get my own impression also.

Posts: 10


+
# 11McNuBtY Nov 19 2020, 10:02 AM
AFAIK the issues that exist are that the stats sometimes are not updated at all (i.e. some players complain that their wins are never registered). Games with mismatches and disconnects should not get reported there at all.

So if I'm not mistaken, wins/losses should be correctly attributed. Note however that surrendering and/or exiting the game will result in a loss. E.g. sometimes a player immediately surrenders if they are not happy with their army. That is of course counted as a loss, but may not be useful ML training data (well, maybe it is, though...)

Posts: 113

Game: CNC Zero Hour


+
# 12landsmannen Nov 19 2020, 10:11 AM
QUOTE(McNULLty @ Nov 19 2020, 10:02 AM) *

AFAIK the issues that exist are that the stats sometimes are not updated at all (i.e. some players complain that their wins are never registered). Games with mismatches and disconnects should not get reported there at all.

So if I'm not mistaken, wins/losses should be correctly attributed. Note however that surrendering and/or exiting the game will result in a loss. E.g. sometimes a player immediately surrenders if they are not happy with their army. That is of course counted as a loss, but may not be useful ML training data (well, maybe it is, though...)


I can live with games not being registered, but if there are large portions of games misclassified that would of course be a problem. I actually think people exiting immediately will not be a problem. Could either manually set a minimum game length or actually just let the training data stay in there, like you suggest. A loss is a loss :-)

Excited to get started on this. I will initially just start with a small pilot with only a small amount of data, just to see if I get the formatting and pre-processing right. There will probably be some challenges.

Posts: 10


+
# 13SkyMix_RMT Nov 19 2020, 17:18 PM
This is freaking cool, I hope it works out perfectly.

If you need computational power for your project lemme know, I have a few idle servers atm.

Posts: 434

Game: CNC Zero Hour


+
# 14landsmannen Nov 19 2020, 17:43 PM
QUOTE(SkyMix_RMT @ Nov 19 2020, 17:18 PM) *

This is freaking cool, I hope it works out perfectly.

If you need computational power for your project lemme know, I have a few idle servers atm.


If it works it will be freaking cool :-) However I must give the usual precautions that a problem arises.

I am in no way able to work full time on this, but will try to get started small scale pretty soon. Opened up a git for the project. https://github.com/onordberg/cnc-generals-deep-replays

Posts: 10


+
# 15landsmannen Nov 19 2020, 18:31 PM
QUOTE(SkyMix_RMT @ Nov 19 2020, 17:18 PM) *

This is freaking cool, I hope it works out perfectly.

If you need computational power for your project lemme know, I have a few idle servers atm.


Thanks for the offer of compute power btw :-) Any GPUs? I am settled for small scale experiments, but might require more for an eventual full scale version

Posts: 10


+
# 16SkyMix_RMT Nov 19 2020, 19:29 PM
QUOTE(landsmannen @ Nov 19 2020, 18:31 PM) *

Thanks for the offer of compute power btw :-) Any GPUs? I am settled for small scale experiments, but might require more for an eventual full scale version


Yeah but let me warn you that they're not very powerful, I call them "servers" but they really just are old tech I've collected over the years, I made a room just for them in my house and use them for all sorts of experiments as well.

These are the specs of my current idle "servers":

IPB Image

I have no idea if they meet your standards though xD

I thought I'd offer help anyways.

Posts: 434

Game: CNC Zero Hour


+
# 17landsmannen Nov 20 2020, 17:47 PM
QUOTE(SkyMix_RMT @ Nov 19 2020, 19:29 PM) *

Yeah but let me warn you that they're not very powerful, I call them "servers" but they really just are old tech I've collected over the years, I made a room just for them in my house and use them for all sorts of experiments as well.

These are the specs of my current idle "servers":

IPB Image

I have no idea if they meet your standards though xD

I thought I'd offer help anyways.


Thanks :-)

Their GPUs may be a little too old for efficient neural net training to be 100% honest with you, but I really appreciate the positive and contributive attitude :-)

Posts: 10


+
# 18SkyMix_RMT Nov 20 2020, 20:19 PM
No worries, good luck with the project!

Posts: 434

Game: CNC Zero Hour


+
# 19xezon Dec 17 2020, 19:24 PM
CODE
Replay data layout:

6 bytes -> GENREP
4 bytes -> unix time for replay begin
4 bytes -> unix time for replay end
4 bytes -> replay frame duration
1 byte -> desync gameMode
1 byte -> early exit game
8 bytes -> disconnect flag for 8 players with 1 byte each
2 bytes string with null terminator -> file name
16 byte -> SYSTEMTIME structure
2 bytes string with null terminator -> game version
2 bytes string with null terminator -> game build date
2 bytes -> version minor
2 bytes -> version major
4 bytes -> exeCRC
4 bytes -> iniCRC
1 byte string with null terminator -> match data (UTF8)
1 byte string with null terminator -> local player index as string
2 bytes -> difficulty level
2 bytes -> game mode number
2 bytes -> fps value
x bytes -> all the rest

Meta data sample:

US=1;M=03maps/defcon6;MC=4E8DEEFD;MS=228789;SD=32168716;C=100;SR=0;
SC=10000;O=N;S=H^AbDUllaH,56618050,20361,TT,-1,-1,-1,0,9:H-|Dookie^,55BF36F2,15373,TT,7,-1,-1,0,1:
H-OpS^,D9A49146,22767,TT,-1,-1,-1,1,1:H~KaKa~{0},D9A49146,10919,TT,-1,-1,-1,1,1:
HTheDude,4FFD0605,16472,TT,-1,-1,-1,1,1:X:HAMG_Ex,5C82E68D,20952,TT,-1,-1,-1,0,1:X:;

Meta data breakdown:

US=1;
M=03maps/final crusade;
  ^ map class
         ^ map name
MC=50CA1031;
MS=190347;
SD=28928279;
C=100;
SR=0;
SC=10000;
   ^ start cash
O=N;
S=
HMENTALwinner,4FFD0554,0,TT,-1,-1,-1,-1,1:
^ H=Human                                
^ name                                  
              ^ ip hex                    
                       ^ port
                         ^ network?
                            ^ color
                               ^ army
                                  ^ start pos
                                     ^ team
                                        ^ unknown
CE,-1,-1,-1,-1:
^ C=CPU
^ E=Easy, M=Medium, H=Hard
   ^ color
      ^ army
         ^ team
            ^ unknown
O:
^ Open slot
X:
^ Closed slot
X:
X:
X:
X:;
  ^ end of meta data

Posts: 22,380

Clan: MENTAL

Game: CNC Zero Hour


+
# 20landsmannen Dec 27 2020, 23:14 PM
Thanks! That is very helpful. I have had a few busy weeks, but started up again on the project now. Received match history from ToxicShock @ shatabrick.

Posts: 10


+

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