@@ -12,17 +12,17 @@ import (
1212
1313// DemoHeader contains information from a demo's header.
1414type DemoHeader struct {
15- Filestamp string
16- Protocol int
17- NetworkProtocol int
18- ServerName string
19- ClientName string
20- MapName string
21- GameDirectory string
22- PlaybackTime float32
23- PlaybackTicks int
24- PlaybackFrames int
25- SignonLength int
15+ Filestamp string // aka. File-type, must be HL2DEMO
16+ Protocol int // Should be 4
17+ NetworkProtocol int // Not sure what this is for
18+ ServerName string // Server's 'hostname' config value
19+ ClientName string // Usually 'GOTV Demo'
20+ MapName string // E.g. de_cache, de_nuke, cs_office, etc.
21+ GameDirectory string // Usually 'csgo'
22+ PlaybackTime float32 // Demo duration in seconds (= PlaybackTicks / Server's tickrate)
23+ PlaybackTicks int // Game duration in ticks (= PlaybackTime * Server's tickrate)
24+ PlaybackFrames int // Amount of 'frames' aka demo-ticks recorded (= PlaybackTime * Demo's recording rate)
25+ SignonLength int // Length of the Signon package in bytes
2626}
2727
2828// FrameRate returns the frame rate of the demo (frames / demo-ticks per second).
@@ -49,34 +49,32 @@ func (h DemoHeader) TickTime() time.Duration {
4949
5050// Player contains mostly game-relevant player information.
5151type Player struct {
52- SteamID int64
53- Position r3.Vector
54- LastAlivePosition r3.Vector
55- Velocity r3.Vector
56- EntityID int
57- UserID int
58- Name string
52+ SteamID int64 // int64 representation of the User's Steam ID
53+ Position r3.Vector // In-game coordinates. Like the one you get from cl_showpos 1
54+ LastAlivePosition r3.Vector // The location where the player was last alive. Should be equal to Position if the player is still alive.
55+ Velocity r3.Vector // Movement velocity
56+ EntityID int // The ID of the player-entity, see Entity field
57+ UserID int // Mostly used in game-events to address this player
58+ Name string // Steam / in-game user name
5959 Hp int
6060 Armor int
6161 Money int
6262 CurrentEquipmentValue int
6363 FreezetimeEndEquipmentValue int
6464 RoundStartEquipmentValue int
65- ActiveWeaponID int
66- RawWeapons map [int ]* Equipment
67- AmmoLeft [32 ]int
65+ ActiveWeaponID int // Used internally to set the active weapon, see ActiveWeapon()
66+ RawWeapons map [int ]* Equipment // All weapons the player is currently carrying
67+ AmmoLeft [32 ]int // Ammo left in the various weapons, index corresponds to key of RawWeapons
6868 Entity * st.Entity
69- AdditionalPlayerInformation * AdditionalPlayerInformation
69+ AdditionalPlayerInformation * AdditionalPlayerInformation // Mostly scoreboard information such as kills, deaths, etc.
7070 ViewDirectionX float32
7171 ViewDirectionY float32
72- FlashDuration float32
72+ FlashDuration float32 // How long this player is flashed for from now on
7373 Team Team
7474 IsBot bool
7575 IsDucking bool
76- IsDisconnected bool
7776 HasDefuseKit bool
7877 HasHelmet bool
79- Connected bool
8078}
8179
8280// IsAlive returns true if the Hp of the player are > 0.
@@ -130,10 +128,10 @@ type Equipment struct {
130128type GrenadeProjectile struct {
131129 EntityID int
132130 Weapon EquipmentElement
133- Thrower * Player
134- Owner * Player
131+ Thrower * Player // Always seems to be the same as Owner, even if the grenade was picked up
132+ Owner * Player // Always seems to be the same as Thrower, even if the grenade was picked up
135133 Position r3.Vector
136- Trajectory []r3.Vector
134+ Trajectory []r3.Vector // List of all known locations of the grenade up to the current point
137135
138136 // uniqueID is used to distinguish different grenades (which potentially have the same, reused entityID) from each other.
139137 uniqueID int64
0 commit comments