All Projects → saul → Demofile

saul / Demofile

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

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Demofile

Demoinfocs Golang
High performance CS:GO demo parser for Go (demoinfo)
Stars: ✭ 288 (-5.57%)
Mutual labels:  parser, csgo, counter-strike, demo
Csgoverview
A 2D demo replay tool for Counter Strike: Global Offensive.
Stars: ✭ 88 (-71.15%)
Mutual labels:  csgo, counter-strike, demo
Demoinfo
A library to analyze CS:GO demos in C#
Stars: ✭ 306 (+0.33%)
Mutual labels:  parser, csgo, demo
sourcepawn-navmesh
SourcePawn .NAV file reader.
Stars: ✭ 25 (-91.8%)
Mutual labels:  counter-strike, csgo
Sequoia
A neural network for CounterStrike:GlobalOffensive character detection and classification. Built on a custom-made dataset (csgo-data-collector)
Stars: ✭ 60 (-80.33%)
Mutual labels:  counter-strike, csgo
Public
The game is about a group of "terrorists" who have traitors among them, out to kill everyone who's not a traitor.
Stars: ✭ 94 (-69.18%)
Mutual labels:  counter-strike, csgo
pengWin
An external cheat for the Linux version of Counter-Strike Global Offensive
Stars: ✭ 28 (-90.82%)
Mutual labels:  counter-strike, csgo
discord-10man
Discord bot for CS:GO Scrims and Pugs
Stars: ✭ 34 (-88.85%)
Mutual labels:  counter-strike, csgo
csgo-cli
CS:GO Console shows your user account, stats and latest matches. It also uploads demo sharecodes to csgostats.gg.
Stars: ✭ 31 (-89.84%)
Mutual labels:  counter-strike, csgo
RatPoison
Latest Ver: 1.7; Default Menu Key is F1; Charlatano's Successor; dn
Stars: ✭ 302 (-0.98%)
Mutual labels:  counter-strike, csgo
Java-Memory-Manipulation
User friendly, Garbage-free, and cross-platform process, module and memory interfacing via the power of Java
Stars: ✭ 51 (-83.28%)
Mutual labels:  counter-strike, csgo
CallAdmin
CallAdmin is a multilingual sourcemod plugin which provides in-game report functionality
Stars: ✭ 52 (-82.95%)
Mutual labels:  counter-strike, csgo
valve-matchmaking-ip-ranges
Lists of locations & IP addresses of Valve servers
Stars: ✭ 69 (-77.38%)
Mutual labels:  counter-strike, csgo
csgo-gsi
A Java library for Counter-Strike: Global Offensive's game state integration
Stars: ✭ 23 (-92.46%)
Mutual labels:  counter-strike, csgo
CSGOItemDB
An API to retrieve accurate CS:GO prices for high- and low-tier items
Stars: ✭ 35 (-88.52%)
Mutual labels:  counter-strike, csgo
TeamGames
Sourcemod plugin providing team based games for prisoners and some useful things for wardens.
Stars: ✭ 16 (-94.75%)
Mutual labels:  counter-strike, csgo
csgo richpresence
Discord Rich Presence support for Counter-Strike: Global Offensive!
Stars: ✭ 16 (-94.75%)
Mutual labels:  counter-strike, csgo
Csgo Practice Mode
CS:GO Sourcemod plugin for private team/individual practice servers
Stars: ✭ 263 (-13.77%)
Mutual labels:  csgo, counter-strike
Vermin
Concurrently detect the minimum Python versions needed to run code
Stars: ✭ 218 (-28.52%)
Mutual labels:  analysis, parser
csgo-hud
Custom CS:GO Spectator HUD
Stars: ✭ 40 (-86.89%)
Mutual labels:  counter-strike, csgo

demofile CI

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.

❓ Need help

Supported demo features

  • GOTV and POV perspective fully supported
  • Game events (e.g. player_death)
  • User messages (e.g. chat messages, HUD text)
  • Console variables (cvar/convars)
  • Entity updates, server classes, data tables
  • String tables

Installation

Node

npm install --save demofile

Browser

<script src="browser/bundle.js"></script>

The DemoFile module will be available as window.demofile.

Screenshot

Using the dumpfile example:

Example output

Documentation

Auto-generated API documentation is available at saul.github.io/demofile.

Class Description
DemoFile Represents a demo file for parsing.

The DemoFile object has properties which point to instances of several other classes that can be used to query the game world:

Class Property Description
ConVars demoFile.conVars Manages console variables. (Only FCVAR_NOTIFY and FCVAR_REPLICATED are available.)
Entities demoFile.entities Represents entities and networked properties within a demo.
GameEvents demoFile.gameEvents Manages game events for a demo file. (e.g. player_death, player_footstep)
StringTables demoFile.stringTables Handles string tables for a demo file. (e.g. userinfo)
UserMessages demoFile.userMessages Handles user messages for a demo file. (e.g. SayText for in-game chat messages)

There are several classes which allow access to different types of entities (e.g. players, items, props). These are summarised below:

Entity Usage Description
Networkable demoFile.entities.getByHandle
demoFile.entities.entities[entIndex]
Base class of all in-game entities, even non-renderable entities (e.g. CCSTeam).
BaseEntity Base class of most in-game entities (e.g. players, weapons, all other renderable entities).
Player demoFile.entities.players
demoFile.entities.getByUserId
Represents an in-game player.
Weapon demoFile.entities.weapons
player.weapon
player.weapons
Represents an in-game weapon (guns, grenades, knifes).

API

This library provides full access to all 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.

Note that events are fired at the end of a tick, after all entity props and string tables have been updated.

Examples

Various examples are available in the examples folder:

Example Description
join-leave.ts Print all players that join and leave the game during the course of the demo.
molotov.ts Prints the location of molotov/incendiary grenade explosions.
plant-site.ts Prints which player planted the bomb and at which site.
purchases.ts Prints which items are purchased by each player.
rank.ts At the end of the game, prints all player ranks.
scores.ts Prints team scores after each round.
tickrate.ts Prints demo tick rate and duration in seconds.
dumpfile.ts Advanced example of recreating coloured chat messages, round scores and the kill feed.

Print kills

import fs = require("fs");
import demofile = require("demofile");

fs.readFile("test.dem", (err, buffer) => {
  const demoFile = new demofile.DemoFile();

  demoFile.gameEvents.on("player_death", e => {
    const victim = demoFile.entities.getByUserId(e.userid);
    const victimName = victim ? victim.name : "unnamed";

    // Attacker may have disconnected so be aware.
    // e.g. attacker could have thrown a grenade, disconnected, then that grenade
    // killed another player.
    const attacker = demoFile.entities.getByUserId(e.attacker);
    const attackerName = attacker ? attacker.name : "unnamed";

    const headshotText = e.headshot ? " HS" : "";

    console.log(`${attackerName} [${e.weapon}${headshotText}] ${victimName}`);
  });

  demoFile.parse(buffer);
});

/* Outputs:

HS [cz75a HS] flusha
Lekr0 [ak47 HS] friberg
KRIMZ [ak47] HS
JW [mac10 HS] Mixwell
JW [hegrenade] HS
JW [mac10 HS] Magisk

*/

Print player information when it changes

import fs = require("fs");
import demofile = require("demofile");

fs.readFile("test.dem", (err, buffer) => {
  const demoFile = new demofile.DemoFile();

  demoFile.stringTables.on("update", e => {
    if (e.table.name === "userinfo" && e.userData != null) {
      console.log("\nPlayer info updated:");
      console.log(e.entryIndex, e.userData);
    }
  });

  demoFile.parse(buffer);
});

/* Outputs:

Player info updated:
12 { unknown_lo: 4294967295,
  unknown_hi: 4294963202,
  xuid_lo: 17825793,
  xuid_hi: 3417033,
  name: 'HS',
  userId: 20,
  guid: 'STEAM_1:1:1708516',
  friendsId: 3417033,
  friendsName: '',
  fakePlayer: false,
  isHltv: false,
  customFiles: [ 0, 0, 0, 0 ],
  xuid: Long { low: 3417033, high: 17825793, unsigned: false } }

[repeated for other players]
*/

Useful links

Contributing

Please read the Contributing Guidelines to learn how you can help out on the project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].