DemoFile.Net is a blazing fast demo parser library for Counter-Strike 2, written in C#. It is cross platform, and can be used from Windows, Mac or Linux.
Easy discoverability of available data through your IDE's inbuilt autocompletion:
Feature | Availability |
---|---|
CSTV / GOTV demos | ✅ Full support |
POV demos | ➖ Support planned |
Game events (e.g. player_death ) |
✅ Full support |
Entity updates (player positions, grenades, etc.) | ✅ Full support |
Seeking forwards/backwards through the demo | ✅ Full support |
Note: This library is still under heavy development and the API is likely to change significantly before 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 DemoParser();
demo.Source1GameEvents.PlayerDeath += e =>
{
Console.WriteLine($"{e.Attacker?.PlayerName} [{e.Weapon}] {e.Player?.PlayerName}");
};
await demo.ReadAllAsync(File.OpenRead(path));
Console.WriteLine("\nFinished!");
}
}
See also the examples/ folder.
On an M1 MacBook Pro, DemoFile.Net can read a full competitive game (just under 1 hour of game time) in 1.5 seconds. This includes parsing all entity data (player positions, velocities, weapon tracking, grenades, etc).
Method | Runtime | Mean | Error | StdDev |
---|---|---|---|---|
ParseDemo | .NET 8.0 | 1.501 s | 0.0047 s | 0.0042 s |
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.