hohav / py-slippi

Python library for parsing SSBM replay files
MIT License
56 stars 25 forks source link

Get kills (deaths) count and Slippi player's code (with format XXXX#1234) #19

Closed Coukaratcha closed 4 years ago

Coukaratcha commented 4 years ago

I searched for kills (or deaths) count in Game output but I cannot find it. So I do not know how to find which player won the game.

Also, I see that you give netplay name but I cannot find the player's code (the one with this format: XXXX#1234)

How can I get these fields?

hohav commented 4 years ago

As of e95b676ec2d610ed3f74059a833d7afb434cfa78, the netplay code is now available as metadata.players[n].netplay.code, with the old netplay_name alongside it as .netplay.name.

You can get the number of stocks as frame[n].ports[p].leader.post.stocks, but "kills" is not directly available— indirect stats like that are currently out of py-slippi's scope.

Unfortunately, Slippi also doesn't directly encode information about who won the game, so you have to look at the last frame as well as game.end and do some guessing. E.g. "if a player LRAS'd, assume they lost; otherwise assume the winner is the player with more stocks on the last frame (or less damage, in case of a tie)".