PB solved involves a question:

Game development with Board Game Arena Studio
Post Reply
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

PB solved involves a question:

Post by Rudolf »

Hello,
well I just solved a pb that was concerning several things: slide, step and getactiveplayerid...
the way I was coding was not in the right spirit, because I needed not existing thing...
In a sequence, I had a first step selecting a choice of 4 ways game states, with different behaviour. these 4 ways began with an init game step and goes to a step of active player,
First idea was to include code on EnteringState, but after coding, I realise that in js, I cannot get ActivePlayer (because functions return null) in a game state....
So I change solution and goes to php to include a notify that transfers playerid from php (because php can get this activeplayer even in game state), and it solved my pb.

But... at final, I've added more functions (notify, subscribe, ...) only to replace a simple call... why could it be not possible to get activeplayerid when we're in a game state (in javascript file)?
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: PB solved involves a question:

Post by pikiou »

Because activeplayerid is subject to change in a game state and if you could change it, it'd lead to difficult bugs to fix.

Couldn't you use this.getActivePlayerId() at the end of the previous active state or at the beginning of the next active state?
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: PB solved involves a question:

Post by Rudolf »

Hum... pb with case of refresh F5 in this case ;), but I use notify... and it's running... it was just in case. ;)
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: PB solved involves a question:

Post by sourisdudesert »

Hello,

it seems that you try to twist the framework by doing this...

You are not supposed to get active player id on a game state, it has no meaning. If you do it, there's a risk that some future change in the framework will break your game.

You should do as suggested by Pikiou. There is no refresh problem because your game should never stays in a "game" type game state.

Cheers,
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: PB solved involves a question:

Post by Rudolf »

But 'before' and 'after' it's a player state... by the way... I used notify and it runs with that.
Post Reply

Return to “Developers”