mgz

Age of Empires II recorded game parsing and summarization in Python 3.

https://github.com/happyleavesaoc/aoc-mgz

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 22 committers (9.1%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.5%) to scientific vocabulary

Keywords

aoc aoe2 aoe2record mgz parser python
Last synced: 6 months ago · JSON representation

Repository

Age of Empires II recorded game parsing and summarization in Python 3.

Basic Info
  • Host: GitHub
  • Owner: happyleavesaoc
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 19.2 MB
Statistics
  • Stars: 217
  • Watchers: 19
  • Forks: 49
  • Open Issues: 8
  • Releases: 32
Topics
aoc aoe2 aoe2record mgz parser python
Created almost 11 years ago · Last pushed 6 months ago
Metadata Files
Readme License

README.md

mgz

Age of Empires II recorded game parsing and summarization in Python 3.

Supported Versions

  • Age of Kings (.mgl)
  • The Conquerors (.mgx)
  • Userpatch 1.4 (.mgz)
  • Userpatch 1.5 (.mgz)
  • HD Edition >= 4.6 (.aoe2record)
  • Definitive Edition (.aoe2record)

Architecture

The core functionality of mgz is a parser that produces a Python data structure based on a recorded game file. It also offers abstracted representations that make it easier to use the data.

Parsers

mgz offers two parsers, fast and full. The fast parser skips data that is rarely needed, while the full parser tries to parse as much as possible. Naturally, the fast parser is faster than the full parser. The full parser can do just about everything, the fast only maybe 80-90%. The summary will automatically try the fast parser and fall back to the full parser if needed.

Abstractions

Abstractions take parser output as input and return an object with normalized data that is easier to use for most cases. There are two abstractions available, summary and model. The summary abstraction attempts to expose the maximum amount of usable data. The model abstraction is more limited but automatically performs more lookups.

Support

| Version | model | summary | fast (header) | fast (body) | full (header) | full (body) | | --- | :-: | :-: | :-: | :-: | :-: | :-: | | Age of Kings (.mgl) | | ✓ | | ✓ | ✓ | | | The Conquerors (.mgx) | | ✓ | | ✓ | ✓ | | | Userpatch <= 1.4 (.mgz) | | ✓ | | ✓ | ✓ | ✓ | | Userpatch 1.5 (.mgz) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | HD Edition >= 4.6 | | ✓ | | ✓ | ✓ | ✓ | | HD Edition 5.8 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | Definitive Edition <= 13.34 (.aoe2record) | | ✓ | | ✓ | ✓ | ✓ | | Definitive Edition > 13.34, <= 26.21 (.aoe2record) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | Definitive Edition > 26.21 (.aoe2record) | ✓ | ✓ | ✓ | ✓ | ✓ | |

Examples

Full Parser (header) + Fast Parser (body)

```python import os from mgz import header, fast

with open('/path/to/file', 'rb') as data: eof = os.fstat(data.fileno()).stsize header.parsestream(data) fast.meta(data) while data.tell() < eof: fast.operation(data) ```

Summary

```python from mgz.summary import Summary

with open('/path/to/file', 'rb') as data: s = Summary(data) s.getmap() s.getplatform() # ... etc ```

Model

```python from mgz.model import parse_match

with open('/path/to/file', 'rb') as data: match = parse_match(data) match.map.name match.file.perspective.number # ... etc ```

To JSON

```python import json from mgz.model import parse_match, serialize

with open('/path/to/file', 'rb') as h: match = parse_match(h) print(json.dumps(serialize(match), indent=2)) ```

Frequently Asked Questions

Q: Where are the end-of-game achievements/statistics?

A: In the postgame action, available only from Userpatch version.

Q: How can I tell the number of resources/kills/etc at a certain point?

A: You can't, without replaying the match in-game.

Q: How does a recorded game file work?

A: The first portion (the header) is a snapshot of the initial game state. The second portion (the body) is a list of moves made by players. The game loads the header, then applies each move to mutate the state according to the game rules.

Q: How can I install this package?

A: pip install mgz

Contribution

  • Pull requests & patches welcome

Resources

  • aoc-mgx-format: https://github.com/stefan-kolb/aoc-mgx-format
  • recage: https://github.com/goto-bus-stop/recage
  • recanalyst: http://sourceforge.net/p/recanalyst/
  • genie-rs: https://github.com/SiegeEngineers/genie-rs/tree/default/crates/genie-rec
  • bari-mgx-format: https://web.archive.org/web/20090215065209/http://members.at.infoseek.co.jp/aocai/mgx_format.html

Owner

  • Login: happyleavesaoc
  • Kind: user

GitHub Events

Total
  • Create event: 1
  • Release event: 1
  • Issues event: 13
  • Watch event: 16
  • Issue comment event: 41
  • Push event: 13
  • Pull request review event: 8
  • Pull request review comment event: 7
  • Pull request event: 13
  • Fork event: 7
Last Year
  • Create event: 1
  • Release event: 1
  • Issues event: 13
  • Watch event: 16
  • Issue comment event: 41
  • Push event: 13
  • Pull request review event: 8
  • Pull request review comment event: 7
  • Pull request event: 13
  • Fork event: 7

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 411
  • Total Committers: 22
  • Avg Commits per committer: 18.682
  • Development Distribution Score (DDS): 0.163
Past Year
  • Commits: 16
  • Committers: 3
  • Avg Commits per committer: 5.333
  • Development Distribution Score (DDS): 0.563
Top Committers
Name Email Commits
happyleavesaoc h****r@g****m 344
Paulius p****p@f****m 12
Void / aoe2insights.com c****t@a****m 10
abductedPlatypus a****s@g****m 9
Stéphane Bisinger s****e@s****h 7
Derek Jones d****s@a****u 5
Calle Svensson c****n@z****m 4
Carl Saldanha c****s 3
Dennis Keil d****0@g****m 2
Jens Nyman n****j@g****m 2
Mark Santolucito m****o@y****u 2
vivianthayil v****l@g****m 1
Dico200 d****s@g****m 1
Johannes Berger j****s@b****c 1
Lucas Chapuis l****s@g****r 1
Oliver Degener h****l@g****m 1
Philipp Omenitsch s****0 1
Philipp Schirmer p****p@s****e 1
Skazu k****n@a****t 1
chesterip c****0@g****m 1
hiiwave h****e@g****m 1
jchmb b****m@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 80
  • Total pull requests: 51
  • Average time to close issues: 3 months
  • Average time to close pull requests: 30 days
  • Total issue authors: 51
  • Total pull request authors: 26
  • Average comments per issue: 3.24
  • Average comments per pull request: 2.1
  • Merged pull requests: 39
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 13
  • Pull requests: 13
  • Average time to close issues: 6 days
  • Average time to close pull requests: 8 days
  • Issue authors: 8
  • Pull request authors: 5
  • Average comments per issue: 1.54
  • Average comments per pull request: 2.23
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • denniske (12)
  • Namek (6)
  • M1ngXU (4)
  • gregstein (2)
  • yoshi3241 (2)
  • Guimoute (2)
  • Defozo (2)
  • NathanFlegg (2)
  • thepalbi (2)
  • reactormonk (2)
  • loach2020 (2)
  • ZetaTwo (2)
  • jdekarske (2)
  • DjSapsan (1)
  • cute-cirno (1)
Pull Request Authors
  • Skazu (13)
  • ZetaTwo (6)
  • Kjir (6)
  • abductedPlatypus (4)
  • qwyt (2)
  • yilinho (2)
  • denniske (2)
  • happyleavesaoc (2)
  • dj0wns (2)
  • cjds (1)
  • connorjclark (1)
  • vivianthayil (1)
  • hiiwave (1)
  • Guimoute (1)
  • MLeadbetter (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 762 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 6
  • Total versions: 87
  • Total maintainers: 1
pypi.org: mgz

Parse Age of Empires 2 recorded games.

  • Versions: 87
  • Dependent Packages: 0
  • Dependent Repositories: 6
  • Downloads: 762 Last month
Rankings
Stargazers count: 5.3%
Dependent repos count: 6.0%
Forks count: 6.2%
Average: 7.3%
Downloads: 9.0%
Dependent packages count: 10.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/main.yml actions
  • actions/checkout v2 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
setup.py pypi
  • aocref >=2.0.8
  • construct ==2.8.16
  • dataclasses ==0.8
  • tabulate >=0.9.0