Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for reading gameplay? #1

Open
boombatower opened this issue Sep 25, 2014 · 11 comments
Open

Support for reading gameplay? #1

boombatower opened this issue Sep 25, 2014 · 11 comments

Comments

@boombatower
Copy link

I scanned through documentation and some code, but I don't see anything to read the actual game play information instead of just stats and initial points.

A couple of questions if you feel like answering, otherwise I just need to do more research.

  • Is the record game file writen in useful chunks that one could parse gameplay out of it as the game proceeds? (assuming written at some regular interval)
  • Alternatively do you know of documentation (or better yet code) for acting as an observer client? I assume voobly has some sort of code or perhaps purely a packet proxy for its observer mode.

Basically, I am looking to read the actual state changes of the game (preferably during gameplay, but postprocessing would be a good first step) to supplement the UI.

Since you seem to have experience digging into some of this stuff just looking for some thoughts if you have time. Thanks.

@goto-bus-stop
Copy link
Owner

wuups, got lost in all my watching notifications :'

Rec game bodies consist of a series of commands. This has all the gameplay stuff in it so you could parse it out if you know what all the commands mean. Biegleux put a few parsers in there (the building creation, unit creation, and research ones), but I don't know about the others.

A lot of stuff isn't recorded though. For example, when a building is destroyed or a player is defeated, the game figures that out at playback time so it doesn't store that in the recorded game files. This stuff depends on the entire rest of the engine, pretty much, so you can't figure that out without recreating the entire thing and simulating the game yourself. This is a problem for RecAnalyst in some cases, as there is no way to detect when a player is defeated, and no way to detect researches that have been stopped because a building was destroyed.

As for spectator mode, that's a UserPatch feature (not a Voobly specific thing at all); UserPatch ships with a age2_x1/spectate.exe for spectating games. I'm don't know how to programmatically launch the spectator mode, though.

@boombatower
Copy link
Author

Thanks for the reply! I'll have to take a look at the building created stuff and what not. I won't need to handle player defeated or tech stuff, but I understand your point. Perhaps getting something basic working is possible.

@stefan-kolb
Copy link

@boombatower You may want to check out this repository: https://github.com/stefan-kolb/aoc-mgx-format
I already collected quite a lot of actions that are recorded inside the body of the mgx file. It's by far not complete but could be a good point to start from.

@boombatower
Copy link
Author

Nice, thanks!

@bowswung
Copy link

Just in case anyone looks at this in the future, I must respectfully disagree with @mtzander . It is possible to reconstruct a lot of information about buildings and units using solid inferences and without resorting to guesswork, as you can see from this.

@danielsuter
Copy link

@bowswung They seem to have additional data from their client. From the specifications available there's no way to detect a death without having the engine simulation.

@IamFlea
Copy link

IamFlea commented Jul 22, 2020

@danielsuter Hello, we have already solved that with bowswung. We made a tool called MAGAGA reader that logs simulation into flatbuffers which can be used in any language. You can ask him for getting this tool.

Aside of detecting deaths, we also hooked damage dealing function. And we also speed the game simulation up to less than 5 minutes.

@danielsuter
Copy link

@IamFlea Hi, thank you for your answer. Do you run the actual Replay using age of Empires? Or do you have do use a mod when playing AOE2 which logs additional information?

@goto-bus-stop
Copy link
Owner

goto-bus-stop commented Jul 30, 2020

note that the file that bowswung linked in #1 (comment) is inferred only from the recorded game. the tool Flea mentioned runs the actual replay using age of empires at high speed, with some code injected to log additional information.

@danielsuter
Copy link

@goto-bus-stop What confuses me that the log referred to in that comment is called simHistory. So that would mean deaths and everything can be inferred from the actual replay/recorded game in Aoe2De without actually replaying the game? The documentations I found only identified actions commands, so you would require the actual engine with the correct page to get data such as deaths or produced units.

@goto-bus-stop
Copy link
Owner

The recorded game file only records actions, but bowswung found ways to use that limited data to infer lots of things about the game. It's not 100% accurate, because it can't be. Most of the conversation about that is here: #17
The code that does it is in the linked repo. The entry point is https://github.com/bowswung/voobly-scraper/blob/d49d7a20d8555c03aa7f5d771c7b0eb8d9f1e4da/src/Data/Mgz/Simulate.hs.

It's true that you need to actually run the engine for accurate data, which AFAIK is currently only possible in AoC with UserPatch using the MAGAGA tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants