sociallyassistiverobotics / sar_game_command_msgs

MIT License
0 stars 2 forks source link

Add WAIT_FOR_RESPOND and SKIP_RESPONSE commands #5

Closed jakory closed 8 years ago

jakory commented 8 years ago

Depends on #4 for README formatting. If #4 gets merged first, this request will only be adding the new commands described below, plus corresponding documentation in the README.

This pull request adds two new GameCommand commands: WAIT_FOR_RESPONSE and SKIP_RESPONSE.

After a game sends a GameState.USER_TIMEOUT message to indicate that it timed out waiting for a user to response, it pauses and waits for a GameCommand message to tell it what to do next. It should be either a GameCommand.WAIT_FOR_RESPONSE message to indicate that it should try waiting for a response again, or a GameCommand.SKIP_RESPONSE message to indicate that it should skip waiting for the user response.

The main reason for adding the GameCommand.SKIP_RESPONSE message is to allow game to easily take different actions after receiving GameCommand.SKIP_RESPONSE versus GameCommand.CONTINUE messages. For example, if the game had been waiting for a user response, it may want to take some additional action before resuming normal game play to reflect the fact that it didn't get the expected response, while if the game had merely been paused and told to continue, it would simply pick up where it had left off.

(An alternate option would be to not have the GameCommand.SKIP_RESPONSE message. In this case, games would receive a GameCommand.CONTINUE message after any kind of event requiring the game to pause or wait. So a game would need to internally track whether it had received a GameCommand.PAUSE message prior to the CONTINUE or whether they had recently sent a GameState.USER_TIMEOUT message to know what actions to take. That seems messier to me, thus the proposed GameCommand.SKIP_RESPONSE.)