Any recent change in the undoRestorePoint ?

Game development with Board Game Arena Studio
Post Reply
User avatar
lordalx
Posts: 205
Joined: 03 March 2015, 21:15

Any recent change in the undoRestorePoint ?

Post 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 ?
User avatar
Ilmion
Posts: 30
Joined: 28 March 2020, 03:26

Re: Any recent change in the undoRestorePoint ?

Post by Ilmion »

I second this observation and it may not be trivial for some game to adjust to that.
User avatar
bennygui
Posts: 74
Joined: 03 April 2020, 20:08

Re: Any recent change in the undoRestorePoint ?

Post 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;
...
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: Any recent change in the undoRestorePoint ?

Post 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.
User avatar
lordalx
Posts: 205
Joined: 03 March 2015, 21:15

Re: Any recent change in the undoRestorePoint ?

Post 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
Last edited by lordalx on 17 November 2021, 17:24, edited 2 times in total.
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: Any recent change in the undoRestorePoint ?

Post 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...
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: Any recent change in the undoRestorePoint ?

Post 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
Post Reply

Return to “Developers”