Class: VaultCoh::Replay

Inherits:
Object
  • Object
show all
Defined in:
lib/vault_coh/replay.rb

Overview

A complete representation of all information able to be parsed from a Company of Heroes 3 replay. Note that parsing is not yet exhaustive, and iterative improvements will be made to pull more information from replay files over time.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_bytes(bytes) ⇒ Replay

Takes a byte slice, parses it as a CoH3 replay, and returns a representation of the parsed information. Any failures during parsing or conversion will return an error.

Examples:

require 'vault_coh'

bytes = File.read('/path/to/replay.rec').unpack('C*')
replay = VaultCoh::Replay.from_bytes(bytes)
puts replay.version

Parameters:

  • bytes (Array<Byte>)

    Byte array representation of a CoH3 replay file (required).

Returns:



23
# File 'lib/vault_coh/replay.rb', line 23

def self.from_bytes(bytes); end

Instance Method Details

#game_typeGameType::SKIRMISH|GameType::MULTIPLAYER|GameType::AUTOMATCH|GameType::CUSTOM

The type of game this replay represents. Note that this information is parsed on a best-effort basis and therefore may not always be correct. Also note that it’s currently not known if there’s a way to differentiate between automatch and custom games for replays recorded before the replay system release in patch 1.4.0. Games played before that patch will be marked as either skirmish (for local AI games) or multiplayer (for networked custom or automatch games). Games recorded on or after patch 1.4.0 will properly differentiate between custom and automatch games.



54
# File 'lib/vault_coh/replay.rb', line 54

def game_type; end

#lengthInteger

A simple count of the number of ticks that were executed in this match. Because CoH3’s engine runs at 8 ticks per second, you can divide this value by 8 to get the duration of the match in seconds.

Returns:

  • (Integer)


104
# File 'lib/vault_coh/replay.rb', line 104

def length; end

#mapMap

Map information for this match.

Returns:



74
# File 'lib/vault_coh/replay.rb', line 74

def map; end

#map_filenameString

Filename of the map this match was played on. See Map#filename for more information.

Returns:

  • (String)


80
# File 'lib/vault_coh/replay.rb', line 80

def map_filename; end

#map_localized_description_idString

Localization ID of the map’s description. See Map#localized_description_id for more information.

Returns:

  • (String)


92
# File 'lib/vault_coh/replay.rb', line 92

def map_localized_description_id; end

#map_localized_name_idString

Localization ID of the map’s name. See Map#localized_name_id for more information.

Returns:

  • (String)


86
# File 'lib/vault_coh/replay.rb', line 86

def map_localized_name_id; end

#matchhistory_idInteger|NilClass

The ID used by Relic to track this match on their internal servers. This ID can be matched with an ID of the same name returned by Relic’s CoH3 stats API, enabling linkage between replay files and statistical information for a match. When the game type is skirmish, there is no ID assigned by Relic, so this will be nil.

Returns:

  • (Integer|NilClass)

    unsigned, 64 bits



63
# File 'lib/vault_coh/replay.rb', line 63

def matchhistory_id; end

#mod_uuidString

The UUID of the base game mod this replay ran on. If no mod was used, this will be a nil UUID (all zeroes).

Returns:

  • (String)


69
# File 'lib/vault_coh/replay.rb', line 69

def mod_uuid; end

#playersArray<Player>

A list of all players who participated in this match.

Returns:



97
# File 'lib/vault_coh/replay.rb', line 97

def players; end

#timestampString

A UTF-16 representation of the recording user’s local time when the replay was recorded. Note that value may contain non-standard characters and is not guaranteed to be parsable into an accurate date/time format.

Returns:

  • (String)


41
# File 'lib/vault_coh/replay.rb', line 41

def timestamp; end

#to_hHash

Returns a hash representation of the object.

Returns:

  • (Hash)


109
# File 'lib/vault_coh/replay.rb', line 109

def to_h; end

#versionInteger

The Company of Heroes 3 game version this replay was recorded on. Note that this is probably more accurately described as the build version, and represents the final segment of digits you see in the game version on the game’s main menu. Every time the game is patched, this version will change, and replays are generally only viewable on the same game version they were recorded on.

Returns:

  • (Integer)

    unsigned, 16 bits



33
# File 'lib/vault_coh/replay.rb', line 33

def version; end