Custom Players Turn Order

Game development with Board Game Arena Studio
Post Reply
User avatar
Victoria_La
Posts: 620
Joined: 28 December 2015, 20:55

Custom Players Turn Order

Post by Victoria_La »

In the game I develop turn order depends on the actions, not a natural turn order of the table.
Is there API to change turn order so activeNextPlayer() works properly or I have to create a custom table for that?

Thanks!
Wheeelos
Posts: 1
Joined: 15 February 2016, 23:12

Re: Custom Players Turn Order

Post by Wheeelos »

idem
User avatar
Andy_K
Posts: 51
Joined: 13 February 2014, 15:59

Re: Custom Players Turn Order

Post by Andy_K »

You can maintain your own turn order logic and use

Code: Select all

$this->gamestate->changeActivePlayer( $player_id )
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: Custom Players Turn Order

Post by pikiou »

Indeed. And to fully answer the question, this is the only way to implement a custom turn order.
User avatar
Peyo61
Posts: 8
Joined: 15 March 2014, 20:37

Re: Custom Players Turn Order

Post by Peyo61 »

Sorry to come late to the party, but I have the same issue and I'm new to developing here. So I need a little more help, and apologies in advance it those are obvious to all except me...

First:

concerning "$this->gamestate->changeActivePlayer( $player_id )", where should I code my "changeActivePlayer" method, simply in "mygame.game.php", inside my "mygame" class ? Then why not call "$this->changeActivePlayer()" (what is "gamestate" doing in there) ?

Then:

I need to randomize the first player at some key points in the game. Is there an API for this in the framework ? (since I assume the framework is doing the randomization for us at the start of the game, I thought maybe this service is available somewhere)

Thanks in advance,
Pierre
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: Custom Players Turn Order

Post by fafa-fr »

Hi,
Peyo61 wrote:where should I code my "changeActivePlayer" method?
You don't have to code this, it's already a Studio Framework method. See http://en.doc.boardgamearena.com/Main_g ... ve_players

(Regarding your second question, I don't know.)
User avatar
Victoria_La
Posts: 620
Joined: 28 December 2015, 20:55

Re: Custom Players Turn Order

Post by Victoria_La »

Peyo61 wrote: First:

concerning "$this->gamestate->changeActivePlayer( $player_id )", where should I code my "changeActivePlayer" method, simply in "mygame.game.php", inside my "mygame" class ? Then why not call "$this->changeActivePlayer()" (what is "gamestate" doing in there) ?
$this->gamestate is another object which defines the method changeActivePlayer. $this->changeActivePlayer() is not defined. You can define it if you
want and call $this->gamestate->changeActivePlayer( $player_id ) in it
Peyo61 wrote: Then:

I need to randomize the first player at some key points in the game. Is there an API for this in the framework ? (since I assume the framework is doing the randomization for us at the start of the game, I thought maybe this service is available somewhere)
Php has shuffle function for an array http://www.w3schools.com/php/func_array_shuffle.asp
Put all your players in the array, shuffle it, then get [0] element.
User avatar
Peyo61
Posts: 8
Joined: 15 March 2014, 20:37

Re: Custom Players Turn Order

Post by Peyo61 »

Thank you all !
Post Reply

Return to “Developers”