Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Bug/game not running actions #99

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

Conversation

cveneziani
Copy link
Member

No description provided.

@r3trofitted
Copy link
Contributor

I see the need for such a fix, but since the sending of orders (or rather dispatches) when the game is not running should never occur anyway, I wonder if we should not:

  • Prevent the client from doing so (which means that the client will have to know of the game's state)
  • Return an actual HTTP error code instead of a normal, player-related error message? (i.e. attacking when the game is over is not a violation of the game rules, it's a technical mistake)

@cveneziani
Copy link
Member Author

I also wondered about that and thought that since the game state is updated via a broadcast message, I consider it asynchronous. So even with a check on the client side, a player might be able to send an action. And if that happens, that would be nice to receive a nice message saying it's too late.
What do you think?

@r3trofitted
Copy link
Contributor

Good points. As a player, I don't know what would be worse: having my action silently ignored (because it was sent too late, though I didn't know it at the time), or having the game telling me that it is too slow to handle my action. Either way, I'd be disappointed.

However, this looks like an edge case to me: the game should respond pretty quickly when the game is over, so the probability for a given action to be sent in the time interval between the sending of the game-terminating action by the opponent and the reception of the game termination signal should be pretty low.

I suggested that we:

  • add a client-side check to prevent actions from being sent when the game is over (that's the main point, I think)
  • maintain the friendly message client-side, even though it should almost never be displayed anyway. However, even though it's more work, I still think that the server should respond with an error status and not a 200.

@cveneziani
Copy link
Member Author

I've pushed a check on the client-side.

For the backend side, shall we make the check on the controller side instead of relying on the model to check the validity of the action? I think it's nice to have the dispatcher that return the payload.

What do you think? How do you see this change?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants