A node.js library for parsing Counter-Strike Global Offensive (CSGO) demo files.
The library is also Browserify-able, and a standalone bundle that you can <script src="..."> is available in browser/bundle.js.
- Entity updates, server classes, data tables (including instance baselines)
- Both perspectives (GOTV and client-side recorded)
- User messages
- String tables
- Game events
- Console variables
<script src="browser/bundle.js"></script>
The DemoFile module will be available as window.demofile.
npm install --save demofile
Generate documentation to ./docs/:
npm run generate-docs
This library provides full access to the data available in CSGO demo files. Unlike some other libraries, demofile is feature complete and supports the latest demos. As well as providing high-level APIs to access the state of the game, low-level access is available and is not discouraged.
Take a look at the examples/dumpfile.js file for an indication as to how the library can be used to introspect demo files. This example is by no means exhaustive -- see the 'docs' folder for documentation on all public classes and methods.
Note: It is important to note that events are fired at the end of a tick, after all entity props and string tables have been updated.
Print all player information to console:
var demofile = require('demofile');
var fs = require('fs');
fs.readFile('test.dem', function (err, buffer) {
var demo = new demofile.DemoFile();
demo.stringTables.on('update', e => {
if (e.table.name === 'userinfo' && e.userData != null) {
console.log('Player info updated:');
console.log(e.entryIndex, e.userData);
}
});
demo.parse(buffer);
});- ⚡ #62: Fix entity position calculation. Use cell coordinates to determine entity positions.
- ⚡ #58: Entities are now removed at
tickend, after events are fired. This means the grenade entity can be accessed in flashbang_detonate and decoy_detonate.
- ✨ Added
Entities#weapons(thanks @thorebear)
- ✨ Added
Player#matchStatsto represent player performance on a per-round basis
- ✨ #11: Fixed malformed demos resulting in an exception. Added
errorproperty to theDemoFile#endevent - ⚡ #52:
GameRules#roundNumberhas been renamed toGameRules#roundsPlayed- the old name is available for backwards compatibility
- 🐛 #43: Fixed parsing of string tables updates for tables with fixed userdata sizes
- ✨ Added
Player#cashSpendTotalandPlayer#cashSpendThisRound
- 🐛 #31: Fixed
DemoFile#currentTimereturning the wrong game time
- 🐛 #11: Fixed parse error when a 'stop' command is missing from the demo file
- ✨ Added
Weaponentity class to represent in-game items (thanks @pedrofornaza)
- ✨ Added
Player#score,Player#mvpsandPlayer#clanTag(thanks @derpalmer)
- 🐛 Fix exception when calling
DemoFile#cancel(thanks @derpalmer)
- 🐛 Revert accidental bit-buffer upgrade
- ✨ Added
Player#steam64Idfor easy access to Steam64 ID (thanks @derpalmer)
- 🐛 Fixed exception in
Player#isAlive
Major update
- Added new
Player,TeamandGameRulesentities - Added
DemoFile#conVarsfor accessing console variables and listening for changes - Updated
dumpfile.jsexample to be more representative of real-world usage
- 🐛 Fixed
Entity#getPropexception when a prop is updated that is not part of the entity baseline
Major update
- The library now support Browserify and the compiled bundle can be included in web browsers
- Added DemoFile#progress event that indicates what percentage of the demo file has been parsed
- Removed dependency on the
pacelibrary
- ✨ Added entities
isHandleSetto determine if a networked entity handle is set (the game uses(1 << 21) - 1to mean empty)
- ✨ Added entities
getByHandleto find an entity from a given networked entity handle (e.g., from m_hMyWeapons)
- ✨ Added entities
baselineupdateevent which is fired whenever theinstancebaselinestring table is updated with new properties.
- ✨ The
dem_StringTablescommand, which holds additional string table data on client-side recorded demos, is now parsed - ⚡ String table
postcreateis now fired aftersvc_CreateStringTableanddem_StringTablesare parsed
- ✨ Added entities
datatablesreadyevent which is fired when data tables have been parsed.
- ✨ Added entity
postcreateevent which is fired after an entity has been created and all of its properties parsed.
- ✨ Added string table
postcreateevent which is fired after a new stringtable's entries have been populated
- 🐛 Fixed retrieving properties on entities whose server class has no instance baseline
- ✨ Instance baselines are now parsed and used by
Entity#getProp
- 🐛 Fixed stringtable updates affecting all entries in the table
- 📇 Removed
node-protobufun-used dependency
- ⚡ Each tick is now parsed on a separate process tick.
- ⚡ Game event callbacks are now fired at the end of the tick.
- 🐛 Fixed Vector props decoding to
undefined.
- 🎉 Initial release.