Dotabuff's Dota 2 Source 2 Replay Parser in Go
Clone or download
Latest commit adf25d6 Jul 26, 2018
Permalink
Failed to load latest commit information.
dota Update protos Jul 26, 2018
fixtures fixture cleanup Mar 24, 2016
gen update protos Mar 12, 2018
replays Add a basic test suite Jun 5, 2015
vbkv add parser for savegames Jul 24, 2015
.gitignore specify dependencies with glide Mar 25, 2016
.travis.yml update protos Mar 12, 2018
CONDUCT.md Add CONDUCT.md Feb 29, 2016
LICENSE Update README Feb 29, 2016
Makefile Update protos Jun 6, 2018
README.md fix typos in readme Aug 18, 2016
callbacks.go Update protos Jul 26, 2018
class.go Update to v1.0.0 (#91) Dec 20, 2017
demo_packet.go tweak alloc Aug 16, 2016
doc.go fix godoc summary, update game-tracking Mar 26, 2016
entity.go Add Entity API methods (#97) Jul 9, 2018
entity_test.go Update to v1.0.0 (#91) Dec 20, 2017
field.go Update to v1.0.0 (#91) Dec 20, 2017
field_decoder.go Update to v1.0.0 (#91) Dec 20, 2017
field_patch.go Update to v1.0.0 (#91) Dec 20, 2017
field_path.go Update to v1.0.0 (#91) Dec 20, 2017
field_reader.go Update to v1.0.0 (#91) Dec 20, 2017
field_state.go Update to v1.0.0 (#91) Dec 20, 2017
field_type.go Update to v1.0.0 (#91) Dec 20, 2017
game_event.go Update to v1.0.0 (#91) Dec 20, 2017
glide.lock Update deps Jul 8, 2018
glide.yaml Update to v1.0.0 (#91) Dec 20, 2017
huffman.go Reduce exports (and add one!) Mar 25, 2016
lzss.go improve and unexport reader Mar 26, 2016
lzss_test.go Working LZSS decompressor, fixture cleanup, string tables progress. Jun 11, 2015
manta_test.go recover from string tables that cannot be parsed Jun 13, 2018
parser.go Update to v1.0.0 (#91) Dec 20, 2017
parser_test.go test streaming reader Jul 29, 2016
quantizedfloat.go Update to v1.0.0 (#91) Dec 20, 2017
reader.go Update to v1.0.0 (#91) Dec 20, 2017
reader_test.go improve and unexport reader Mar 26, 2016
sendtable.go Update to v1.0.0 (#91) Dec 20, 2017
serializer.go Update to v1.0.0 (#91) Dec 20, 2017
stream.go re-use buffer in stream Jul 29, 2016
string_table.go make that a debug Jun 13, 2018
string_table_test.go recover from string tables that cannot be parsed Jun 13, 2018
util.go Update to v1.0.0 (#91) Dec 20, 2017
util_test.go Support reading outer replay messages from stream Apr 10, 2016

README.md

Manta

Build Status GoDoc

Manta is a fully functional Dota 2 replay parser written in Go, targeting the Source 2 (Dota 2 Reborn) game engine.

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 (
  "log"
  "os"

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

func main() {
  // Create a new parser instance from a file. Alternatively see NewParser([]byte)
  f, err := os.Open("my_replay.dem")
  if err != nil {
    log.Fatalf("unable to open file: %s", err)
  }
  defer f.Close()

  p, err := manta.NewStreamParser(f)
  if err != nil {
    log.Fatalf("unable to create parser: %s", err)
  }

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

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

  log.Printf("Parse Complete!\n")
}

Developing

To run make update you will need the latest version of the protobuf package:

go get -u github.com/golang/protobuf/...

You will also need GNU sed. To install GNU sed on Mac OS X:

# Install GNU sed
brew install gnu-sed
# Create a symlink in /usr/local/bin
ln -s /usr/local/bin/gsed /usr/local/bin/sed
# Ensure that /usr/local/bin is foremost in your PATH
export PATH="/usr/local/bin:$PATH"

License

Manta is distributed under the MIT license.

Code of Conduct

Manta has adopted the Contributor Covenant Code of Conduct.

Getting Help

The best place to ask questions about Dota 2 replay parsing is the #dota2replay channel on QuakeNet, where we're happy to answer any questions you may have. Please only open Github issues for actual bugs in manta, not questions about usage.

Looking to parse Source 1 (original Dota 2) replays? Take a look at Yasha.

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: