Git Product home page Git Product logo

csgo-demo-graphql's Introduction

CSGO Demo Renderer

Go Report Card GitHub

A CSGO Demo renderer using GraphQL. It takes a CSGO Demo in binary format and encodes it into JSON. It only respects the attributes, which the user specifies in the query, therefore not over or underfetching any data resulting in a bloated JSON.

How to run

Build

If you want to build the app, clone the repository and run

go run cmd/main.go --query ./examples/prod.graphql --demo examples/test.dem

For building the webserver run

go build cmd/webserver.go --query ./examples/prod.graphql --port 8080

It builds a binary called main or webserver.

Execute the application

Run using

csgodemo --query query.query --demo demo.dem

where the query.query is a file containing a graphQL query.

{
  demo(freq: 0.2) {
    header {
      mapName
    }
    ticks {
      participants {
        entityId
      }
    }
  }
}

Where freq is the recording FPS.

It creates a File named out.json containing all data.

ls
+ out.json

For exploring purposes, you can use the interactive Graphiql tool available at

https://larskoelpin.github.io/csgo-demo-graphql/

Run as Webserver

There is also

csgodemo --query query.query --port 8080

This hosts a simple HTTP-Server listening on Port 8080. It accepts any request containing a CS:GO Binary. Please do not use this for public facing apps!

Considerations

If you want to send the json over the wire, try deflateing it using gzip

creates a File named out.json

gzip out.json //out.json.gz

inflate using

gzip -d out.json.gz

Supported Events

For full reference see graphiql at https://larskoelpin.github.io/csgo-demo-graphql/

List of Events

The event is the identifier of the event (This is also the "name" Attribute of the Event). The GraphQL Type is the Type Name of the Event. This is e.g. needed, when you want to query the union type of events.

Event GraphQL Description
SMOKE_STARTED SmokeStarted A Smokegrenade exploded
SMOKED_EXPIRED SmokeExpired Smokegreande effect wore off
FIRE_STARTED FireStarted Fire Grenade exploded
FIRE_EXPIRED FireExpired Fire effect wore off
FLASH_EXPLOSION FlashExplosion Flashbang explosion
MATCH_STARTED MatchStarted A Match started
ROUND_STARTED RoundStarted A Round started
ROUND_ENDED RoundEnded A Round ended
WEAPON_FIRED WeaponFired Somebody shot.
BOMB_PLANTED BombPlanted The bomb was planted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.