/manta

Dota 2 Source 2 Replay Parser

Primary LanguageProtocol BufferMIT LicenseMIT

Manta

Build Status

Manta is a Dota 2 replay parser written in Go. It targets the Source 2 (Dota 2 Reborn) game engine. To parse Source 1 (original Dota 2) replays, take a look at Yasha.

Project Status:

  • Dota 2 Reborn (Source 2) has been released as a beta.
  • Replays from Source 2 matches are widely available for download.
  • Manta is structurally feature complete and in use at Dotabuff
  • Manta currently handles nearly all packets, the major exception being packet entities.

Getting Started

Manta is a low-level replay parser, meaning that it will provide you access to the raw data in the replay, but doesn't provide any opinion on how that data should be structured for your use case. You'll need to create callback functions, inspect the raw data, and decide how you're going to use it.

Usage

Get the code:

go get github.com/dotabuff/manta

Use it to parse a replay:

import (
  "github.com/dotabuff/manta"
  "github.com/dotabuff/manta/dota"
)

func main() {
  // Create a new parser instance from a file. Alternatively see NewParser([]byte)
  p, _ := manta.NewParserFromFile("my_replay.dem")

  // Register a callback, this time for the OnCUserMessageSayText2 event.
  p.Callbacks.OnCUserMessageSayText2(func(m *dota.CUserMessageSayText2) error {
    fmt.Printf("%s said: %s", m.GetParam1(), m.GetParam2())
  })

  // Start parsing the replay!
  p.Start()
}

You cannot import Manta and Yasha in the same binary due to protocol buffer conflicts.

License

MIT, see the LICENSE file.

Help

If you have any questions, you can find us in the #dota2replay channel on QuakeNet.

Authors and Acknowledgements

Manta is maintained and development is sponsored by Dotabuff, a leading Dota 2 community website with an emphasis on statistics. Manta wouldn't exist without the efforts of a number of people: