Coder Social home page Coder Social logo

manta's Introduction

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

To run make update you will need a few things installed:

# Install subversion. On OS X:
brew install subversion

# Install protoc. On OS X:
brew install protobuf

# Install gnu-sed. Not needed on Linux. On OS X:
brew install gnu-sed

# Install protoc-gen-go:
go install github.com/golang/protobuf/[email protected]

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:

manta's People

Contributors

13k avatar benlubar avatar gu3st avatar invokr avatar jcoene avatar manveru avatar perfectnewer avatar watbe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

manta's Issues

Doesn't work with 7.19c patch

was able to parse TI 8 matches with no problem. but when i try to parse 7.19c games the parser can only get hero id and ban/draft hero_id.

Entities that are destroyed as part of an action are gone by the time the callback is called

I encountered a rather strange problem in my code where the targetindex of a SpectatorPlayerUnitOrders (a message sent every time a hero moves or uses an ability) wasn't in PacketEntities. I opened up the demo in-game and skipped to the tick when it happened and discovered the issue occurred when a hero ate a tree with a Tango -- so the targetindex should be pointing to the tree but the tree doesn't seem to be in the packet entities.

I wrote this quick code to reproduce it:

package main

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

func main() {
	fh, _ := os.Open(os.Args[1])
	defer fh.Close()

	parser, _ := manta.NewStreamParser(fh)
	parser.Callbacks.OnCDOTAUserMsg_SpectatorPlayerUnitOrders(func(msg *dota.CDOTAUserMsg_SpectatorPlayerUnitOrders) error {
		target := msg.GetTargetIndex()

		if _, ok := parser.PacketEntities[target]; !ok {
			log.Printf("Entindex %d, tick %d, player %v", target, parser.Tick, parser.PacketEntities[msg.GetUnits()[0]])
		}

		return nil
	})

	parser.Start()
}

I then ran it on a few replays and noticed that aside from occurring when trees were consumed, it also occurred when people picked up runes. Presumably, this means that there's some sort of order issue here: the entity is already gone by the time the message callback is called. Is this a bug? Is there any workaround?

A question of equipment

Now , I Get a number of a equipment ,for example 14827765. How can I konw the name of the equipment ! The number is form the function "FetchUint32(m_hItems.0000)".

Unable to parse newer replays

Hi. I'm trying to extract damage dealt log using manta parser.

I wrote a simple program that uses manta parser, source code available available in the following gist: https://gist.github.com/m1el/2517c6c2e0bb544d84d445a4b3a08599

The program works as intended on old replays, but fails with the following error on newer replays:

$ go run damagenumbers.go test.dem
panic: unable to find class baseline 697
{stacktrace attached to the gist}

test.dem is attached to the gist as well.

parser.PacketEntities undefined (type *manta.Parser has no field or method PacketEntities)

First of all - I'm new to golang.
I've stuck with the task of getting entities and watching their updates. Most of the code suggestions say use parser.PacketEntity, but there is none. No PacketEntity or OnOacketEntity

I only found

parser.OnEntity();

But not sure how to use it to get hero current state (HP,mana, x,y) every set amount of seconds

Parsing callbacks is no problem, but can't get to the entities!

Is there any proper way to get time of every hero spawn?

Actually can't find any proper way to get exactly hero spawn time. Not just initial spawn but respawn as well. At this moment I came to this code:

	p.parser.OnEntity(func(e *manta.Entity, o manta.EntityOp) error {
		player := p.manager.FindPlayerByCDOTA(e.GetClassName())

		if player != nil {
			v, _ := e.GetFloat32("m_flSpawnedAt")
			p.manager.UpdateSpawnTimeForPlayer(player, v)
		}

At every Entity action I'm catching m_flSpawnedAt value and remembering it. EntityOp.Entered is not about exactly spawn moment so can't filter by it.
Also I have a pretty interesting mechanics around monkey king. His m_flSpawnedAt never changed + he have about ~30 m_flSpawnedAt changes with +1 second each. I think it's kind hack to work around with ultimate since every monkey king instance in his ultimate is separated hero.

Maybe there is some special event/moment when hero is spawning and all my stuff is just mess ?

Getting game time

For any event how do I get the game time for it?

For eample, how should I modify this to also print the game time when the message was said:

p.Callbacks.OnCUserMessageSayText2(func(m *dota.CUserMessageSayText2) error {
  log.Printf("%s said: %s\n", m.GetParam1(), m.GetParam2())
  return nil
})

Examples or any actual documentation?

Is there any repo of examples or any documentation that isn't autogen GO docs (with limited to no docstrings), or old examples from an older version with a different interface?

Haven't been able to get in touch on the IRC either.

Output all information structured and human readable

I'm a complete novice with GOLang, literally started using it solely for the purpose of using manta, so this may well be an idiot question.

Is there a simple way to output all information from the replay in a human readable format (doesn't have to be pretty). I'm assuming this will work based on reflection, but I'm so new to GOLang I have no idea of the functionality. Is this a stupid request, has anyone done it before?

P.S. I tried to seek help on the IRC but no one answered (too busy playing dota I guess!) :D

Execution Error

Hello! I am using liteIDE for Windows and go 1.5.3 for 64-bit windows.
I have following code
image

It is building ok, but after runing exetuable file I got unknown for me error

image

Another simple code like HelloWorld works.

Please, somebody help me with this. What i am doing wrong ?

No example projects

There isn't any example project like there is in dotabuff/yasha for how to use manta

The action of the player!

When I watch the video at the view of the player, I can see the click of the mouse . But I can't find the infomation in the analytic process . How can I get the tick when a player click ?

Thanks

Having issue parsing replays with example project

Hey! I'm having some issues using the example project. When I execute it, I get this

panic: unexpected magic: expected PBDEMS2, got PBUFDEM

goroutine 1 [running]:
main.main()
/Users/ricksong/Personal/dota/replays/chat-scraper.go:14 +0x81

Sorry! New to Go and Manta. Thanks for the help.

OnEntity / OnGameEvent callbacks didn't fired

Try to parse replay.dem file, can't get game events or entities,

  • is parser up to date?
  • does my code use parser correctly?
package main

import (
	"github.com/dotabuff/manta"
	"log"
	"os"
)

func main() {
	f, err := os.Open("replays/5530602426.dem")

	if err != nil {
		log.Fatal(err)
	}

	defer f.Close()

	p, err := manta.NewStreamParser(f)

	if err != nil {
		log.Fatal(err)
	}

	gotEntityEvents := int32(0)
	gotCombatLogEvents := int32(0)

	p.OnEntity(func(e *manta.Entity, o manta.EntityOp) error {
		gotEntityEvents += 1
		return nil
	})

	p.OnGameEvent("dota_combatlog", func(m *manta.GameEvent) error {
		gotCombatLogEvents += 1
		return nil
	})

	p.Start()

	log.Printf("gotEntityEvents: %v\n", gotEntityEvents)
	log.Printf("gotCombatLogEvents: %v\n", gotCombatLogEvents)
}

Output

 go run ./cmd/parse/*.go
2020/07/23 19:57:17 gotEntityEvents: 0
2020/07/23 19:57:17 gotCombatLogEvents: 0

How to get actual hero names from combat log?

Hello,

Sorry for creating an issue, I had no success in quakenet chat :) (maybe my timezone differs too much)

I am trying to parse combatlog. For example, I have this record acquired with OnCMsgDOTACombatLogEntry:
type:DOTA_COMBATLOG_DAMAGE target_name:10 target_source_name:10 attacker_name:53 damage_source_name:53 is_attacker_illusion:false is_attacker_hero:false is_target_illusion:false is_target_hero:true is_visible_radiant:true is_visible_dire:true value:14 health:566 timestamp:638.93225 timestamp_raw:898.5334 last_hits:0 attacker_team:2 target_team:3 is_target_building:false damage_type:1 damage_category:1 networth:0

My question is: how can I find out which is the 10th hero from target_name? As I investigated, it's not hero id from web api.

Thank you

About StringTables

I wanted to associate heros to player names. In the past (with edith) I've done so through stringtables. Either I am missing something, or the support for stringtables is still very rudimentary?

First, the only public API to stringtables is

func (p *Parser) LookupStringByIndex(table string, index int32) (string, bool)

which returns the Key 😮 and there's nothing to get the Value?

Second, I wanted to do some inspection, for example to find out what index of what table I actually want. After adding a function in order to get at them:

func (p *Parser) GetStringTables() *stringTables { return p.stringTables }

I can now dump them once the parser is run like so:

sts := p.GetStringTables()
for name, idx := range sts.NameIndex {
    log.Printf("%s: %d\n", name, idx)
    st := sts.Tables[idx]
    if name == "userinfo" {
        for iidx, item := range st.Items {
            log.Printf("%d (idx:%d key:%s): %s\n", iidx, item.Index, item.Key, item.Value)
        }
    }
}

I'm appending the full output. I think it is pretty clear from it that somewhere along the way, the parsing of the stringtable breaks. We can see the player names surrounded by some garbage, and not a single key as string.

I guess my questions are: am I doing something wrong? Is this a known issue? Is nobody using stringtables?
I've looked into the code, and it seems the actual parsing has changed since the edith times of v1 engine.

2016/11/08 17:03:23 downloadables: 0
2016/11/08 17:03:23 EffectDispatch: 8
2016/11/08 17:03:23 VguiScreen: 9
2016/11/08 17:03:23 ResponseKeys: 17
2016/11/08 17:03:23 LuaModifiers: 18
2016/11/08 17:03:23 ParticleAssets: 19
2016/11/08 17:03:23 genericprecache: 1
2016/11/08 17:03:23 decalprecache: 2
2016/11/08 17:03:23 lightstyles: 4
2016/11/08 17:03:23 EntityNames: 7
2016/11/08 17:03:23 EconItems: 15
2016/11/08 17:03:23 CombatLogNames: 16
2016/11/08 17:03:23 instancebaseline: 3
2016/11/08 17:03:23 userinfo: 5
2016/11/08 17:03:23 39 (idx:39 key:39): 
2016/11/08 17:03:23 58 (idx:58 key:58): 
2016/11/08 17:03:23 29 (idx:29 key:29): 
2016/11/08 17:03:23 22 (idx:22 key:22): 
2016/11/08 17:03:23 32 (idx:32 key:32): 
2016/11/08 17:03:23 38 (idx:38 key:38): 
2016/11/08 17:03:23 44 (idx:44 key:44): 
2016/11/08 17:03:23 46 (idx:46 key:46): 
2016/11/08 17:03:23 51 (idx:51 key:51): 
2016/11/08 17:03:23 54 (idx:54 key:54): 
2016/11/08 17:03:23 15 (idx:15 key:15): 
2016/11/08 17:03:23 63 (idx:63 key:63): 
2016/11/08 17:03:23 6 (idx:6 key:6): 

jhons20167ÅË!ÅË(0
2016/11/08 17:03:23 23 (idx:23 key:23): 
2016/11/08 17:03:23 5 (idx:5 key:5): 

Y E N F R I¼Î	!¼Î	(0
2016/11/08 17:03:23 13 (idx:13 key:13): 
2016/11/08 17:03:23 49 (idx:49 key:49): 
2016/11/08 17:03:23 60 (idx:60 key:60): 
2016/11/08 17:03:23 10 (idx:10 key:10): 
Lechuga¥«
         !¥«(0
2016/11/08 17:03:23 19 (idx:19 key:19): 
2016/11/08 17:03:23 12 (idx:12 key:12): 
2016/11/08 17:03:23 57 (idx:57 key:57): 
2016/11/08 17:03:23 26 (idx:26 key:26): 
2016/11/08 17:03:23 41 (idx:41 key:41): 
2016/11/08 17:03:23 50 (idx:50 key:50): 
2016/11/08 17:03:23 0 (idx:0 key:0):                                                                                                                                                                                                                          SourceTV!@(0
2016/11/08 17:03:23 8 (idx:8 key:8): 

AjarGiraffeø!ø(0
2016/11/08 17:03:23 43 (idx:43 key:43): 
2016/11/08 17:03:23 47 (idx:47 key:47): 
2016/11/08 17:03:23 55 (idx:55 key:55): 
2016/11/08 17:03:23 56 (idx:56 key:56): 
2016/11/08 17:03:23 4 (idx:4 key:4): 
Tsyklon|Îß!|Îß(0
2016/11/08 17:03:23 17 (idx:17 key:17): 
2016/11/08 17:03:23 18 (idx:18 key:18): 
2016/11/08 17:03:23 20 (idx:20 key:20): 
2016/11/08 17:03:23 27 (idx:27 key:27): 
2016/11/08 17:03:23 42 (idx:42 key:42): 
2016/11/08 17:03:23 16 (idx:16 key:16): 
2016/11/08 17:03:23 48 (idx:48 key:48): 
2016/11/08 17:03:23 25 (idx:25 key:25): 
2016/11/08 17:03:23 36 (idx:36 key:36): 
2016/11/08 17:03:23 35 (idx:35 key:35): 
2016/11/08 17:03:23 37 (idx:37 key:37): 
2016/11/08 17:03:23 3 (idx:3 key:3): 
CryMoarPlz luck.duckUG!UG(0
2016/11/08 17:03:23 30 (idx:30 key:30): 
2016/11/08 17:03:23 34 (idx:34 key:34): 
2016/11/08 17:03:23 52 (idx:52 key:52): 
2016/11/08 17:03:23 61 (idx:61 key:61): 
2016/11/08 17:03:23 14 (idx:14 key:14): 
2016/11/08 17:03:23 33 (idx:33 key:33): 
2016/11/08 17:03:23 40 (idx:40 key:40): 
2016/11/08 17:03:23 62 (idx:62 key:62): 
2016/11/08 17:03:23 24 (idx:24 key:24): 
2016/11/08 17:03:23 9 (idx:9 key:9):                                                                                                                                                                                                                          chuchaki÷(
         
!÷(
   (0
2016/11/08 17:03:23 11 (idx:11 key:11): 
2016/11/08 17:03:23 28 (idx:28 key:28): 
2016/11/08 17:03:23 31 (idx:31 key:31): 
2016/11/08 17:03:23 45 (idx:45 key:45): 
2016/11/08 17:03:23 59 (idx:59 key:59): 
2016/11/08 17:03:23 7 (idx:7 key:7): 
Kratos- GuerraàK
               !àK
                  (0
2016/11/08 17:03:23 2 (idx:2 key:2): 
Viento֑r!֑r(0
2016/11/08 17:03:23 21 (idx:21 key:21): 
2016/11/08 17:03:23 53 (idx:53 key:53): 
2016/11/08 17:03:23 1 (idx:1 key:1): 
	Blade5431Ç3
                   !Ç3
                      (0
2016/11/08 17:03:23 server_query_info: 6
^[[?1;2c2016/11/08 17:03:23 InfoPanel: 10
2016/11/08 17:03:23 Scenes: 11
2016/11/08 17:03:23 ModifierNames: 12
2016/11/08 17:03:23 ActiveModifiers: 13
2016/11/08 17:03:23 CooldownNames: 14
^[[?1;2c^[[?1;2c⏎                                                                                                                                                                                                                                              

MatchPrivateMetadata

The file of dota/dota_match_metadata.proto show that wo can get the private data from the demo.
But when I get the "private_metadata" from the struct of CDOTAMatchMetadataFile , I see the length of the slice is 0. Is the problem of the protobuf ? The Index of "private_metadata" become 5 after 3, or it means the struct is not clear.

Pregame Details

Does any know how or IF is it even possible to get information about the pregame?

Item stats

Hi guys,

I'm new to Go (trying it out just because of manta) and I'm trying to get some info about my replays using manta.

I want to take a snapshot of a hero's items in a specific moment in time. For that, I'm reading the replay and adding few Callbacks for the messages I think makes more sense about items (code below)

My problem is that those callbacks are never called. Sorry to bother, but what callback should I use to check bought & sold items?

Thanks

package main

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/dir/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)
    }

    p.Callbacks.OnCDOTAUserMsg_ItemPurchased(func(m *dota.CDOTAUserMsg_ItemPurchased) error {
        log.Printf("OnCDOTAUserMsg_ItemPurchased")
        return nil
    })

    p.Callbacks.OnCUserMessageItemPickup(func(m *dota.CUserMessageItemPickup) error {
        log.Printf("OnCUserMessageItemPickup")
        return nil
    })

    p.Callbacks.OnCDOTAUserMsg_ItemAlert(func(m *dota.CDOTAUserMsg_ItemAlert) error {
        log.Printf("OnCDOTAUserMsg_ItemAlert")
        return nil
    })

    p.Callbacks.OnCDOTAUserMsg_ItemFound(func(m *dota.CDOTAUserMsg_ItemFound) error {
        log.Printf("OnCDOTAUserMsg_ItemFound")
        return nil
    })

    p.Callbacks.OnCDOTAUserMsg_ItemSold(func(m *dota.CDOTAUserMsg_ItemSold) error {
        log.Printf("OnCDOTAUserMsg_ItemSold")
        return nil
    })

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

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

Entity Class ID & Names

I'm sure this has been asked before but I couldn't find an answer.

Where are all the entity class ID/names documented? And also, the messages each class consists of (e.g. CDOTAGamerulesProxy (746) consists of m_pGameRules, etc.

For example, there is an outdated list of entity classes on: https://docs.ensage.io/html/T_Ensage_ClassId.htm

About the

Hello!
I found many userfull fuction in dota_usermessage.pb.go.But It doesn't transfered in the example.
How can I get the GPM or Xpm info in a specific game time by manta?
Any other example?
Does All of the Info in Dotabuff.com can be get By Manta?

Question on descriptor.proto

Is there any reason why you would not use "official" descriptor.pb.go instead of generating your own?

That would be useful in case of importing your project together with any other project which uses descriptor.proto.

In my case it is go-steam.

is there a way to output every movement of each player during the whole game?

Hi,
is there a way to output every movement of each player during the whole game?
Output all the data according to time?

By the way I tried some of the callbacks,and it has no output(not executed such as OnCDOTAUserMsg_CombatHeroPositions) ?

And how do I get hero position data(movement) during the whole game?

I am new to GO, Thanks for your time.

How does readUBitVar in reader.go work?

Hello, I am an avid dotabuff user and I have been browsing the code of this project over the last few days. Big thanks for making it available to everyone! It is very readable as well (even without a Go background).

One point is not clear though: looking at the readUBitVar function (https://github.com/dotabuff/manta/blob/master/reader.go#L158), it seems to read a uint32 from an array of bytes. It is typically used to get the type of the message(s) inside a CDemoPacket.

Trying to make my own implementation of a dota 2 replay parser (in rust), I have used the equivalent of readVarUint32 to do this. It works well to get the type (EDemoCommand of type uint32) and size (uint32) of a demo command, but not to get the type of an embedded message in a CDemoPacket: it returns the wrong value.

So I wonder how this function works and what is the reasoning behind it (why not use readVarUint32) ?
This kind of low-level bit manipulation might be explained in some article or wikipedia page you could point me to? Is it a protobuf specific encoding?

What I have understood so far: the encoding is little-endian so the first 6 bits are in fact the last 6 bits in normal order. They contain information about the encoding of the number. We then read some more bits (a varying number depending on the encoding) to get the full number.

PS: I have looked at the python implementation (smoke) which does something similar but it is not clearer (https://github.com/skadistats/smoke/blob/a2954fbe2fa3936d64aee5b5567be294fef228e6/smoke/io/stream/entity.pyx#L11)

Thank you very much for your answer!

Erroneous float decoding for some packet entity properties

Some float32 properties in packet entities do not get decoded properly. So far, I've seen this behaviour for the m_flMaxMana property of CDOTA_Unit_Hero entities and the m_flCooldownLength property of CDOTA_Item entities.

I wrote a small toy example which just prints the m_flMaxMana property of every updated CDOTA_Unit_Hero packet:

package main

import (
    "fmt"
    "os"
    "strings"

    "github.com/dotabuff/manta"
)

func main() {
    for _, arg := range os.Args[1:] {
        parser, err := manta.NewParserFromFile(arg)
        if err != nil {
            panic(err)
        }

        parser.OnPacketEntity(func(pe *manta.PacketEntity, eventType manta.EntityEventType) error {

            switch eventType {

            case manta.EntityEventType_Update:
                entityNamesTable, _ := parser.StringTables.GetTableByName("EntityNames")

                if strings.Contains(pe.ClassName, "CDOTA_Unit_Hero") {
                    entityNameIndex, _ := pe.Fetch("CEntityIdentity.m_nameStringableIndex")
                    entityName := entityNamesTable.Items[entityNameIndex.(int32)].Key
                    maxMana, _ := pe.FetchFloat32("m_flMaxMana");

                    if maxMana > 0 {
                        fmt.Println(parser.Tick, entityName, maxMana)
                    }
                }
            }
            return nil
        })

        parser.Start()
    }
}

The output of this program looks something like this (using the 1788648401 replay from the manta test suite):

832 npc_dota_hero_furion 6.12e-42
856 npc_dota_hero_furion 6.12e-42
918 npc_dota_hero_shadow_demon 6.702e-42
984 npc_dota_hero_shadow_demon 6.702e-42
1358 npc_dota_hero_furion 6.12e-42
7299 npc_dota_hero_antimage 4.37e-42
7301 npc_dota_hero_antimage 4.37e-42
7319 npc_dota_hero_puck 7.285e-42
7321 npc_dota_hero_antimage 4.37e-42
7325 npc_dota_hero_bloodseeker 5.245e-42
7341 npc_dota_hero_puck 7.285e-42
7343 npc_dota_hero_antimage 4.37e-42
7343 npc_dota_hero_puck 7.285e-42
7345 npc_dota_hero_antimage 4.37e-42
7345 npc_dota_hero_puck 7.285e-42
...

All values are very close to zero, which doesn't make sense in this context. Does anyone know why this happens?

Not getting any data output from parser

I'm having issues with getting any data out of my replays. For example my entity function doesn't seem to ever be called.
`p.OnEntity(func(pe *manta.Entity, pet manta.EntityOp) error {
log.Printf("Received entity packer %v", pe)

})
`
and neither is my combat log:

`p.Callbacks.OnCMsgDOTACombatLogEntry(func(m *dota.CMsgDOTACombatLogEntry) error {
log.Printf("Received combat log entry %v", m)
t := m.GetType()
switch dota.DOTA_COMBATLOG_TYPES(t) {
case dota.DOTA_COMBATLOG_TYPES_DOTA_COMBATLOG_DAMAGE:
iat := m.GetIsAttackerIllusion()
iah := m.GetIsAttackerHero()
iti := m.GetIsTargetIllusion()
ith := m.GetIsTargetHero()
ivr := m.GetIsVisibleRadiant()
ivd := m.GetIsVisibleDire()
itb:= m.GetIsTargetBuilding()

		target, _ := p.LookupStringByIndex("CombatLogNames", int32(m.GetTargetName()))
		targetSource, _ := p.LookupStringByIndex("CombatLogNames", int32(m.GetTargetSourceName()))
		attacker, _ := p.LookupStringByIndex("CombatLogNames", int32(m.GetAttackerName()))
		damageSource, _ := p.LookupStringByIndex("CombatLogNames", int32(m.GetDamageSourceName()))
		inflictor, _ := p.LookupStringByIndex("CombatLogNames", int32(m.GetInflictorName()))
		value := m.GetValue()

		log.Printf("{\"type\":24,\"time\":\"%s\",\"iat\":%t,\"iah\":%t,\"iti\":%t,\"ith\":%t,\"ivr\":%t,\"ivd\":%t,\"itb\":%t,\"attacker\":\"%s\",\"target\":\"%s\",\"target_source\":\"%s\",\"damage_source\":\"%s\",\"inflictor\":\"%s\",\"value\":%d},", formatDuration(gameTime), iat, iah,iti,ith,ivr,ivd,itb,attacker,target,targetSource,damageSource,inflictor,value)

.......
`
gameEventParsing.txt

I've attached the full file as well. Any help is greatly appreciated

Getting camera coordinates etc. of casters

I can get hero locations through OnEntity and filtering out entities that are heroes. I assume that I can do something similar to get the camera info. I'm not really sure what class I need to get a hold of to be able to do it.

I tried going through the SpectatorPlayerUnitOrder and that does seem to capture some actions of the caster but not always (I'm guessing because they can't issue commands).

Can't get any data from parser, no callbacks fired

I try diffrent callbacks, but all callbacks won't be fired and no errors received.

func main() {
	f, err := os.Open("replays/5530602426.dem")

	if err != nil {
		log.Fatal(err)
	}

	defer f.Close()

	p, err := manta.NewStreamParser(f)

	if err != nil {
		log.Fatal(err)
	}

	p.Callbacks.OnCDOTAUserMsg_ChatEvent(func(m *dota.CDOTAUserMsg_ChatEvent) error {
		log.Printf("log %v \n", m.Type)
		return nil
	})


	p.Callbacks.OnCDOTAMatchMetadataFile(func(m *dota.CDOTAMatchMetadataFile) error {
		log.Printf("log %v \n", m.MatchId)
		return nil
	})

	p.Callbacks.OnCDOTAUserMsg_DamageReport(func(m *dota.CDOTAUserMsg_DamageReport) error {
		log.Printf("log %v \n", m.DamageAmount)
		return nil
	})

	p.Start()
}

The ClientMsg Parser

When I see the file base_gcmessages.pb.go, I find that there are some message I can't parser such as CDOTAClientMsg_ItemAlert, CDOTAClientMsg_ModifierAlert and so on .
Can somebody tell me how can I get the content from those message!

Thanks !

relations in callback.go

In callbacks.go, you have combine the ids with the protobuf messages.
For example, in line 2005, you combine id 46 with dota.SVC_Messages_svc_VoiceInit message.
I want to know how do you know that.
Thank you~

OnCDemoFileInfo callback doesn't get executed

I adapted the simple chat example to get the CDemoFileInfo part of a replay:

package main

import (
    "fmt"
    "os"

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

func main() {
    for _, arg := range os.Args[1:] {
        parser, err := manta.NewParserFromFile(arg)
        if err != nil {
            panic(err)
        }

        parser.Callbacks.OnCDemoFileInfo(func(fileInfo *dota.CDemoFileInfo) error {
            fmt.Print("Executing CDemoFIleInfo callback")
            return nil
        })

        parser.Start()
    }
}

Unfortunately, it seems like the OnCDemoFileInfo callback doesn't get executed (using the Source 2 replays from the test suite). Am I using the callback wrong? Or is this part not implemented yet?

Not getting output

Hi

I am really new to Go and all the replay parsing for a university project.
I am trying to parse a complete rep with your example code. I just dont get it running.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x207f]

goroutine 1 [running]:
main.main()
/Users/username/Developer/go/src/main.go:17 +0x3f
exit status 2

Since i am just starting, it would be so great if someone could help me out here.

Also I tried the chat.go. It compiles and seems to run. But I don´t get any parsed output file...

Kind regards and thanks in advance
Peter

Any easy way to get total gold net worth

I've parsed OnCDOTAMatchMetadataFile(func(m *dota.CDOTAMatchMetadataFile) but it only gives slices of netWorth. Not the final one.

Here is the code:

parser.Callbacks.OnCDOTAMatchMetadataFile(func(m *dota.CDOTAMatchMetadataFile) error {
fmt.Println("lll>>", m.Metadata.GetTeams()[0].GetPlayers()[4].GetGraphNetWorth()[len(m.Metadata.GetTeams()[0].GetPlayers()[2].GetGraphNetWorth())-1])
return nil
})

Is final net worth value hidden and need calculations?

Getting Replay Events

Is it possible to get the replay events using this library? Like tower kills, heroes kills etc.

Getting length of an array?

Hi, I wonder how to get the length of an entity's field that is an array.

An example of such a field is in CDOTA_PlayerResource the field m_vecPlayerData, where we access individual entries through, for example, m_vecPlayerData.0003.m_iPlayerSteamID etc.

In an old version of this code (before the gigantic update in commit 805b5d), I used to get the length of an entity's field as follows nplayers, found := entity.FetchUint32("m_vecPlayerData"). Translating this to the new API, I would try nplayers, found := e.GetUint32("m_vecPlayerData"), but this does not work anymore. Actually, e.Get("m_vecPlayerData") does work and returns something of type *manta.fieldState which I cannot further work with, since it's an internal type.

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.