Activeplayer state skipped

Game development with Board Game Arena Studio
Post Reply
User avatar
DrKarotte
Posts: 279
Joined: 22 September 2015, 23:42

Activeplayer state skipped

Post by DrKarotte »

I have a problem with strange behaviour of activeplayer state.

The game goes over several rounds. In the first round everything is fine.
In the 2nd round (and following) the game goes into an activeplayer state which is ended (skipped) without letting the active player do anything.

In the log it is visible that the state is in fact entered and left. This behaviour is not expected regarding the BGA state machine and should by no means possible in the game - I have not added any code which could explain this.

I have checked that the player id of the active player directly before entering the state is valid.

The game then enters "next player", and activates the next player who can do something.

Any ideas what could cause this?
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: Activeplayer state skipped

Post by Victoria_La »

Make sure on php side you have no code after $this->gamestate->nextState(...) code.
Because if you do accidentally have code that goes to another state it will cause another state transition without user interaction (I had this problem before and spent hours debugging it).

Code: Select all

 function selectField($field) {
   self::checkAction ( 'selectField' );
   if ($field!=0) $this->gamestate->nextState ( 'next' );
   $this->gamestate->nextState ( 'last' ); // <-- here is missing else, so it will cause double state transition
 }
User avatar
DrKarotte
Posts: 279
Joined: 22 September 2015, 23:42

Re: Activeplayer state skipped

Post by DrKarotte »

Thanks Victoria :D

Your hint helped me figure it out; it was as suspected, but somewhat "hidden", so it was difficult to spot until knowing what kind of mistake to search for ;)

Now Christmas may come 8-)
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: Activeplayer state skipped

Post by Victoria_La »

I am glad you found it. If you stuck again consult this page: http://en.doc.boardgamearena.com/Troubleshooting
Post Reply

Return to “Developers”