Page 1 of 1

JS error when movement and state changement

Posted: 03 October 2020, 10:10
by ExtraPaul
In my game Cacao, I get sometimes this Javascript error :

Code: Select all

Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause().
This occurs in a player who is awake (wake up) by the state's changement WHILE a movement is in progress on the board.
For exemple, gold pieces moving from a tile to a player area.

Movements are triggered by notifications and I can set waiting time with this.notifqueue.setSynchronous().
But these state changements (multipleactiveplayer and gameturn) are independant from client notifications.
So, I don't find how to delay the next player wake up.

On another side, this error has no impact on the game.
And take the hand to another player while last movements plays during 0,5s is not a problem.

Any idea about this issue ?
Thank's.

Re: JS error when movement and state changement

Posted: 03 October 2020, 13:22
by Tisaac
If you are locking when doing the ajax call and using synchronous notifs, it should work

Re: JS error when movement and state changement

Posted: 04 October 2020, 09:31
by ExtraPaul
Thank you Tisaac.

But all this.ajaxcall have the parameter "lock" to true.
And this is the sequence : I don't know how to correct it.
  1. cacao.js : A tile is placed on the board -> ajaxcall.
  2. cacao.game.php : notifyAllPlayers to show the movement of tile going to the board.
  3. cacao.js : animation while next point (4) in cacao.game.php...
  4. cacao.game.php : compute all actions possible around this tile.
    4a Some actions give gain without decision of players -> notifyAllPlayers to show gain movements.
    4b Some actions are for other players than the active player -> change state to multipleactiveplayer.
  5. cacao.js : consequence of points 4a + 4b -> notifications (gain movements) while wake up inactive player -> JS error in the browser of this player.