Code Monkey home page Code Monkey logo

rapier's Introduction

rapier

A JavaScript Dota 2 (Source 2) replay parsing library.

It throws (exceptions) if incorrectly used. :)

npm version

Why JavaScript?

  • Can be used for both server-side and in-browser parsing (isomorphic design)
  • No JS replay parsing library yet

Notes

  • Rapier does not handle entities yet. Everything else (of interest) should be supported.
  • Performance of the library is relatively poor compared to other implementations. Part of this is likely due to lack of optimization and partly due to JS lacking types and slow bitwise operations. In exchange, you can develop and run your application fully in JavaScript.
  • This library is not currently in production use and is not actively maintained.

API

  • Rapier is designed to offer a very simple API.
  • Users simply attach event listeners with the names of the protobuf messages they're interested in.
  • Properties such as string tables, game event descriptors, and id->string mappings are exposed to allow the user to interpret the message.
  • Event names are listed under "dems" and "packets" in build/types.json, or refer to the original .proto files in proto.

Event Overview

  • DEM messages. The basic building block of the replay.
    • CDemoPacket, CDemoFullPacket, CDemoSignonPacket. These messages contain one or more packets.
      • Packets. Contain most of the interesting data in the replay.
        • User Messages. These include all chat.
        • Dota User Messages. These include objectives, map pings, and actions.
        • Game Events. These come in several flavors and their content/structure are interpreted by using the game event descriptors (available to the user)
          • Combat Log. Combat log entries are a type of game event. Some fields require the use of string tables (available to the user) to translate a number to a useful string ("npc_dota_hero_furion").
        • Packet Entities.
    • CDemoFileInfo. This includes an end-of-game summary.
    • CDemoSpawnGroup.
    • CDemoSaveGame.

Usage

  • Node.js: npm install rapier
  • Browser: <script src="./build/rapier.js"></script> (you can grab the file and host it anywhere)

Examples

Examples of server and client side parsing can be found in examples

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.