Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

demoinfocs-golang

> 编程语言
Open source

A Counter-Strike 2 Demo Parser for Go (demoinfo)

1.0K stars0 likes0 views
WebsiteGitHub

About

A Counter-Strike 2 Demo Parser for Go (demoinfo)

demoinfocs-golang - CS2 Demo Parser

A blazing fast, feature complete and production ready Go library for parsing and analysing of Counter-Strike 2 and Counter-Strike: Global Offensive (CS:GO) demos (aka replays).

Discussions / Chat

You can use Discord or GitHub Discussions to ask questions and discuss ideas about this project.

For business inquiries please use the contact information found on the GitHub profile.

Go Get

Counter-Strike 2 + Live Broadcast Parsing - aka. CSTV+

go get -u github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs

See broadcast example for live CSTV+ parsing

CS:GO

go get -u github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs

Table of Contents

  • Requirements
  • Quickstart Guide
    • Example
    • More Examples
    • Documentation
  • Features
  • Performance / Benchmarks
  • Versioning
  • Projects Using demoinfocs-golang
  • Development
    • Debugging
    • Testing
    • Generating Interfaces
    • Generating Protobuf Code
    • Git Hooks
  • Acknowledgements
  • License (MIT)

Requirements

This library requires at least go 1.27 to run. You can download the latest version of Go here.

Quickstart Guide

  1. Download and install the latest version of Go from golang.org or via your favourite package manager

  2. Create a new Go Modules project

terminal
mkdir my-project
cd my-project
go mod init my-project
go get -u github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs
  1. Create a main.go file with the example below

  2. Run go run main.go

Example

This is a simple example on how to handle game events using this library. It prints all kills in a given demo (killer, weapon, victim, was it a wallbang/headshot?) by registering a handler for events.Kill.

Check out the godoc of the events package for some information about the other available events and their purpose.

…

Sample Output

Running the code above will print something like this:

xms  crisby
tiziaN  Ex6TenZ
tiziaN  mistou
tiziaN  ALEX
xms  tiziaN
...
keev  to1nou
...

More Examples

Check out the examples folder for more examples, like how to generate heatmaps like this one:

Documentation

The full API documentation is available here on pkg.go.dev.

Features

  • Game events (kills, shots, round starts/ends, footsteps etc.) - docs / example
  • Tracking of game-state (players, teams, grenades, ConVars etc.) - docs
  • Grenade projectiles / trajectories - docs / example
  • Access to entities, server-classes & data-tables - docs / example
  • Access to all net-messages - docs / example
  • Chat & console messages 1 - docs / example
  • Matchmaking ranks (official MM demos only) - docs
  • Full POV demo support
  • JavaScript (browser / Node.js) support via WebAssembly - example
  • Easy debugging via build-flags
  • Built with performance & concurrency in mind

Performance / Benchmarks

Two of the top priorities of this parser are performance and concurrency.

Here are some benchmark results from a system with an Intel i7 6700k CPU and a SSD disk running Windows 10 and a demo with 85'000 frames.

Overview

Benchmark Description Average Duration Speed
BenchmarkConcurrent Read and parse 8 demos concurrently 2.06 s (per 8 demos) ~ 1 h 25 min of gameplay per second
BenchmarkDemoInfoCs Read demo from drive and parse 0.89 s ~ 25 min of gameplay per second
BenchmarkInMemory Read demo from memory and parse 0.88 s ~ 25 min of gameplay per second

Raw Output

…

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository. There is one caveat however: Beta features - which are marked as such via comments and in release notes - may change in minor releases.

Services, Projects & Companies Using demoinfocs-golang

  • noesis.gg - A suite of explorative tools to help you analyze and improve your CS2 performance
  • fastcup.net - CS2 matchmaking & tournament platform with match stats, demo analysis, and automatic highlight rendering
  • esportal.com - Tournament platform hosting some of the biggest CS2 & DotA tournaments/qualifiers
  • pglesports.com - Premier eSports tournaments and circuits for massive audiences
  • hltv.org - Leading Counter-Strike site featuring news, demos, pictures, statistics, on-site coverage and more
  • refrag.gg - The world's premier CS2 training tool
  • esportslab.gg - Building ML/AI tools for professional esports players
  • scope.gg - Analytical and advisory service for advanced CS2 players
  • clutchkings.gg - A project that helps CS2 players create and share gameplay clips easily
  • PureSkill.gg - An automated coach to help you get better at CS2
  • cs2lens.com - Professional CS2 demo replayer and analysis tool
  • awpy - A wrapper for the Golang parser in Python
  • CS2VoiceData - Extract voice communications from demos
  • CSC - A free league in NA providing a casual yet competitive environment
  • csskill.com - A CS2 performance and analytics platform featuring live demo parsing, 2D replay visualization, achievement tracking, and engagement-driven competitive features.

CS:GO projects (may no longer work with CS2)

  • cs-demo-minifier - Converts demos to JSON, MessagePack and more
  • csgo_spray_pattern_plotter - A tool to extract and plot spray patterns from CS:GO replays
  • CS:GO Player Skill Prediction - Machine learning master thesis by @quancore about predicting player performance
  • csgoverview - A 2D demo replay tool for CS:GO
  • csgo-coach-bug-detector - Detects the abuse of an exploit used by some team coaches in professional matches
  • megaclan3000 - A CS:GO stats page for clans with recent matches and player statistics

If your project is using this library feel free to submit a PR or send a message via Discord to be included in the list.

Useful Tools & Libraries

  • csgo-centrifuge - Get historic radar overview images to make 2D replays & heatmaps accurate on all map versions
  • head-position-model - Approximate the player's head position (rather than just the camera position)

Development

Debugging

You can use the build tag debugdemoinfocs to print out debugging information - such as game events or unhandled demo-messages - during the parsing process.

e.g.

go run -tags debugdemoinfocs examples/print-events/print_events.go -demo example.dem

Side-note: The tag isn't called debug to avoid naming conflicts with other libs (and underscores in tags don't work, apparently).

To change the default debugging behavior, Go's ldflags parameter can be used. Example for additionally printing out all server-classes with their properties: -ldflags="-X 'github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs.debugServerClasses=YES'".

e.g.

go run -tags debugdemoinfocs -ldflags="-X 'github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs.debugServerClasses=YES'" examples/print-events/print_events.go -demo example.dem

Check out debug_on.go for any other settings that can be changed.

Testing

Unit Tests

For any new features, Test Driven Development should be practiced where possible. However, due to some design flaws in some parts of the code it's currently not always practical to do so.

Running unit tests:

scripts/unit-tests.sh
# or (identical)
go test -short ./...

Regression Tests

For the full regression suite you will need to download the test demo-set.

Prerequisites:

  • Git LFS must be installed
  • 7z must be in your PATH environment variable (p7zip or p7zip-full package on most Linux distros)

Downloading demos + running regression tests:

scripts/regression-tests.sh

Updating the default.golden File

The file test/default.golden file contains a serialized output of all expected game events in test/cs-demos/s2/s2.dem.

If there is a change to ga

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gocounter-strikecounter-strike-2cs2csgo

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言