Skip to main content

A python package for extracting key features of an AOE2 recorded games

Project description

The Age-2-Alyser

This python package mines out key strategic choices and statistics from a recorded Age of Empires 2 game. The intention is to enable for further data analysis, including at scale. The package takes in a .AOE2RECORD file as input and produces a Pandas Series with statistical data about the match. This data includes:

  • The military strategy choices of both players throughout the game, including unit and strategy choices, production numbers, timings of openings, and so on.
  • The economic choices of each player through the game.
  • An analysis of the players' maps.
  • And some other miscellaneous data, such as elo difference and civilisations. The package is built on top of the mgz parser to parse in recorded games - see also this fork maintained by aoe insights.

The goal is to create an open source project that enables large scale analytics of the game. Capture Age provides incredible analysis tools for watching replays, however there is a gap in terms of being able to extract statistical data from games en masse for analytics purposes. The task is difficult, given the structure of an mgz file (see appendices below for a more detailed technical explanation).

Aside from this package, some other great projects I have come across which perform something similar are:

The goal of this package is to flesh out the statistical data we can mine from replays, and deliver it en masse to anyone who can bash up a python script. Feel free to contribute in any way (including a code review or building out tests or documentation).

Installation

pip install age-alyser

Usage and Documentation

Currently only the advanced parser is implemented - in the future I intend to flesh out the API with some other options.

import pandas as pd
from agealyser import AgeGame

g = AgeGame("file/path/to/game.aoe2record")
stats: pd.Series = g.advanced_parser()  # optional - include_map_analysis = False

Limitations

Given that:

  1. This package is dependant on the mgz package (and I'm not planning on maintaining a fork or anything)
  2. Updates to the game can often break mgz's parsing of a .aoe2record file
  3. This package is an WIP/unfinished alpha release

There may be a number of inaccuracies, errors, and bugs.

I would recommend wrapping the the above code in a try-except block. In the future I also intend to improve the error handling so the whole package fails more gracefully.

Modeling Structure and package API

AgeMap

  • Models the map itself and the resources/objects within
  • Identifies hills, resources, treelines, etc.
  • Attempts to extract relevant features from this, e.g. resources on front/hills, distance to opponent and so on.

GamePlayer

  • Models the decisions/strategies/tactics made by individuals
  • Identifies strategies, choices, etc.
  • Two key lines of analysis - Military and Economic

AgeGame

  • Central object, contains key data for the game (for example the GamePlayer and AgeMap objects), also houses mgz parsing behaviour.

Appendices

AOE Devleopment Utilities

MGZ file/recorded game structure

The .AOE2RECORD file type only contains the starting state of the game and the series of actions made by both players. This is extremely limiting when it comes to mining out statistics for a game.

For example, my original idea was to map growth in total resources as a proxy for player development and analyse the decisions that contributed to that. However, resources collected are not stored in the game files, and any modelling of villagers collecting resources would be difficult and woefully inaccurate (Modelling villager gather rates is extremely hard, what with their pathing, bumping, getting stuck, and the changing efficiency as the shape of a resource changes, etc. causing fluctuations in gather rates). In general, what can be mined out of the .aoe2record file is limited.

As such, things like up times might be imprecise, as the game only records when a player clicks the research button, and I have had to completely model the production of each Town Centre to identify when research would be complete, based on queued villagers/techs etc. Currently, the mgz package does not seem to handle unqueing units particularly well, which trickles down into further inaccuracies in this package.

This package has turned into an exploration into what the mgz package can produce, and trying to gleam from that as much as possible.

MGZ Parser version to use

If the original aoc-mgz is behind the current game update and therefore not functional, check aoeinsights version and use that fork:

git clone https://github.com/aoeinsights/aoc-mgz

then

python setup.py install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

age_alyser-0.0.3.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

age_alyser-0.0.3-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file age_alyser-0.0.3.tar.gz.

File metadata

  • Download URL: age_alyser-0.0.3.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for age_alyser-0.0.3.tar.gz
Algorithm Hash digest
SHA256 31fa735c9346eadb355acb96315f697823d19b191408395425e56df0fdd1a958
MD5 91943fbe9db4c7cd10bff5d62b243b2c
BLAKE2b-256 a7d16fe0037ee0ea3912a99770834c8d493defbe91107e9a4ce537097e815977

See more details on using hashes here.

File details

Details for the file age_alyser-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: age_alyser-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for age_alyser-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7a88931598e9ab653a5689bfb78dc3f5eff3c05c9ef0258924dfbb63aeebd4ca
MD5 fe0deec4e03072138f459f58b0135f5c
BLAKE2b-256 28a6eb808db48db655d26e7abd679d2388bfadc085ab433dc96c3acc037af69b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page