Wazarr94 / haxball_bot_headless

Ready-to-go scripts and functions for the HaxBall Headless API !
MIT License
46 stars 74 forks source link

getGK function does not return the correct player #40

Closed iwishiknewcoding closed 2 years ago

iwishiknewcoding commented 2 years ago

the majority of the time, the getGK() function returns the wrong player in 3v3 matches (didn't check in 2v2). The reason I think is because for some cases the GKTicks is not incrementing. Though I was not able to find the pattern.

sorry for yet another issue, don't hate me pls 🙁

Wazarr94 commented 2 years ago

No worries, this was bound to happen, this is pretty difficult to test myself because I don't have a room running where I can test stuff. Will look into this quickly

iwishiknewcoding commented 2 years ago

let me know if I can help somehow

Wazarr94 commented 2 years ago

How did you test this? FYI, if you open a room on your browser and open consecutively 6-7 different tabs for each player, it will not work. Since the PlayerComposition object (bad name, want to change it one day) works with the auth property, it will mess up the computation of the GK ticks. If you clear your localStorage before opening a new tab, you'll get a new auth for each player and avoid such problem. I've followed the procedure I just described and played 2v2, didn't have any problem with GK ticks.

iwishiknewcoding commented 2 years ago

I've tested this in a live room with different people, I am aware of the PlayerComposition working with the auth. Initially, the GKTicks was fine and it was showing the correct GKs, but after a bit, it started to show wrong players 🙁 and the GKTicks stopped incrementing in some cases (actually, all the cases when I was monitoring it). Not very helpful, I know. I will try to collect some more information.

iwishiknewcoding commented 2 years ago

Turns out it was a false alarm, sorry. I'm running two different rooms with your codes customised in two different ways. When I was adding the CS logic based on your commit, I did it correctly in one of the rooms, but missed to call handleGK() in getGameStats() which is fired on GameTick. 🙁 Hence the GKTicks not incrementing.

Anyways, closing this issue now. Thanks