demoinfocs-golang
demoinfocs-golang copied to clipboard
Mapname and gamerounds all empty
I found that my function of getting mapname and getting each round of each game failed in the latest master, and in 4.0.0 beta2 only mapname failed. Hello, I'm very sorry that I didn't quite understand what you meant because I'm a newbie to this part. This is my code and I found that it does not take effect anymore. It still takes effect in 4.0.0 beta2 but not in the latest master. Here is my mapname code // Create new demoparser p := dem.NewParser(f) defer p.Close()
// Parse demofile header
header, err := p.ParseHeader()
checkError(err)
// Parse nav mesh given the map name
currentMap := header.MapName
I found a solution to get mapname, but the rank information and gamerounds of cs2 are still empty, I don't know why, and 4.0.0 beta2 is very slow, master is very fast but its data are all empty
What I mean is that most of the data can be obtained in beta2 but it is very slow, while in master it is very fast but the data is empty.
I found a possibility in my code when i fmt.Println(currentGame.MatchPhases.RoundStarted)
:
(*demoParser).RegisterEventHandler(func(e events.RoundStart) {
gs := (*demoParser).GameState()
currentGame.MatchPhases.RoundStarted = append(currentGame.MatchPhases.RoundStarted, int64(gs.IngameTick()))
fmt.Println(currentGame.MatchPhases.RoundStarted)
if *roundStarted == 1 {
currentGame.Rounds = append(currentGame.Rounds, *currentRound)
} else {
*globalFrameIndex = 0
}
the latetest version RoundStart only fires once:
, however beta2 got many:
RegisterNetMessageHandler(msg *msgs2.CSVCMsg_ServerInfo) { // msg.MapName }
You can get map name through this way.
The issue is that CS2 demos do not include this info in the header - we might deprecate Header.MapName in the future
The issue is that CS2 demos do not include this info in the header - we might deprecate
Header.MapNamein the future
Thanks for your reply, but I already found a solution to get mapname, now the question is i got totaly empty round info. the latetest version RoundStart only fires once and roundend event didn't fire. when i fmt.Println(currentGame.MatchPhases.RoundStarted) : (*demoParser).RegisterEventHandler(func(e events.RoundStart) { gs := (*demoParser).GameState() currentGame.MatchPhases.RoundStarted = append(currentGame.MatchPhases.RoundStarted, int64(gs.IngameTick())) fmt.Println(currentGame.MatchPhases.RoundStarted) if *roundStarted == 1 { currentGame.Rounds = append(currentGame.Rounds, *currentRound) } else { *globalFrameIndex = 0 }
It's not only MapName but all fields in common.DemoHeader comes empty.
h, _ := p.ParseHeader() // no error here
slog.Info("parsed demo header", "header", h)
INFO parsed demo header header="{Filestamp:PBDEMS2 Protocol:0 NetworkProtocol:0 ServerName: ClientName: MapName: GameDirectory: PlaybackTime:0s PlaybackTicks:0 PlaybackFrames:0 SignonLength:0}"
demo: https://www.faceit.com/ru/cs2/room/1-b02514d4-11e8-415a-92ff-9a9461feb033