@deademx/dota2
v4.0.1
Published
Dota 2 (Source 2) demo and replay parser with playback support for Node.js and browsers
Maintainers
Readme
@deademx/dota2 is the Dota 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 Dota 2-specific details only.
Sibling packages: deadem (Deadlock) and @deademx/cs2 (Counter-Strike 2).
Contents
- Installation Install from npm or use the browser bundle.
- Quick Start Parse a replay, print stats.
- What Dota 2 Adds
Everything the package registers on top of the engine.
- Message Types Dota 2-specific message types.
- String Tables Dota 2-specific string tables.
- Decoders Dota 2-specific entity field decoders.
- Examples Runnable scripts: parsing, player.
- Compatibility Game patch and runtimes.
- Performance Measured throughput and memory usage.
- License MIT.
Installation
Node.js
npm install @deademx/dota2 --saveimport { Parser, Player } from '@deademx/dota2';Browser
<script src="//cdn.jsdelivr.net/npm/@deademx/[email protected]/dist/deadem-dota2.min.js"></script>const { Parser, Player } = window.deademDota2;Quick Start
import { createReadStream } from 'node:fs';
import { Parser, Printer } from '@deademx/dota2';
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 Dota 2 Adds
Bootstrap registers the Dota 2 schema onto the engine registry:
Message Types
Dota 2-specific MessagePacketTypes — chat, objectives, economy.
String Tables
Dota 2-specific StringTableTypes.
| Table | Entries | Content |
| --- | --- | --- |
| StringTableType.ACTIVE_MODIFIERS | hundreds | Every buff/debuff on every entity. Decoded into CDOTAModifierBuffTableEntry lazily on first entry.value read. |
| StringTableType.COMBAT_LOG_NAMES | hundreds | Resolves combat log entity/ability/item ids to names. |
| StringTableType.COOLDOWN_NAMES | hundreds | Resolves ability cooldown ids to names. |
| StringTableType.DOWNLOADABLES | hundreds | — |
| StringTableType.ECON_ITEMS | hundreds | Equipped cosmetic items. |
| StringTableType.LUA_MODIFIERS | hundreds | — |
| StringTableType.MODIFIER_NAMES | thousands | Resolves ActiveModifiers.modifierClass to readable names. |
| StringTableType.PARTICLE_ASSETS | hundreds | — |
| StringTableType.RESPONSE_KEYS | hundreds | — |
Decoders
Dota 2-specific entity field decoders. Entity examples: CDOTAPlayerController, CDOTAGameRulesProxy. Entities, fields and types can be browsed in Deadem Explorer.
Examples
All example scripts live in the examples-node-dota2 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-dota2/scripts/100_parse.js |
| 101 | Parse multiple replay files | 101_parse_multiple.js | node ./packages/examples-node-dota2/scripts/101_parse_multiple.js --matches="8773493455,8777738576" |
| 102 | Parse selected message types | 102_parse_selective.js | node ./packages/examples-node-dota2/scripts/102_parse_selective.js |
| 103 | Print chat messages | 103_parse_chat.js | node ./packages/examples-node-dota2/scripts/103_parse_chat.js |
| 104 | Rank high-churn entity classes and fields from ENTITY_PACKET deltas | 104_parse_entity_field_stats.js | node ./packages/examples-node-dota2/scripts/104_parse_entity_field_stats.js |
| 105 | Print the combat log, names resolved through CombatLogNames | 105_parse_combat_log.js | node ./packages/examples-node-dota2/scripts/105_parse_combat_log.js |
| 106 | Rank unit order fields by how often they are present and change | 106_parse_unit_orders.js | node ./packages/examples-node-dota2/scripts/106_parse_unit_orders.js |
Player
| # | Description | Source | Command |
| --- | --- | --- | --- |
| 200 | Load, seek, play, and pause a replay | 200_play.js | node ./packages/examples-node-dota2/scripts/200_play.js |
Compatibility
- Game patch: tested with Dota 2 demos from patch
7.41eand 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 | 25 464 +- 3.63% | ~2.12 | 104 +- 18.28% | 48 +- 28.16% | 330 +- 0.92% |
| 2 | Chat — messagePacketTypes: [ DOTA_UM_CHAT_MESSAGE ] | 168 743 +- 3.21% | ~0.32 | 39 +- 6.07% | 22 +- 13.72% | 232 +- 6.87% |
| 3 | One entity class — SVC_PACKET_ENTITIES + entityClasses: [ CDOTAPlayerController ] | 89 779 +- 0.75% | ~0.60 | 75 +- 23.59% | 17 +- 20.27% | 250 +- 2.96% |
Runtime: Node.js v22.14.0.
See engine performance notes for optimization tips.
