Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: input controls being applied to ai players. #809

Merged
merged 1 commit into from
Jun 18, 2023

Conversation

tzemanovic
Copy link
Contributor

@tzemanovic tzemanovic commented Jun 16, 2023

fixes #722

I'm still getting familiar with the code, but it looks like what's happening is that when you press the Grab/Drop key on Keyboard 2, the input sometimes makes the AI player drop the sword and when it has enough velocity it gets insta-killed by collision detection (this I think is related to #714). I was able to reproduce this issue in a local game only.

After some digging, I found that this seems to be caused the session's input being propagated to all the player inputs including the AIs in a local session (when network_player_idx.is_some()). Removing the condition skips the loop for AI players locally and still works in a network game, where each local player has player_idx = 0.

@tzemanovic tzemanovic changed the title fix input controls being applied to ai players fix: input controls being applied to ai players Jun 16, 2023
@zicklag zicklag changed the title fix: input controls being applied to ai players fix: input controls being applied to ai players. Jun 16, 2023
@zicklag
Copy link
Member

zicklag commented Jun 17, 2023

Awesome, thank you! I'll try to check this out when I get the chance.

@lecoqjacob I requested your review, in case you want to and you can get to checking this out before me. Nevermined, it didn't let me request your review, but if you want to check this out feel free. :)

@bayou-brogrammer
Copy link
Contributor

In the scenario where we have AI players in an online session, does this break that rule?

@zicklag
Copy link
Member

zicklag commented Jun 17, 2023

We actually don't let you have AI in an online match at the moment. Still we'll probably want that so we might want to code defensively and assume that it could happen.

@tzemanovic
Copy link
Contributor Author

Yeah, I think this will still work with AI players in an online session because their input is being controlled elsewhere (fn player_ai_system)

@zicklag
Copy link
Member

zicklag commented Jun 18, 2023

Sounds good, mering! Thank you!

@zicklag zicklag added this pull request to the merge queue Jun 18, 2023
Merged via the queue into fishfolk:main with commit 97bfa90 Jun 18, 2023
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Second Player Dies When Pressing Right Shift in Some Circumstances
3 participants