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

Game State Channel Game Start #116

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

BrennanAyers
Copy link
Owner

@BrennanAyers BrennanAyers commented Oct 2, 2019

Pull Request Template

Description

This PR brings in the functionality for the Game State Channel websocket to begin a Game when enough Players subscribe, and then relay this Game State to all subscribed Players. To facilitate a quick refactor, the number of Players in a Game has been bumped from 2 to 4, and one of the join_game endpoints has been skipped.
The output of the game-started message is exactly the same as the game_state endpoint output, allowing the Frontend to render React accordingly from the Waiting screen to the Game Board screen. It also will not require major refactoring of the processing of tableDeck and other information.
The Game State Channel now will use the private begin_game? method every time a Player subscribes to check if the Game has enough Players. If not, it will move on, otherwise, it will game.start and then send the game-started message containing the full Game State.
For some undetermined reason, the action-cable-testing gem does not play well with FactoryBot, so our create_cards method in the GameStateChannel spec is handling that functionality currently.

Resolves #107

Type of change

Please delete options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • GameStateChannel game-started broadcast spec
  • Removal of rejects connections if more than max players join join_game endpoint spec

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

BrennanAyers and others added 6 commits October 1, 2019 15:38
…e with 4 Players and Broadcasting GameState

Co-Authored-By: Patrick Duvall <[email protected]>
… 4 using previous logic from Player joining

Co-Authored-By: Patrick Duvall <[email protected]>
…ic is moved into GameStateChannel

Co-Authored-By: Patrick Duvall <[email protected]>
…to GameStateChannel instead

Co-Authored-By: Patrick Duvall <[email protected]>
….start to occur on GameStateChannel subscriptions instead

Co-Authored-By: Patrick Duvall <[email protected]>
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.

Game State sends full information once enough Players join the Game
1 participant