JS error when movement and state changement

Game development with Board Game Arena Studio
Post Reply
User avatar
ExtraPaul
Posts: 10
Joined: 08 May 2020, 17:19

JS error when movement and state changement

Post 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.
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: JS error when movement and state changement

Post by Tisaac »

If you are locking when doing the ajax call and using synchronous notifs, it should work
User avatar
ExtraPaul
Posts: 10
Joined: 08 May 2020, 17:19

Re: JS error when movement and state changement

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

Return to “Developers”