eliminatePlayer behaviour

Game development with Board Game Arena Studio
Post Reply
przemek88
Posts: 3
Joined: 07 May 2013, 15:01

eliminatePlayer behaviour

Post by przemek88 »

Hi, i am working on K2 (project name: tuyrg) and recently found problem with eliminating players who have both climbers dead (in which case they do nothing to the end of the game). I thought the eliminatePlayer function is a perfect choice, but once i eliminated any player, the game is cancelled. Is that specific to the studio environment? How can i eliminate player without finishing the game (even if there is a single player alive)?
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: eliminatePlayer behaviour

Post by sourisdudesert »

Hi,

The normal behaviour is that the game continue until the end, so please use the method as you planned to use it.

I'm going to check if there is a bug in the studio.

Cheers,
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: eliminatePlayer behaviour

Post by sourisdudesert »

Hi,

The explanation is simple: once a player is eliminated, the "zombie" code is applied to make him play. If this case (= game state) is not supported, the game automatically abandoned.

So you just have to write the "zombie" method and everything is going to be okay!
przemek88
Posts: 3
Joined: 07 May 2013, 15:01

Re: eliminatePlayer behaviour

Post by przemek88 »

Thanks for answer. I attached the message i see before automatic redirect at the end of the game. I filled zombiePass in states.php but the problem still occurs. My current zombieTurn function:

Code: Select all

    function zombieTurn( $state, $active_player )
    {
    	$statename = $state['name'];

        if ($state['type'] == "activeplayer") {
            switch ($statename) {
                default:
                    $this->gamestate->nextState( "zombiePass" );
                	break;
            }

            return;
        }

        if ($state['type'] == "multipleactiveplayer") {
            // Make sure player is in a non blocking status for role turn
            $sql = "
                UPDATE  player
                SET     player_is_multiactive = 0
                WHERE   player_id = $active_player
            ";
            self::DbQuery( $sql );

            $this->gamestate->updateMultiactiveOrNextState( '' );
            return;
        }

        throw new feException( "Zombie mode not supported at this game state: ".$statename );
    }
it has never complained about the unsupported state. Logs are silent either.
Attachments
A player left this game:
A player left this game:
BGA.jpg (152.51 KiB) Viewed 2065 times
przemek88
Posts: 3
Joined: 07 May 2013, 15:01

Re: eliminatePlayer behaviour

Post by przemek88 »

Just for the record: recently the problem stopped to happen (i have not touched the zombieCode since then) thus i assume something on the BGA side changed (logs were silent).

Anyway, i think it would be a good idea to make it more resilient (at least in the Studio env). Any exception in the zombiePass method cause to end the game which is irritating during development. I managed to work-around that inconvinience by putting the whole code inside try-catch and log the problem, but it's not fine on production.
Post Reply

Return to “Developers”