DemoFile 0.27.1
dotnet add package DemoFile --version 0.27.1
NuGet\Install-Package DemoFile -Version 0.27.1
<PackageReference Include="DemoFile" Version="0.27.1" />
paket add DemoFile --version 0.27.1
#r "nuget: DemoFile, 0.27.1"
// Install DemoFile as a Cake Addin #addin nuget:?package=DemoFile&version=0.27.1 // Install DemoFile as a Cake Tool #tool nuget:?package=DemoFile&version=0.27.1
DemoFile.Net
DemoFile.Net is a blazing fast demo parser library for Source 2 games, written in C#. It is cross-platform, and can be used on Windows, Mac or Linux. This parser currently supports:
Game | NuGet package | Getting started |
---|---|---|
Counter-Strike 2 | ✅ DemoFile.Game.Cs | new CsDemoParser() |
Deadlock | ✅ DemoFile.Game.Deadlock | new DeadlockDemoParser() |
[!IMPORTANT]
DemoFile
is the base, core library and does not provide support for parsing any specific game. Add a reference to one of theDemoFile.Game.*
packages instead.
Easy discoverability of available data through your IDE's inbuilt autocompletion:
Features
Feature | Availability |
---|---|
CSTV / GOTV demos | ✅ Full support |
POV demos | ✅ Full support |
HTTP broadcasts | ✅ Full support |
Game events (e.g. player_death ) |
✅ Full support |
Entity updates (player positions, grenades, etc.) | ✅ Full support |
Seeking forwards/backwards through the demo | ✅ Full support |
Examples
[!WARNING] This library is still under development and the API is liable to change until v1.0
using DemoFile;
internal class Program
{
public static async Task Main(string[] args)
{
var path = args.SingleOrDefault() ?? throw new Exception("Expected a single argument: <path to .dem>");
var demo = new CsDemoParser();
demo.Source1GameEvents.PlayerDeath += e =>
{
Console.WriteLine($"{e.Attacker?.PlayerName} [{e.Weapon}] {e.Player?.PlayerName}");
};
var reader = DemoFileReader.Create(demo, File.OpenRead(path));
await reader.ReadAllAsync();
Console.WriteLine("\nFinished!");
}
}
See also the examples/ folder.
For maximum performance, a given demo file can be parsed in sections in parallel. This utilises all available CPU cores. For example usage, take a look at DemoFile.Example.MultiThreaded.
Benchmarks
On an M1 MacBook Pro, DemoFile.Net can read a full competitive game (just under 1 hour of game time) in 1.3 seconds.
When parsing across multiple threads, using the ReadAllParallelAsync
method, this drops to nearly 500 milliseconds.
This includes parsing all entity data (player positions, velocities, weapon tracking, grenades, etc).
Method | Mean | Error | StdDev | Allocated |
---|---|---|---|---|
ParseDemo | 1,294.6 ms | 3.68 ms | 2.88 ms | 491.48 MB |
ParseDemoParallel | 540.1 ms | 23.99 ms | 22.44 ms | 600.67 MB |
Author and acknowledgements
DemoFile.Net is developed by Saul Rennison. The development of this library would not have been possible without demoparser by LaihoE and Manta by Dotabuff, the latter of which depends on the efforts of a number of people:
- Michael Fellinger built Dotabuff's Source 1 parser yasha.
- Robin Dietrich built the C++ parser Alice.
- Martin Schrodt built the Java parser clarity.
- Drew Schleck built an original C++ parser edith.
A modified version of Source2Gen by neverlosecc is used to statically generate the game schema classes and enums.
See ACKNOWLEDGEMENTS for license information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Google.Protobuf (>= 3.22.1)
- NerdBank.GitVersioning (>= 3.6.133)
- protobuf-net (>= 3.2.16)
- Snappier (>= 1.1.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on DemoFile:
Package | Downloads |
---|---|
DemoFile.Game.Cs
DemoFile.Game.Cs is a blazing fast Counter-Strike 2 demo parser library. |
|
DemoFile.Game.Deadlock
DemoFile.Game.Deadlock is a blazing fast demo parser for Valve's Deadlock. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.27.1 | 237 | 11/2/2024 |
0.26.1 | 129 | 10/29/2024 |
0.25.1 | 319 | 10/12/2024 |
0.24.1 | 134 | 10/7/2024 |
0.23.1 | 160 | 9/27/2024 |
0.22.3 | 128 | 9/23/2024 |
0.22.1 | 131 | 9/22/2024 |
0.21.1 | 174 | 9/14/2024 |
0.20.1 | 167 | 9/7/2024 |
0.19.1 | 123 | 9/7/2024 |
0.18.1 | 630 | 8/16/2024 |
0.17.1 | 143 | 8/11/2024 |
0.16.3 | 137 | 8/2/2024 |
0.16.2 | 80 | 8/1/2024 |
0.16.1 | 87 | 8/1/2024 |
0.15.1 | 607 | 6/1/2024 |
0.14.1 | 183 | 5/26/2024 |
0.13.1 | 216 | 4/30/2024 |
0.12.2 | 152 | 4/12/2024 |
0.12.1 | 407 | 2/29/2024 |
0.11.1 | 216 | 2/19/2024 |
0.10.1 | 116 | 2/17/2024 |
0.9.1 | 155 | 2/9/2024 |
0.8.1 | 214 | 12/30/2023 |
0.6.1 | 177 | 12/23/2023 |
0.5.1 | 370 | 12/19/2023 |
0.4.1 | 179 | 12/9/2023 |
0.3.6 | 187 | 11/25/2023 |
0.3.5 | 140 | 11/25/2023 |
0.3.4 | 142 | 11/25/2023 |
0.3.1 | 147 | 11/25/2023 |
0.2.9 | 173 | 11/12/2023 |
0.2.8 | 134 | 11/12/2023 |
0.2.7 | 146 | 11/12/2023 |
0.2.6 | 126 | 11/11/2023 |
0.2.5 | 123 | 11/11/2023 |
0.2.4 | 132 | 11/11/2023 |
0.2.3 | 131 | 11/8/2023 |
0.2.2 | 131 | 11/5/2023 |
0.2.1 | 190 | 10/29/2023 |
0.1.11 | 160 | 10/25/2023 |
0.1.10 | 161 | 10/22/2023 |
0.1.9 | 142 | 10/19/2023 |
0.1.7 | 160 | 10/12/2023 |