MCPcopy Index your code
hub / github.com/dotabuff/manta

github.com/dotabuff/manta @v1.5.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.5.0 ↗ · + Follow
33,725 symbols 39,145 edges 114 files 4,427 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Manta

Build Status

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

You can run make update to re-generate protobufs and callbacks based on the SteamDatabase/Protobufs project.

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:

Extension points exported contracts — how you extend this code

GameEventHandler (FuncType)
GameEventHandler is a function that can receive a game event
game_event.go
EntityHandler (FuncType)
EntityHandler is a function that receives Entity updates
entity.go
ModifierTableEntryHandler (FuncType)
(no doc)
modifier.go

Core symbols most depended-on inside this repo

readBits
called by 67
reader.go
_panicf
called by 30
util.go
readBoolean
called by 28
reader.go
readUBitVarFieldPath
called by 28
reader.go
readVarUint32
called by 23
stream.go
newReader
called by 21
reader.go
Get
called by 18
entity.go
refCell
called by 14
field_state.go

Shape

Method 29,720
Struct 3,066
TypeAlias 525
Function 398
Interface 11
FuncType 5

Languages

Go100%

Modules by API surface

dota/dota_gcmessages_client.pb.go4,791 symbols
dota/dota_gcmessages_common.pb.go2,462 symbols
dota/dota_gcmessages_server.pb.go2,115 symbols
dota/dota_usermessages.pb.go1,999 symbols
dota/econ_gcmessages.pb.go1,360 symbols
dota/usermessages.pb.go1,117 symbols
dota/dota_clientmessages.pb.go1,009 symbols
dota/netmessages.pb.go844 symbols
dota/steammessages_int.pb.go811 symbols
dota/dota_gcmessages_client_showcase.pb.go727 symbols
dota/gcsdk_gcmessages.pb.go719 symbols
dota/dota_gcmessages_client_guild.pb.go717 symbols

For agents

$ claude mcp add manta \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact