RecAnalyst is a PHP package for analyzing Age of Kings, The Conquerors, Forgotten Empires and Age of Empires 2 HD (The Forgotten) recorded games.
Based on Biegleux's work, but now with RecAnalyst\
namespace, Composer support and some fixes to actually make it work again.
v2.1.0 (c) 2007-2010 biegleux biegleux@gmail.com
Original project homepage
Original project documentation
RecAnalyst needs PHP5 with GD installed, and zlib if you want to use RecAnalyst\Archive
.
- Make
RecAnalyst\Archive
do things. - Proper documentation.
git clone https://github.com/goto-bus-stop/recanalyst
.
You'll need to manually add an Autoloader, something like:
spl_autoload_register(function ($class) {
if (substr($class, 0, 11) === 'RecAnalyst\\') {
$f = PATH_TO_RECANALYST . 'src/' . str_replace('RecAnalyst\\', '', $class) . '.php'
if (file_exists($f)) include($f);
}
});
GPL-3. See also ./COPYING
.
$ra = new RecAnalyst\RecAnalyst();
$ra->load($filename, fopen($filename, 'r'));
$ra->analyze();
// generateMap returns a GD image resource
$gd = $ra->generateMap();
header('Content-Type: image/png');
imagepng($gd);
imagedestroy($gd);
// with $ra of above
foreach ($ra->pregameChat as $chat) {
echo '<' . $chat->player->name . '> ' . $chat->msg . "\n";
}
foreach ($ra->ingameChat as $chat) {
echo '[' . RecAnalyst\RecAnalyst::gameTimeToString($chat->time) . '] ' .
'<' . $chat->player->name . '> ' . $chat->msg . "\n";
}
Location of RecAnalyst graphic resources. Defaults to 'path_to_RecAnalyst/resources/'
.
Width of generated minimap images. Defaults to 204
.
Height of generated minimap images. Defaults to 102
. For best results, this should be ½× mapWidth.
Whether to highlight players' starting positions with a big fat circle in their colour. Defaults to true
.
Size of research icons in generated research images. Defaults to 19
.
Vertical distance between player/research rows in generated research images. Defaults to 8
.
Background image for generated research images. Has to be jpeg! :( Defaults to $config->resourcesDir . 'background.jpg'
.
Colour to use as research row background while in Dark age in research images. Array of red, green, blue, alpha
values as taken in by imagecolorallocatealpha
. (eg. array(0, 0, 0, 127)
)
Colour to use as research row background while in Feudal age in research images. Array of red, green, blue, alpha
values as taken in by imagecolorallocatealpha
. (eg. array(0, 0, 0, 127)
)
Colour to use as research row background while in Castle age in research images. Array of red, green, blue, alpha
values as taken in by imagecolorallocatealpha
. (eg. array(0, 0, 0, 127)
)
Colour to use as research row background while in Imperial age in research images. Array of red, green, blue, alpha
values as taken in by imagecolorallocatealpha
. (eg. array(0, 0, 0, 127)
)
Loads a recorded game. $input
is a file resource (fopen
) or a string containing file contents (eg from file_get_contents
)
Analyzes a recorded game. Returns true on success, false on error.
Generates a minimap image. Returns GD Image resource.
Contains game settings information, such as map type and map size.
Contains recorded game information, such as duration and game version.
Plain array of players. Items are instances of RecAnalyst\Player
.
Two-dimensional array of teams of players. Same data as above but also indexed by team. ($teams[$teamId][$n]
)
Builds an hh:mm:ss string from the given number of seconds.
Returns game type string. (eg. "Random map", "Deathmatch") Names in RecAnalystConst::$GAME_TYPES
.
Returns map style string. (eg. "Real World", "Standard") Names in RecAnalystConst::$MAP_STYLES
.
Returns difficulty level string. (eg. "Hard", "Standard") Names in RecAnalystConst::$DIFFICULTY_LEVELS
.
Returns game speed string. (eg. "Slow", "Fast") Names in RecAnalystConst::$GAME_SPEEDS
.
Returns Reveal Map setting. (eg. "Explored", "All Visible") Names in RecAnalystConst::$REVEAL_SETTINGS
.
Returns map size. (eg. "Tiny", "Large") Names in RecAnalystConst::$MAP_SIZES
.
Returns whether the game type is Scenario.
Returns the name of the map this was played on. Names for the built-in maps in RecAnalystConst::$MAPS
.
Returns the population limit. (eg. 150, 200)
Returns whether diplomacy was locked.
Returns a RecAnalyst\VictorySettings
instance describing the victory settings used in this game.
Returns Game Version. (eg. "AOC 1.0c", "AOC UP1.4") Names in RecAnalystConst::$GAME_VERSIONS
.
Returns a string describing the teams. (eg. "1v1", "4v2v2", "FFA")
Returns the POV player's name.
Returns the POV player's name, with any co-oping players between brackets. (eg. "TheViper (Jordan_23, whack)")
Returns whether there is a co-oping player in the game.
Returns the duration of the game in seconds.
Returns the scenario Objectives of this game. Only populated if the game type is Scenario.
Returns the filename of the scenario played in this game. Only populated if the game type is Scenario.
Returns the Civilization name played by this player. (eg. "Britons", "Italians") Names in RecAnalystConst::$CIVILIZATIONS
.
Returns true if player is human, false if it is an AI.
Returns whether the player is co-oping.
Returns the index of the player's team in RecAnalyst::$teams
.
Returns this player's name.
Returns this player's feudal age advance time.
Returns this player's castle age advance time.
Returns this player's imperial age advance time.
Returns this player's resignation time.
Array of Player
s in this team.
Game Time in seconds at which this message was sent.
Player that sent this message, or null
for system messages (eg. age advance, resign)
Message content.
Group this message was sent to, or ""
(empty string) if there is none. (eg. "Team", "Enemy", "All")
Current player's Starting Age name. (eg. "Dark Age")
Amount of food at the start of the game.
Amount of wood at the start of the game.
Amount of gold at the start of the game.
Amount of stone at the start of the game.
Current player's Starting Age.
Initial house capacity.
Initial population. (4 in a standard game, 5 for Mayans, 7 for Chinese)
Initial Civilian population. (villagers, trade units, …)
Initial Military population. (Scout, usually)
Initial extra population. (???)
Starting position, [$x, $y]
.