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);
});
- โจ 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.