metrics
— sc2metric¶
Metrics gathered from Starcraft 2 replay data.
-
class
metrics.sc2metric.
Sc2MetricAnalyzer
[source]¶ A class that derives useful metrics from replay files
This class is an extension to the
sc2reader
player class. It is meant to be used to offer useful metric data to each player in a Starcraft II replay. The class contains raw data gathered from each replay to derive its metrics. The raw data is filled from theplugins
associated with this package.-
army_created
= None¶ A list of
SupplyCount
for each army supply created.
-
workers_created
= None¶ A list of
SupplyCount
for each worker created.
-
supply_created
= None¶ A list of
SupplyCount
for each unit created.
-
resources
= None¶ A list of
ResourceCount
for resources collected and resources unspent every 10 seconds.
-
avg_apm
= None¶ The player’s average apm
-
avg_spm
= None¶ The player’s average spm
-
avg_sq
()[source]¶ Average Spending Quotient
Calculates the average Spending Quotient (SQ).
Returns: The average Spending Quotient (SQ). Return type: int
-
avg_sq_at_time
(time_s)[source]¶ Average Spending Quotient up to a specified time
Calculates the average Spending Quotient (SQ) up until the specified time.
Parameters: time_s (int) – The time in the replay to stop calculating spending quotient. Returns: The average Spending Quotient (SQ) up until the specified time. Return type: int
-
avg_sq_pre_max
()[source]¶ Average Spending Quotient before max supply
Calculates the average Spending Quotient (SQ) up until the player first reaches max supply.
Returns: - The average Spending Quotient (SQ) up until the player first
- maxes.
Return type: int
-
aur
()[source]¶ Average Unspent Resources
Calculates the Average Unspent Resources (AUR) during the game.
Returns: The Average Unspent Resources (AUR) Return type: int
-
aur_at_time
(time_s)[source]¶ Averague Unspent Resources up to a specified time
Calculates the Average Unspent Resources (AUR) up until the specified time.
Parameters: time_s (int) – The time in the replay to stop calculating average unspent resources. Returns: - The Average Unspent Resources (AUR) up until the specified
- time.
Return type: int
-
aur_pre_max
()[source]¶ Average Unspent Resources before max supply
Calculates the Average Unspent Resources (AUR) up until the player first reaches max supply.
Returns: - The Average Unspent Resources (AUR) up until the player first
- maxes.
Return type: int
-
avg_rcr
()[source]¶ Average Resource Collection Rate
Calculates the average Resource Collection Rate (RCR) during the game.
Returns: The average Resource Collection Rate (RCR) Return type: int
-
avg_rcr_at_time
(time_s)[source]¶ Average Resource Collection Rate up to a specified time
Calculates the average Resource Collection Rate (RCR) up until the specified time.
Parameters: time_s (int) – The time in the replay to stop calculating average resource collection rate. Returns: - The average Resource Collection Rate (RCR) up until the
- specified time.
Return type: int
-
avg_rcr_pre_max
()[source]¶ Average Resource Collection Rate before max supply
Calculates the average Resource Collection Rate (RCR) up until the player first reaches max supply.
Returns: - The average Resource Collection Rate (RCR) up until the player
- first maxes.
Return type: int
-
supply_capped
()[source]¶ Time spent supply capped
Determines the amount of time the player was supply capped this game. Supply capped is acknowledged when supply of units = supply created when supply created < 200.
Returns: The amount of time spent supply capped. Return type: int
-
supply_at_time
(real_time_s)[source]¶ The current supply used at the specified time.
Calculates the current supply used at the time.
Parameters: real_time_s (int) – The time (in seconds) of the replay to count supply. Returns: The current amount of supply used in the given time. Return type: int
-
first_time_to_supply
(supply)[source]¶ The first time that the specified supply was reached.
Finds the time when the specified supply was reached.
Parameters: supply (int) – The supply desired. Returns: The time when the supply was first reached. Return type: int
-
workers_created_at_time
(time_s)[source]¶ Number of workers created up to the specified time
Determines the total number of workers created at the specified time. This function is accumulative and does not handle workers lost.
Parameters: time_s (int) – The time (in seconds) of the replay to count workers. Returns: The number of workers created. Return type: int
-
army_created_at_time
(game_time_s)[source]¶ The army supply created up to a specified time
Calculate the total army supply created at the specified time.
Parameters: game_time_s (int) – The time (in seconds) of the replay to count army supply. Returns: The amount of army supply created in the given time. Return type: int
-
supply_created_at_time
(real_time_s)[source]¶ The total supply created up to a specified time
Calculate the total supply created at the specified time.
Parameters: real_time_s (int) – The time (in seconds) of the replay to count supply. Returns: The amount of supply created in the given time. Return type: int
-
time_to_workers_created
(worker_count)[source]¶ The time at which the number of workers had been created
Finds the time that the specified number of workers have been created. This does not account for loss of workers.
Parameters: worker_count (int) – The number of workers to find the time created. Returns: The time at which the total number of workers were created. Return type: int
-
time_to_supply_created
(supply_count)[source]¶ The time at which the specified supply had been created
Finds the time when the specified supply was created. This does not take into account supply lost.
Parameters: supply_count (int) – The supply desired. Returns: The time when the supply was created in the replay. Return type: int
-
time_to_supply_created_max_workers
(supply_count, max_workers_counted)[source]¶ The time at which the specified supply had been created
Finds the time when the specified supply was reached, but only counts a specified number of workers towards that supply created count. This does not take into account supply lost.
Parameters: - supply_count (int) – The supply desired.
- max_workers_counted (int) – The maximum number of workers to count towards the supply created.
Returns: The time when the supply was created in the replay.
Return type: int
-
time_to_bases_created
(base_count)[source]¶ The time at which the number of bases had been created
Finds the time when the specified number of bases has been reached. This does not take into account any bases lost.
Parameters: base_count (int) – The number of bases desired. Returns: The time when the number of bases had been created. Return type: int
-
Containers¶
-
class
metrics.metric_containers.
FoodCount
(second, supply_used, supply_made)[source]¶ Container for tracking supply at a given second.
Parameters: - second (int) – The second in the game.
- supply_used (int) – The amount of supply used.
- supply_made (int) – The amount of supply made from supply buildings.
-
class
metrics.metric_containers.
BaseCount
(second)[source]¶ Container for the second a base was created in a game.
Parameters: second (int) – The second a base was created.
-
class
metrics.metric_containers.
SupplyCount
(second, total_supply, unit_supply, is_worker)[source]¶ Container for the supply of a player at a specified second in the game. Also includes the supply of the last unit created.
Parameters: - second (int) – The second in the game.
- total_supply (int) – The total supply used as this second in the game.
- unit_supply (int) – The supply of the last unit made.
- is_worker (bool) – Boolean that indicates whether the last unit made was a worker or not.
-
class
metrics.metric_containers.
ResourceCount
(second, res_col, res_unspent)[source]¶ Container for the resource collection rate and unspent at a specified second in the game.
Parameters: - second (int) – The second in the game.
- res_col (int) – The resource collection rate at this second in the game.
- res_unspent (int) – The unspent resources at this second in the game.