internal

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TickRoundStart denotes the tick at the very start of the round
	// (after freezetime)
	TickRoundStart string = "roundStart"

	// TickPreDamage denotes the tick where damage is being done, but before
	// the damage has been processed
	TickPreDamage string = "prePlayerDamage"

	// TickDamage denotes the tick where damage is being done, after the
	// damage has been processed
	TickDamage string = "playerDamage"

	// TickBombPlant denotes the tick where the bomb has just been planted
	TickBombPlant string = "bombPlant"

	// TickBombDefuseStart denotes the tick where a defuse has just started
	TickBombDefuseStart string = "bombDefuseStart"

	// TickBombDefuseAbort denotes the tick where a defuse has just been aborted
	TickBombDefuseAbort string = "bombDefuseAbort"

	// TickPreBombDefuse denotes the tick where the bomb has been defused, but
	// before the bomb defusal has been processed
	TickPreBombDefuse string = "preBombDefuse"

	// TickBombDefuse denotes the tick where the bomb has been defused,
	// after the bomb defusal has been processed
	TickBombDefuse string = "bombDefuse"

	// TickBombExplode denotes the tick where the bomb has exploded
	TickBombExplode string = "bombExplode"

	// TickTimeExpired denotes the tick where the round ends by time running out
	TickTimeExpired string = "timeExpired"

	// TickItemPickUp denotes the tick where an item has been picked up (or
	// bought) by a player
	TickItemPickUp string = "itemPickUp"

	// TickItemDrop denotes the tick where an item has been dropped (or used)
	// by a player
	TickItemDrop string = "itemDrop"

	// ActionDamage represents a player damaging another player
	ActionDamage string = "damage"

	// ActionTradeDamage represents a hurt player's attacker being damaged
	ActionTradeDamage string = "tradeDamage"

	// ActionFlashAssist represents a player flashing another player getting
	// damaged
	ActionFlashAssist string = "flashAssist"

	// ActionHurt represents a player being damaged
	ActionHurt string = "hurt"

	// ActionRetake represents a player defusing the bomb
	ActionRetake string = "retake"

	// ActionAlive represents a player simply being alive when the bomb
	// explodes, or when time expires
	ActionAlive string = "alive"
)

Variables

View Source
var Version string = "dev"

Version denotes the current application version (following semantic versioning) and should be set through build flags

Functions

func EvaluateDemo added in v0.3.0

func EvaluateDemo(taggedFilePath string, verbosity int, modelPath string)

EvaluateDemo processes a .tagged.json file, producing an Impact Rating report which is written to the console and a '.rating.json' file

func HasMatchFinished

func HasMatchFinished(score1 int, score2 int, mr int) bool

HasMatchFinished returns true if one of the two teams has won the match (reached (mr+1) rounds or won in overtime)

func IsLive

func IsLive(p *dem.Parser) bool

IsLive returns true if the parser is currently at a point where the gamestate should be saved

func TagDemo added in v0.3.0

func TagDemo(demoPath string, pretty bool) string

TagDemo processes the input demo file, creating a '.tagged.json' file in the same directory TODO: take in output path as a parameter to enable easier testing

Types

type GameState

type GameState struct {
	AliveCT      int     `json:"aliveCT"`
	AliveT       int     `json:"aliveT"`
	MeanHealthCT float64 `json:"meanHealthCT"`
	MeanHealthT  float64 `json:"meanHealthT"`
	MeanValueCT  float64 `json:"meanValueCT"`
	MeanValueT   float64 `json:"meanValueT"`
	RoundTime    float64 `json:"roundTime"`
	BombTime     float64 `json:"bombTime"`
	BombDefusing bool    `json:"bombDefusing"`
	BombDefused  bool    `json:"bombDefused"`
}

GameState holds the specific round state information used for model training/inference

func GetGameState

func GetGameState(p *dem.Parser, startTick int, plantTick int, defusing bool, defuseTick int, hurtEvent *events.PlayerHurt) GameState

GetGameState serialises the current state of the round using only the features we care about

type OverallRating added in v0.2.0

type OverallRating struct {
	AverageRating   float64         `json:"averageRating"`
	RatingBreakdown RatingBreakdown `json:"ratingBreakdown"`
}

OverallRating holds overall rating summary data for a single player

type Player

type Player struct {
	SteamID uint64 `json:"steamID"`
	Name    string `json:"name"`
	TeamID  int    `json:"teamID"`
}

Player holds data describing a player within the game

type PlayerRating added in v0.2.0

type PlayerRating struct {
	SteamID       uint64        `json:"steamID"`
	TeamID        int           `json:"teamID"`
	Name          string        `json:"name"`
	OverallRating OverallRating `json:"overallRating"`
	RoundRatings  []RoundRating `json:"roundRatings"`
}

PlayerRating holds rating summary data for a single player

type Rating

type Rating struct {
	RatingMetadata          RatingMetadata           `json:"metadata"`
	RoundsPlayed            int                      `json:"roundsPlayed"`
	Teams                   []TeamRating             `json:"teams"`
	Players                 []PlayerRating           `json:"players"`
	RatingChanges           []RatingChange           `json:"ratingChanges"`
	RoundOutcomePredictions []RoundOutcomePrediction `json:"roundOutcomePredictions"`
}

Rating holds all the data required in a rating demo json file - the outermost element

type RatingBreakdown

type RatingBreakdown struct {
	DamageRating      float64 `json:"damageRating"`
	FlashAssistRating float64 `json:"flashAssistRating"`
	TradeDamageRating float64 `json:"tradeDamageRating"`
	RetakeRating      float64 `json:"retakeRating"`
	HurtRating        float64 `json:"hurtRating"`
	AliveRating       float64 `json:"aliveRating"`
}

RatingBreakdown holds data to describe how an overall/single round rating is broken down into constituent actions

type RatingChange

type RatingChange struct {
	Tick   int     `json:"tick"`
	Round  Round   `json:"round"`
	Player uint64  `json:"player"`
	Change float64 `json:"change"`
	Action string  `json:"action"`
}

RatingChange holds data describing an individual rating change

type RatingMetadata added in v0.5.1

type RatingMetadata struct {
	Version string `json:"version"`
}

RatingMetadata holds all the metadata (version etc.) for a rating demo json file

type Round added in v0.7.1

type Round struct {
	Number  int `json:"number"`
	ScoreCT int `json:"scoreCT"`
	ScoreT  int `json:"scoreT"`
}

Round holds helper data describing a single round

type RoundOutcomePrediction

type RoundOutcomePrediction struct {
	Tick              int     `json:"tick"`
	Round             Round   `json:"round"`
	OutcomePrediction float64 `json:"outcomePrediction"`
}

RoundOutcomePrediction holds data describing the round outcome prediction at a specific tick

type RoundRating added in v0.2.0

type RoundRating struct {
	Round           Round           `json:"round"`
	TotalRating     float64         `json:"totalRating"`
	RatingBreakdown RatingBreakdown `json:"ratingBreakdown"`
}

RoundRating holds single-round rating summary data for a single player

type Tag

type Tag struct {
	Action string `json:"action"`
	Player uint64 `json:"player"`
}

Tag holds data for a single tick tag

type TaggedDemo added in v0.5.0

type TaggedDemo struct {
	TaggedDemoMetadata TaggedDemoMetadata `json:"metadata"`
	Ticks              []Tick             `json:"ticks"`
}

TaggedDemo holds all the data required in a tagged demo json file - the outermost element

type TaggedDemoMetadata added in v0.5.1

type TaggedDemoMetadata struct {
	Version string `json:"version"`
}

TaggedDemoMetadata holds all the metadata (version etc.) for a tagged demo file

type Team

type Team struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

Team holds data describing a team within the game

type TeamRating added in v0.9.0

type TeamRating struct {
	ID            int           `json:"id"`
	Name          string        `json:"name"`
	StartingSide  int           `json:"startingSide"`
	FinalScore    int           `json:"finalScore"`
	OverallRating OverallRating `json:"overallRating"`
	RoundRatings  []RoundRating `json:"roundRatings"`
}

TeamRating holds rating summary data for a whole team

type Tick

type Tick struct {
	Tick        int       `json:"tick"`
	Type        string    `json:"type"`
	ScoreCT     int       `json:"scoreCT"`
	ScoreT      int       `json:"scoreT"`
	TeamCT      Team      `json:"teamCT"`
	TeamT       Team      `json:"teamT"`
	Players     []Player  `json:"players"`
	GameState   GameState `json:"gameState"`
	Tags        []Tag     `json:"tags"`
	RoundWinner uint      `json:"roundWinner"`
}

Tick holds data related to a single in-game tick

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL