Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4: Support Counter-Strike 2 #383

Merged
merged 120 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
fdc3c5d
protobuf: updated to 5241dc7ccc9638aa24a5894e2fcabfa42285d255
github-actions[bot] Mar 23, 2023
3cbbb6e
Merge remote-tracking branch 'origin/master' into update-protobufs
markus-wa Mar 23, 2023
1c11b45
revert msg to s1, s2 is in msgs2
markus-wa Mar 23, 2023
4c4228f
WIP: parse Source 2 protos
markus-wa Mar 23, 2023
4bacd8c
s2: fix demo stop command
markus-wa Mar 23, 2023
af45dfa
s2: parse and dispatch net messages
markus-wa Mar 23, 2023
ce626d8
s2 progress
markus-wa Mar 28, 2023
67c9936
s2 event parsing
markus-wa Mar 28, 2023
0717011
s2 entity WIP (crashes)
markus-wa Mar 28, 2023
65d3fa0
tests: add -s2dem flag
markus-wa Mar 30, 2023
3cce79a
s2: some progress on entity parsing
markus-wa Mar 30, 2023
206e60f
s2: more minor progress
markus-wa Mar 30, 2023
227abd0
s2 simplifications
markus-wa Mar 30, 2023
dee997e
try to fix entity parsing
markus-wa May 15, 2023
582d55a
Merge pull request #384 from markus-wa/s2-entities
markus-wa May 18, 2023
f32db38
s2: fix proto name conflict
markus-wa May 18, 2023
cfbc213
fix CI (generated interfaces check)
markus-wa May 18, 2023
21b17a2
fix s1 stringtables
markus-wa May 18, 2023
f22f30b
add s2 test demo to dataset
markus-wa May 18, 2023
8e2146d
remove dead code
markus-wa May 18, 2023
0f49e28
add hltv_versioninfo to known events
markus-wa May 18, 2023
cfd9e52
upgrade golangci-lint
markus-wa May 18, 2023
d3c8779
fix & simplify a bunch of s2 code
markus-wa May 18, 2023
5dc8727
WIP: s2 entities part 2
markus-wa May 18, 2023
f156a8b
wip: serverclass iface
markus-wa May 28, 2023
9a30b33
S2 progress
markus-wa Jun 3, 2023
f425f2f
S2 PlayerController + PlayerPawn
markus-wa Jun 3, 2023
845c1da
fix isSource2()
markus-wa Jun 3, 2023
2c97ec8
S2 progress: parsing with player entities successful
markus-wa Jun 4, 2023
99d885f
S2 fix team scores
markus-wa Jun 4, 2023
0b1b9fe
fix test compilation
markus-wa Jun 4, 2023
7f64986
S2: fix pos + smaller fixes
markus-wa Jun 4, 2023
0eab70a
fix IsAlive()
markus-wa Jun 4, 2023
c2b617a
fix IsAlive test
markus-wa Jun 4, 2023
23ee21a
linting fixes
markus-wa Jun 4, 2023
afe697a
Merge pull request #385 from markus-wa/s2-entities-part2
markus-wa Jun 4, 2023
27d74d4
small s2 fixes
markus-wa Jul 9, 2023
4191c03
questionable S2 fixes
markus-wa Jul 9, 2023
4ce2670
cs2: fix after recent game updates
markus-wa Jul 9, 2023
6954733
cs2: fix namespace conflict (again)
markus-wa Jul 9, 2023
c4f7d82
fix: raise DataTablesParsed on CDemoClassInfo msg
akiver Aug 2, 2023
850ab37
fix: add AnimationData msg to known msg creators list
akiver Aug 2, 2023
5fed1a6
fix: float decoders round/cast issue
akiver Aug 2, 2023
c298f50
fix: entity prop values not updated properly
akiver Aug 2, 2023
3f1ed9e
feat: update header values from CDemoFileInfo
akiver Aug 2, 2023
ae10a7c
Merge pull request #391 from akiver/s2-1
markus-wa Aug 3, 2023
d33a909
tests: fix TestRecoverFromUnexpectedEOF
markus-wa Aug 3, 2023
79b38bd
tests: disable TestPlayer_Armor
markus-wa Aug 3, 2023
29189b5
fix CodeQL go/incorrect-integer-conversion
markus-wa Aug 3, 2023
a9b2d53
fix: working player position
akiver Aug 4, 2023
c43868d
fix: make some player props working
akiver Aug 4, 2023
bf8f7cb
Merge pull request #392 from akiver/s2-2
markus-wa Aug 4, 2023
3e0d48f
feat: update header info from CDemoFileHeader and detect POV demos
akiver Aug 4, 2023
026c2d1
Merge pull request #394 from akiver/s2-3
markus-wa Aug 6, 2023
7371fa2
cs2: implement polyType for CCSGameModeRules_Noop
markus-wa Aug 6, 2023
b19b7f0
cs2: fix poly type serializers
markus-wa Aug 6, 2023
744b6ba
cs2: parseFrameFn
markus-wa Aug 6, 2023
5ea52a2
cs2: PropertyValue.Any for csgo
markus-wa Aug 6, 2023
733c05a
cs2: fix OnDestroy()
markus-wa Aug 6, 2023
f7494ee
cs2: extract polyTypeIndex var for debugging
markus-wa Aug 6, 2023
39d83e4
cs2.md - some notes & docs of cs2 events & net messages
markus-wa Aug 6, 2023
fe2a49f
cs2: add isSource2 method to demoInfoProvider
BestAwperEver Aug 7, 2023
7b0d0ba
fix: return an empty position if pawnEntity is nil
BestAwperEver Aug 7, 2023
961e910
feat: weapons support
akiver Aug 7, 2023
872e473
fix: player pitch/yaw
akiver Aug 5, 2023
557354f
Merge pull request #396 from akiver/s2-bind-weapons
markus-wa Aug 7, 2023
56883fa
Merge pull request #395 from BestAwperEver/demoInfoProvider-isSource2
markus-wa Aug 7, 2023
f1f4260
fix: update player's team based on prop
akiver Aug 7, 2023
44e4611
fix: player's Source 2 props access
akiver Aug 7, 2023
2a2c40d
feat: add OvertimeCount game state prop
akiver Aug 7, 2023
c445646
Merge pull request #397 from akiver/s2-more
markus-wa Aug 7, 2023
1066d6a
cs2: add props to cs2.md
markus-wa Aug 8, 2023
877a3da
examples: clean up
markus-wa Aug 8, 2023
8b28235
cs2: fix grenade projectiles
markus-wa Aug 8, 2023
7c3faa9
cs2: re-fix #42 grenades at end of round
markus-wa Aug 8, 2023
1b802e4
fix: missing mocks test
akiver Aug 8, 2023
87bf84a
csgo: fix nade trajectories
markus-wa Aug 9, 2023
664b09d
Merge branch 's2' into s2-projectiles
markus-wa Aug 10, 2023
ef9e219
Merge pull request #398 from akiver/s2-projectiles
markus-wa Aug 10, 2023
bf4c6e5
fix compilation error after merge
markus-wa Aug 10, 2023
1b0d771
fix: adjust IsSpottedBy for source 2
BestAwperEver Aug 10, 2023
44d447d
Merge pull request #399 from BestAwperEver/s2-is-spotted-by
markus-wa Aug 10, 2023
47e9228
fix: player.isAlive not accurate
akiver Aug 10, 2023
f7e17ad
feat: add missing round end reason values
akiver Aug 10, 2023
ec4cba6
feat: handle convar message
akiver Aug 10, 2023
7c66403
fix: bomb carrier always nil
akiver Aug 10, 2023
a38a979
fix: player pawn entity ID not updated
akiver Aug 10, 2023
5d11edd
feat: update playback values for demos with missing CDemoFileInfo msg
akiver Aug 13, 2023
1dc7546
fix: inferno owner may be nil
akiver Aug 14, 2023
ca102fe
Merge pull request #400 from akiver/s2-fixes
markus-wa Aug 14, 2023
9b19485
fix: fallback for the case of nil entity
BestAwperEver Aug 15, 2023
93932e9
feat: more source 2 player props support
akiver Aug 15, 2023
de76ed0
Merge pull request #402 from akiver/s2-player
markus-wa Aug 16, 2023
cb5c345
Merge pull request #401 from BestAwperEver/s2-is-alive
markus-wa Aug 16, 2023
0f4e5c6
feat: bomb/round events
akiver Aug 11, 2023
4b8aa4f
feat: PlayerFlashed and FlashbandExploded events
akiver Aug 13, 2023
3aa760d
fix: dispatch game events in a more expected order
akiver Aug 13, 2023
59490d9
feat: weapon fire event
akiver Aug 14, 2023
e458206
feat: add MimicSource1GameEvents option
akiver Aug 17, 2023
4c5c033
fix: add missing weapon name to mapping
BestAwperEver Aug 21, 2023
951ee0e
feat: MimicSource1GameEvents to DisableMimicSource1GameEvents
akiver Aug 21, 2023
999291c
Merge pull request #403 from akiver/s2-events
markus-wa Aug 22, 2023
43415bc
Merge pull request #404 from BestAwperEver/s2-missing-weapon-name
markus-wa Aug 22, 2023
4ee6efa
fix: possible crash player props
akiver Aug 24, 2023
fd8b76b
Merge pull request #405 from akiver/s2-fix-player
markus-wa Aug 27, 2023
2a73a06
s2 protos
markus-wa Sep 1, 2023
2e45e53
bump to v4, upgrade go to 1.21
markus-wa Sep 1, 2023
6f75f98
Merge remote-tracking branch 'origin/master' into s2
markus-wa Sep 1, 2023
9da75d8
go mod upgrade
markus-wa Sep 1, 2023
d89c11d
readme: more cs2 warning
markus-wa Sep 1, 2023
b58ebff
upgrade ice-cipher-go to version with license
markus-wa Sep 1, 2023
2dc0bb0
readme: require go 1.21
markus-wa Sep 1, 2023
2a78530
ci: use go 1.21
markus-wa Sep 1, 2023
0d21c36
ci: fix generated interfaces check
markus-wa Sep 1, 2023
3ec2c75
fix tests that need to know if we're on S2 or not
markus-wa Sep 1, 2023
76733a6
s2 test fixes
markus-wa Sep 1, 2023
e7589ec
fix s2 demo path
markus-wa Sep 1, 2023
d4b826a
fix golden file for BombPlantAborted & OvertimeNumberChanged
markus-wa Sep 1, 2023
996c386
fix ErrUnexpectedEndOfDemo test
markus-wa Sep 1, 2023
082a961
s2 demo set
markus-wa Sep 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ name: CI

jobs:
ci:
strategy:
matrix:
go-version: [1.18.x]

runs-on: ubuntu-latest

env:
Expand All @@ -18,7 +14,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
go-version: 1.21.x

- name: Install Reviewdog
uses: reviewdog/action-setup@v1
Expand All @@ -37,14 +33,14 @@ jobs:
sudo apt-get install -y p7zip-full

# Install interface generator
go install github.com/vburenin/ifacemaker@v1.1.0
go install github.com/vburenin/ifacemaker@v1.2.1

# Fetch refs for linter
git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
git fetch

# Install golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2

- name: Build
run: scripts/build.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/protobuf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
if: env.PROTOBUFS_CHANGED == 'true'
uses: actions/setup-go@v2
with:
go-version: 1.18.x
go-version: 1.21.x

- name: Install Protobuf tools
if: env.PROTOBUFS_CHANGED == 'true'
Expand Down
4 changes: 0 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- exportloopref
Expand All @@ -36,12 +34,10 @@ linters:
- nolintlint
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
- asciicheck
- gocognit
Expand Down
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Counter-Strike 2 support is experimental.

[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://vshymanskyy.github.io/StandWithUkraine)

[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs?tab=doc)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs?tab=doc)
[![Build Status](https://img.shields.io/github/actions/workflow/status/markus-wa/demoinfocs-golang/ci.yml?branch=master&style=flat-square)](https://github.com/markus-wa/demoinfocs-golang/actions)
[![codecov](https://img.shields.io/codecov/c/github/markus-wa/demoinfocs-golang?style=flat-square)](https://codecov.io/gh/markus-wa/demoinfocs-golang)
[![Go Report](https://goreportcard.com/badge/github.com/markus-wa/demoinfocs-golang?style=flat-square)](https://goreportcard.com/report/github.com/markus-wa/demoinfocs-golang)
Expand All @@ -23,13 +23,15 @@ For business inquiries please use the contact information found on the [GitHub p

## Go Get

### CS:GO
### CS2 - ⚠️ Experimental

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

### CS2 - ⚠️ Experimental
⚠️ The CS2 / v4 API may change in backwards incompatible ways without warning.

go get -u github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs@s2
### CS:GO

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

## Table of Contents

Expand All @@ -53,7 +55,7 @@ For business inquiries please use the contact information found on the [GitHub p

## Requirements

This library requires at least `go 1.18` to run.
This library requires at least `go 1.21` to run.
You can download the latest version of Go [here](https://golang.org/).

## Quickstart Guide
Expand All @@ -70,7 +72,7 @@ go mod init github.com/<YOUR_GITHUB_USER>/my-project
# the module name (github.com/<YOUR_GITHUB_USER>/my-project) can always be changed later
# you can also put example.com/my-project or anything else if you don't plan to publish your project

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

3. Create a `main.go` file with the example below
Expand All @@ -92,8 +94,8 @@ import (
"log"
"os"

dem "github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs"
events "github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/events"
dem "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs"
events "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events"
)

func main() {
Expand Down Expand Up @@ -150,24 +152,24 @@ Check out the [examples](examples) folder for more examples, like [how to genera

### Documentation

The full API documentation is available here on [pkg.go.dev](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs).
The full API documentation is available here on [pkg.go.dev](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs).

## Features

* Game events (kills, shots, round starts/ends, footsteps etc.) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/events?tab=doc) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/print-events)
* Tracking of game-state (players, teams, grenades, ConVars etc.) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs?tab=doc#GameState)
* Grenade projectiles / trajectories - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs?tab=doc#GameState.GrenadeProjectiles) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/nade-trajectories)
* Access to entities, server-classes & data-tables - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/sendtables?tab=doc#ServerClasses) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/entities)
* Access to all net-messages - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs?tab=doc#NetMessageCreator) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/net-messages)
* Chat & console messages <sup id="achat1">1</sup> - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/events?tab=doc#ChatMessage) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/print-events)
* Matchmaking ranks (official MM demos only) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/events?tab=doc#RankUpdate)
* Game events (kills, shots, round starts/ends, footsteps etc.) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events?tab=doc) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/print-events)
* Tracking of game-state (players, teams, grenades, ConVars etc.) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs?tab=doc#GameState)
* Grenade projectiles / trajectories - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs?tab=doc#GameState.GrenadeProjectiles) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/nade-trajectories)
* Access to entities, server-classes & data-tables - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/sendtables?tab=doc#ServerClasses) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/entities)
* Access to all net-messages - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs?tab=doc#NetMessageCreator) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/net-messages)
* Chat & console messages <sup id="achat1">1</sup> - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events?tab=doc#ChatMessage) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/print-events)
* Matchmaking ranks (official MM demos only) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events?tab=doc#RankUpdate)
* Full POV demo support <sup id="achat1">2</sup>
* Support for encrypted net-messages (if the [decryption key](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3@master/pkg/demoinfocs#ParserConfig) is provided)
* Support for encrypted net-messages (if the [decryption key](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4@master/pkg/demoinfocs#ParserConfig) is provided)
* JavaScript (browser / Node.js) support via WebAssembly - [example](https://github.com/markus-wa/demoinfocs-wasm)
* [Easy debugging via build-flags](#debugging)
* Built with performance & concurrency in mind

1. <small id="f1">In MM demos the chat is encrypted, so [`ParserConfig.NetMessageDecryptionKey`](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3@master/pkg/demoinfocs#ParserConfig) needs to be set - see also [`MatchInfoDecryptionKey()`](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3@master/pkg/demoinfocs#MatchInfoDecryptionKey).</small>
1. <small id="f1">In MM demos the chat is encrypted, so [`ParserConfig.NetMessageDecryptionKey`](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4@master/pkg/demoinfocs#ParserConfig) needs to be set - see also [`MatchInfoDecryptionKey()`](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4@master/pkg/demoinfocs#MatchInfoDecryptionKey).</small>
2. <small id="f2">Better than some other parsers at the time of writing.</small>

## Performance / Benchmarks
Expand Down Expand Up @@ -242,7 +244,7 @@ e.g.

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/v3/pkg/demoinfocs.debugServerClasses=YES'"`.
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/v4/pkg/demoinfocs.debugServerClasses=YES'"`.

e.g.

Expand Down
Loading
Loading