Page 1 of 1
Any recent change in the undoRestorePoint ?
Posted: 17 November 2021, 17:04
by lordalx
Hi. On a game using the Undo Moves features (see
https://en.doc.boardgamearena.com/Main_ ... Undo_moves), since the 16/Nov/2021, this features relying on the framework appears as broken... hundreds of similar failures recorded in the game log
As per the wiki, it shall be used like this :
Code: Select all
function actionUndo() {
self::checkAction('actionUndo');
$this->undoRestorePoint();
$this->gamestate->nextState('next'); // transition to single player state (i.e. beginning of player actions for this turn)
}
The $this->gamestate->nextState('next') now leads to an unexpected gamestate transition as if the undoRestorePoint() already updates the current state and that calling explicitely a new transition is not only useless, but raises some unexpected failures.
Could there have been an update in the framework deployed in production very recently that could explain such new behavior ?
Re: Any recent change in the undoRestorePoint ?
Posted: 17 November 2021, 17:10
by Ilmion
I second this observation and it may not be trivial for some game to adjust to that.
Re: Any recent change in the undoRestorePoint ?
Posted: 17 November 2021, 17:15
by bennygui
Saw the same thing in the logs of Gold West. And in my case I do something like this so removing the need for "nextState" breaks the whole thing:
Code: Select all
...
$this->undoRestorePoint();
$nextState = ...
switch ($nextState) {
case STATE_CHOOSE_SUPPLY_TRACK_TO_ACTIVATE_ID:
$this->gamestate->nextState("restartTurn");
break;
case STATE_HAS_METAL_TO_USE_AND_PLACE_TO_USE_ID:
$this->gamestate->nextState("restartTurnHasMetalToUse");
break;
...
Re: Any recent change in the undoRestorePoint ?
Posted: 17 November 2021, 17:16
by Een
There has indeed been a change, following this report
https://studio.boardgamearena.com/bug?id=62
The following is now called after each undo to make sure that there are no obsolete cache values.
$this->gamestate->reloadState();
From your code snippet it looks like your game relied on the cache not being properly refreshed to transition to a new valid state. So fixing the bug did indeed break it... Sorry about that.
Re: Any recent change in the undoRestorePoint ?
Posted: 17 November 2021, 17:18
by lordalx
Thanks for the fast reply. Other games are involved as well.
Would you recommend each game to be updated accordingly (and so to change the code snipplet from the wiki as well), or is there a way to provide some upward compability with existing games ?
EDIT: When I mean "update the game", it seems that removing the call to nextState() quickly resolved the issue
Re: Any recent change in the undoRestorePoint ?
Posted: 17 November 2021, 17:21
by Een
lordalx wrote: ↑17 November 2021, 17:18
Thanks for the fast reply. Other games are involved as well.
Would you recommand each game to be updated accordingly (and so to change the code snipplet from the wiki as well), or is there a way to provide some upward compability with existing games ?
I think I'll revert this change, and just document using $this->gamestate->reloadState();
Even if ideally this would have been baked in to avoid managing things by hand, as it wasn't it looks better than forcing a lot of games to change...
Re: Any recent change in the undoRestorePoint ?
Posted: 17 November 2021, 17:32
by Een
I have reverted the change on all gameservers. Undo should now work as before.
Edit: the documentation has been updated to explain how to use reloadState() if needed.
https://en.doc.boardgamearena.com/Main_ ... Undo_moves