-
Notifications
You must be signed in to change notification settings - Fork 2
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
Gh 692 allow client to toggle bots #693
Conversation
event: {:toggle_bots, %ToggleBots{}} | ||
}) | ||
|
||
PubSub.broadcast(Arena.PubSub, state.game_state.game_id, {:toggle_bots, encoded_msg}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this message broadcasted to the clients? The only difference turning on or off the bots makes to them is received through the GameState
message, they don't handle this message in any way.
Client PR for reference: [GH-1831] Add toggle bots button
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bots are clients as well. Said so, the bots ARE handling that message to change its state.
You can check it in apps/bot_manager/lib/game_socket_handler.ex
Also, remember the bots are deployed in a different server than where the backend runs (arena), so we need to send the message somehow (I use this broadcast for that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, that makes sense!
Other small thing, the client PR referenced in the description is closed, there is a new one to link! |
@Nico-Sanchez Remember to redeploy the bots server when this PR gets merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Important
This PR must be merged along with https://github.com/lambdaclass/champions_of_mirra/pull/1840
Motivation
We must allow clients to enable and disable the bots.
Closes #692
Summary of changes
How to test it?
Play a game with the following client branch -> https://github.com/lambdaclass/champions_of_mirra/pull/1833
Toggle the BOTS in settings > dev tab > utils.
Checklist