ZaharX97 / CSGOdemoPythonParser

A CSGO .dem (demo) file parser in python
GNU General Public License v3.0
16 stars 3 forks source link

How to get players' positions and actions in one round for every game unit time #1

Closed hx-w closed 4 years ago

hx-w commented 4 years ago

I want to make a replay function within a single round. How can I use this demo parser to get the positions and actions of all players during a specific round as the game time changes?

ZaharX97 commented 4 years ago

About the player positions, i uploaded an example file that gets player positions every game tick > check this
For other actions, you might want to look at the game events list and do a specific thing for a specific event. Like when a player throws a grenade, save that in a variable or whatever you need for your replay.

As a sidenote, this parser is actually kind of slow compared to https://github.com/markus-wa/demoinfocs-golang. It takes almost 60 seconds to do what the other does in 1 second :)

hx-w commented 4 years ago

About the player positions, i uploaded an example file that gets player positions every game tick > check this For other actions, you might want to look at the game events list and do a specific thing for a specific event. Like when a player throws a grenade, save that in a variable or whatever you need for your replay.

As a sidenote, this parser is actually kind of slow compared to https://github.com/markus-wa/demoinfocs-golang. It takes almost 60 seconds to do what the other does in 1 second :)

It's very helpful. Thanks for your sharing 👍XD

hx-w commented 4 years ago

I just ran the program, and I found that the function "print_player_positions"https://github.com/ZaharX97/CSGOdemoPythonParser/blob/5a669c58df7146afb7bf587b2b0a9b660e66281a/example/player_pos_funcs.py#L30 may never be called in parsering my demo... Does this works perfectly in your computer, or just my demo's problem.

ZaharX97 commented 4 years ago

I updated the main program and forgot to also upload it, sry :)
It should work if you download it again, or open your copy of DemoParser.py and add the lines 102, 106 - 108
Also, I made this change because the player Z position was wrong. From my tests it looks the same as the one in cl_showplayerpos 1 in game

hx-w commented 4 years ago

I updated the main program and forgot to also upload it, sry :) It should work if you download it again, or open your copy of DemoParser.py and add the lines 102, 106 - 108 Also, I made this change because the player Z position was wrong. From my tests it looks the same as the one in cl_showplayerpos 1 in game

It works well. Thank you!