@deademx/cs2
v4.0.1
Published
Counter-Strike 2 (Source 2) demo and replay parser with playback support for Node.js and browsers
Maintainers
Readme
@deademx/cs2 is the Counter-Strike 2 (Source 2) demo parser and replay player for Node.js, Deno, Bun, and browsers, built on top of @deademx/engine.
The engine documentation covers the shared model — how to subscribe to data, use interceptors, configure the parser. This document covers Counter-Strike 2-specific details only.
Sibling packages: deadem (Deadlock) and @deademx/dota2 (Dota 2).
Contents
- Installation Install from npm or use the browser bundle.
- Quick Start Parse a replay, print stats.
- What CS2 Adds
Everything the package registers on top of the engine.
- Message Types CS2-specific message types.
- String Tables CS2-specific string tables.
- Decoders CS2-specific entity field decoders.
- Examples Runnable scripts: parsing, player.
- Compatibility Game builds and runtimes.
- Performance Measured throughput and memory usage.
- License MIT.
Installation
Node.js
npm install @deademx/cs2 --saveimport { Parser, Player } from '@deademx/cs2';Browser
<script src="//cdn.jsdelivr.net/npm/@deademx/[email protected]/dist/deadem-cs2.min.js"></script>const { Parser, Player } = window.deademCs2;Quick Start
import { createReadStream } from 'node:fs';
import { Parser, Printer } from '@deademx/cs2';
const parser = new Parser();
const readable = createReadStream('./match.dem');
await parser.parse(readable);
const printer = new Printer(parser);
printer.printStats();
await parser.dispose(); // cleanup state and resourcesWhat CS2 Adds
Bootstrap registers the Counter-Strike 2 schema onto the engine registry:
Message Types
CS2-specific MessagePacketTypes — round lifecycle, player stats, damage.
String Tables
CS2-specific StringTableTypes.
| Table | Entries | Content |
| --- | --- | --- |
| StringTableType.SERVER_AVATAR_OVERRIDES | ~dozen | Player avatar image overrides |
Decoders
CS2-specific entity field decoders. Entity examples: CCSPlayerController, CCSGameRulesProxy. Entities, fields and types can be browsed in Deadem Explorer.
Examples
All example scripts live in the examples-node-cs2 package. They look for demo files in /demos; missing files are downloaded automatically from deadem.com.
Parsing
| # | Description | Source | Command |
| --- | --- | --- | --- |
| 100 | Parse a single replay file | 100_parse.js | node ./packages/examples-node-cs2/scripts/100_parse.js |
| 101 | Parse multiple replay files | 101_parse_multiple.js | node ./packages/examples-node-cs2/scripts/101_parse_multiple.js --matches="2026-05-15-natus-vincere-vs-vitality-m1-dust2,2026-05-15-natus-vincere-vs-vitality-m2-anubis" |
| 102 | Parse selected message types | 102_parse_selective.js | node ./packages/examples-node-cs2/scripts/102_parse_selective.js |
| 103 | Aggregate damage by attacker from player_hurt events | 103_parse_damage.js | node ./packages/examples-node-cs2/scripts/103_parse_damage.js |
| 104 | Rank high-churn entity classes and fields from ENTITY_PACKET deltas | 104_parse_entity_field_stats.js | node ./packages/examples-node-cs2/scripts/104_parse_entity_field_stats.js |
| 105 | Print chat messages by channel (ALL / CT / T / DEAD / SPEC) | 105_parse_chat.js | node ./packages/examples-node-cs2/scripts/105_parse_chat.js |
| 106 | Print kill feed with weapon, headshot, distance, and flags | 106_parse_kill_feed.js | node ./packages/examples-node-cs2/scripts/106_parse_kill_feed.js |
| 107 | Print bomb timeline (pickup / drop / plant / defuse / explode) | 107_parse_bomb_timeline.js | node ./packages/examples-node-cs2/scripts/107_parse_bomb_timeline.js |
| 108 | Aggregate match scoreboard (K/D/A/HS%) and match-end accolades | 108_parse_match_summary.js | node ./packages/examples-node-cs2/scripts/108_parse_match_summary.js |
| 109 | Rank input fields in SVC_USER_COMMANDS by how often they are present and change | 109_parse_input_activity.js | node ./packages/examples-node-cs2/scripts/109_parse_input_activity.js |
Player
| # | Description | Source | Command |
| --- | --- | --- | --- |
| 200 | Load, seek, play, and pause a replay | 200_play.js | node ./packages/examples-node-cs2/scripts/200_play.js |
Compatibility
- Game builds: tested with Counter-Strike 2 demos from version
1.41.7.5and below. - Runtimes: Node.js v18+, Deno, Bun; browsers: Chrome, Firefox, Safari, Edge.
Performance
| # | Configuration | Ticks/sec | 30-min replay, sec | Max Heap, MB | Max ArrayBuffers, MB | Max RSS, MB |
| - | ----------------------------------------------------------------------------------- | ---------------- | ------------------ | ------------ | -------------------- | ------------ |
| 1 | Everything — ParserConfiguration.DEFAULT | 21 528 +- 3.46% | ~5.35 | 39 +- 2.96% | 18 +- 33.39% | 191 +- 4.85% |
| 2 | Chat — messagePacketTypes: [ USER_MESSAGE_SAY_TEXT_2 ] | 100 452 +- 1.22% | ~1.15 | 29 +- 6.61% | 31 +- 4.26% | 231 +- 5.01% |
| 3 | One entity class: messagePacketTypes: [ SVC_PACKET_ENTITIES ] + entityClasses: [ CCSPlayerController ] | 72 352 +- 5.28% | ~1.59 | 36 +- 6.68% | 25 +- 11.53% | 230 +- 6.84% |
| 4 | Player input — messagePacketTypes: [ SVC_USER_COMMANDS ] | 43 500 +- 2.87% | ~2.65 | 34 +- 5.26% | 21 +- 36.07% | 199 +- 4.43% |
Runtime: Node.js v22.14.0.
See engine performance notes for optimization tips.
