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

Gh 692 allow client to toggle bots #693

Merged
merged 15 commits into from
Jun 18, 2024

Conversation

Nico-Sanchez
Copy link
Collaborator

@Nico-Sanchez Nico-Sanchez commented Jun 10, 2024

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

  • Tested the changes locally.
  • Reviewed the changes on GitHub, line by line.
  • This change requires new documentation.
    • Documentation has been added/updated.

@Nico-Sanchez Nico-Sanchez changed the base branch from main to gh-687-allow-client-to-toggle-zone June 11, 2024 18:48
Base automatically changed from gh-687-allow-client-to-toggle-zone to main June 11, 2024 19:05
@Nico-Sanchez Nico-Sanchez marked this pull request as ready for review June 11, 2024 20:51
alfopisano

This comment was marked as resolved.

@alfopisano alfopisano self-requested a review June 12, 2024 17:55
event: {:toggle_bots, %ToggleBots{}}
})

PubSub.broadcast(Arena.PubSub, state.game_state.game_id, {:toggle_bots, encoded_msg})
Copy link
Contributor

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

Copy link
Collaborator Author

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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, that makes sense!

@tkz00
Copy link
Contributor

tkz00 commented Jun 13, 2024

Other small thing, the client PR referenced in the description is closed, there is a new one to link!

@manucamejo
Copy link
Collaborator

@Nico-Sanchez Remember to redeploy the bots server when this PR gets merged

Copy link
Contributor

@agustinesco agustinesco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@agustinesco agustinesco dismissed alfopisano’s stale review June 18, 2024 15:20

This was already adressed

@agustinesco agustinesco merged commit 275d4b7 into main Jun 18, 2024
10 checks passed
@agustinesco agustinesco deleted the gh-692-allow-client-to-toggle-bots branch June 18, 2024 15:20
@saugon saugon restored the gh-692-allow-client-to-toggle-bots branch July 17, 2024 23:40
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.

Allow client to deactivate the BOTS
5 participants