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);
});
- 🐛 #43: Fixed parsing of string tables updates for tables with fixed userdata sizes
- ✨ Added
Player#cashSpendTotal
andPlayer#cashSpendThisRound
- 🐛 #31: Fixed
DemoFile#currentTime
returning the wrong game time
- 🐛 #11: Fixed parse error when a 'stop' command is missing from the demo file
- ✨ Added
Weapon
entity class to represent in-game items (thanks @pedrofornaza)
- ✨ Added
Player#score
,Player#mvps
andPlayer#clanTag
(thanks @derpalmer)
- 🐛 Fix exception when calling
DemoFile#cancel
(thanks @derpalmer)
- 🐛 Revert accidental bit-buffer upgrade
- ✨ Added
Player#steam64Id
for easy access to Steam64 ID (thanks @derpalmer)
- 🐛 Fixed exception in
Player#isAlive
Major update
- Added new
Player
,Team
andGameRules
entities - Added
DemoFile#conVars
for accessing console variables and listening for changes - Updated
dumpfile.js
example to be more representative of real-world usage
- 🐛 Fixed
Entity#getProp
exception 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
pace
library
- ✨ Added entities
isHandleSet
to determine if a networked entity handle is set (the game uses(1 << 21) - 1
to mean empty)
- ✨ Added entities
getByHandle
to find an entity from a given networked entity handle (e.g., from m_hMyWeapons)
- ✨ Added entities
baselineupdate
event which is fired whenever theinstancebaseline
string table is updated with new properties.
- ✨ The
dem_StringTables
command, which holds additional string table data on client-side recorded demos, is now parsed - ⚡ String table
postcreate
is now fired aftersvc_CreateStringTable
anddem_StringTables
are parsed
- ✨ Added entities
datatablesready
event which is fired when data tables have been parsed.
- ✨ Added entity
postcreate
event which is fired after an entity has been created and all of its properties parsed.
- ✨ Added string table
postcreate
event 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-protobuf
un-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.