回合制比赛 - 处理中断的回合
Turn-Based Match - Handling interrupted turn in progress
玩家 A 正在轮流,并且有 3 次尝试猜测数字 1 - 5(假设是 4),其中隐藏数字是比赛数据的一部分。
玩家 A 猜了 3 个,游戏更新让他们知道他们的猜测是错误的,他们还剩下 2 个。 (这目前在本地处理,因为调用 takeTurn() 来处理服务器端的猜测会过早地结束玩家 A 的回合)。
玩家 A 然后关闭游戏并重新打开它以查看原始状态的回合,还剩下 3 次猜测。但是,玩家 A 现在可以利用之前获得的知识作弊。
有什么更好的方法来处理这个问题?理想情况下,是否有一种方法可以处理正在进行的玩家输入,例如将每次猜测作为比赛数据的一部分?
这是官方 Android Games 对这些场景的建议:
Your game should try to save game data for a partially-finished turn
whenever a player's turn is interrupted and the player has to
temporarily leave the game (for example, because of an incoming phone
call). To do this, override your activity's
onStop()
method to call
TurnBasedMultiplayerClient.takeTurn(). Make
sure to specify the current player as the pending participant by using
the same participant ID as in the last call to
TurnBasedMultiplayerClient.takeTurn(). If
successful, the call stores the game data in Google’s servers but does
not generate a new turn notification.
玩家 A 正在轮流,并且有 3 次尝试猜测数字 1 - 5(假设是 4),其中隐藏数字是比赛数据的一部分。
玩家 A 猜了 3 个,游戏更新让他们知道他们的猜测是错误的,他们还剩下 2 个。 (这目前在本地处理,因为调用 takeTurn() 来处理服务器端的猜测会过早地结束玩家 A 的回合)。
玩家 A 然后关闭游戏并重新打开它以查看原始状态的回合,还剩下 3 次猜测。但是,玩家 A 现在可以利用之前获得的知识作弊。
有什么更好的方法来处理这个问题?理想情况下,是否有一种方法可以处理正在进行的玩家输入,例如将每次猜测作为比赛数据的一部分?
这是官方 Android Games 对这些场景的建议:
Your game should try to save game data for a partially-finished turn whenever a player's turn is interrupted and the player has to temporarily leave the game (for example, because of an incoming phone call). To do this, override your activity's onStop() method to call TurnBasedMultiplayerClient.takeTurn(). Make sure to specify the current player as the pending participant by using the same participant ID as in the last call to TurnBasedMultiplayerClient.takeTurn(). If successful, the call stores the game data in Google’s servers but does not generate a new turn notification.