Page 1 of 1
Custom Players Turn Order
Posted: 19 May 2016, 00:09
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!
Re: Custom Players Turn Order
Posted: 20 May 2016, 11:04
by Wheeelos
idem
Re: Custom Players Turn Order
Posted: 20 May 2016, 19:46
by Andy_K
You can maintain your own turn order logic and use
Code: Select all
$this->gamestate->changeActivePlayer( $player_id )
Re: Custom Players Turn Order
Posted: 21 May 2016, 00:13
by pikiou
Indeed. And to fully answer the question, this is the only way to implement a custom turn order.
Re: Custom Players Turn Order
Posted: 03 July 2016, 17:19
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
Re: Custom Players Turn Order
Posted: 04 July 2016, 12:40
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.)
Re: Custom Players Turn Order
Posted: 04 July 2016, 14:26
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.
Re: Custom Players Turn Order
Posted: 06 July 2016, 00:46
by Peyo61
Thank you all !