mreq / demofile

Node.js library for parsing Counter-Strike: Global Offensive demo files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

demofile

Join the chat at https://gitter.im/saul/demofile

A node.js library for parsing modern (protobuf) Source 1 demo files.

Supported Games

  • Counter-Strike: Global Offensive

Supported Demo Features

  • Entity updates, server classes, data tables (including instance baselines)
  • Both perspectives (GOTV and client-side recorded)
  • User messages
  • String tables
  • Game events
  • User commands
  • Console commands

Installation

npm install --save demofile

Generate documentation to ./docs/:

npm run generate-docs

Example

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);
});

Release History

0.2.11 (16/10/16)

  • ✨ Added entities isHandleSet to determine if a networked entity handle is set (the game uses (1 << 21) - 1 to mean empty )

0.2.10 (11/10/16)

  • ✨ Added entities getByHandle to find an entity from a given networked entity handle (e.g., from m_hMyWeapons)

0.2.9 (12/09/16)

  • ✨ Added entities baselineupdate event which is fired whenever the instancebaseline string table is updated with new properties.

0.2.8 (30/08/16)

  • ✨ The dem_StringTables command, which holds additional string table data on client-side recorded demos, is now parsed
  • ⚡ String table postcreate is now fired after svc_CreateStringTable and dem_StringTables are parsed

0.2.7 (23/08/16)

  • ✨ Added entities datatablesready event which is fired when data tables have been parsed.

0.2.6 (23/08/16)

  • ✨ Added entity postcreate event which is fired after an entity has been created and all of its properties parsed.

0.2.5 (08/07/16)

  • ✨ Added string table postcreate event which is fired after a new stringtable's entries have been populated

0.2.4 (08/07/16)

  • 🐛 Fixed retrieving properties on entities whose server class has no instance baseline

0.2.3 (03/07/16)

  • ✨ Instance baselines are now parsed and used by Entity#getProp

0.2.2 (03/07/16)

  • 🐛 Fixed stringtable updates affecting all entries in the table

0.2.1 (25/03/16)

  • 📇 Removed node-protobuf un-used dependency

0.2.0 (30/01/16)

  • ⚡ 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.

0.1.0 (18/01/16)

  • 🎉 Initial release.

Acknowledgements

About

Node.js library for parsing Counter-Strike: Global Offensive demo files

License:MIT License


Languages

Language:Protocol Buffer 66.2%Language:JavaScript 33.8%