Adding an option after game has been public

Game development with Board Game Arena Studio
Post Reply
User avatar
Mistergos
Posts: 79
Joined: 18 September 2011, 16:59

Adding an option after game has been public

Post by Mistergos »

Hi there

I would like to add an option to my game. My game is already public on BGA.
I know i can modify my gameoptions.inc.php but i guess it is gonna brake for already existing game if i call in my php :

Code: Select all

$this->getGameStateValue('mynewoption')
I did not find a way to initialize it in preexisting game.
How can i avoid to get an error while accessing my game state value in a game where it does not exist yet?
vincentt
Posts: 254
Joined: 01 September 2017, 17:25

Re: Adding an option after game has been public

Post by vincentt »

Hi,

Not an issue :)
If you call this function for an undefined game state value, it will return "0". So just manage this.

You need to take extra care if you add a new state or a new field in database.

Cheers

Vincent
User avatar
Mistergos
Posts: 79
Joined: 18 September 2011, 16:59

Re: Adding an option after game has been public

Post by Mistergos »

Unfortunately no. It throws an error :

Code: Select all

Server syntax error:
Notice: Undefined index: mynewoption in /var/tournoi/release/tournoi-200518-0953-gs/www/game/module/table/table.game.php on line 1004
{"status":"0","error":"Unknow gamestate label: mynewoption","expected":0,"code":100,"stack":"#0
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: Adding an option after game has been public

Post by RicardoRix »

Have you called the init function (self::setGameStateInitialValue), and added it to the list (initGameStateLabels)

You don't mean game option I presume, you mean gameStateValue
User avatar
Mistergos
Posts: 79
Joined: 18 September 2011, 16:59

Re: Adding an option after game has been public

Post by Mistergos »

My bad. I assumed the php constructor was not called in an existing game which is wrong.
So if you set the gameStateValue as usual, it will take the default value in preexisting game.
Post Reply

Return to “Developers”