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 is an attempt to mine out key strategic choices and statistics from an Age of Empires 2 game for further analysis. Built ontop of the mgz parser - see also (this fork)[https://github.com/aoeinsights/aoc-mgz] -, this package takes in a .AOE2RECORD file as input and produces a pandas Series which includes:

  • The military strategy choices of both players throughout the game, including unit choices, production numbers, timings of openings etc.,
  • The economic choices of each player through the game,
  • An analysis of the players' maps
  • And so on.

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 below).

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

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

Installation

pip install age-alyser

Usage and Documentation

Parsing Games

Currently only the advanced parser is implemented - in the future I intend to flesh out the API with 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)[https://github.com/happyleavesaoc/aoc-mgz] (and I'm not planning on maintaining a fork or anything)
  2. Updates to the game can often break 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
  • How strategies and choices are mined
  • Two key lines of analysis - Military and Economic strategy/tactics

AgeGame

  • Central object, contains key data for the game, also houses parsing behaviour

Appendices

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

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 model when it would complete based on queued villagers/techs etc.

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

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.1.tar.gz (28.1 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.1-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: age_alyser-0.0.1.tar.gz
  • Upload date:
  • Size: 28.1 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.1.tar.gz
Algorithm Hash digest
SHA256 41fe1fb0ce5ade38eb9da32d3978217b561e2332a173500660343c424ce1223e
MD5 340bec3ebdd7aa00279b1b0754b80211
BLAKE2b-256 490fdc020301093f5f64d24105ccf8671a50e59fb50a4cb2a3286811b15dde1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: age_alyser-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 28.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe94a8c285fe47528953ac9ca6186e6a8d48419a3f3fb25f719c2d717353bea1
MD5 f814eec8e44622131741a1a4969f97e0
BLAKE2b-256 6327fc18692579466e70545ee050ae0fe108b27ac8c71d54216989e789804b81

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