Game options conditons problem

Game development with Board Game Arena Studio
Post Reply
tet2brick
Posts: 11
Joined: 06 May 2022, 11:04

Game options conditons problem

Post by tet2brick »

Hello everyone,

I've ran into a little problem, I work on a game with 3 game mode, cooperative, competitive and solo.
Cooperative and competitive are for 2-4 players
Solo is obviously for one player.

There's options for each mode (example a difficulty level for the solo mode) and these options needs to be displayed ONLY if the correct mode is selected.

So in gameoptions.inc.php I've put this :

Code: Select all

101 => array(
         'name' => totranslate('Game Mode'),
         'values' => array(
             0 => array(
                'name' => totranslate('Competitive (2-4 players)')
             ),

             // A simple value for this option.
             // If this value is chosen, the value of "tmdisplay" is displayed in the game lobby
             1 => array(
                 'name' => totranslate('Solo')
             ),
             2 => array(
                 'name' => totranslate('Coopérative (2-4 players')
             ),
         ),
         'startcondition' => array(
             0 => array(
             array(
                     'type' => 'minplayers',
                     'value' => 2,
                     'message' => totranslate('Competitive game mode is available for 2 players minimum.')
                 )),
             1 => array(
                 array(
                     'type' => 'maxplayers',
                     'value' => 1,
                     'message' => totranslate('Solo game mode is available for 1 player maximum.')
                 )
             ),
             2 => array(
             array(
                     'type' => 'minplayers',
                     'value' => 2,
                     'message' => totranslate('Cooperative game mode is available for 2 players minimum.')
                 )),
         ),
         'default' => 0,         
     ),
In the doc it's said that startcondition prevent the game from starting if the conditions are not true.

But with this if competitive or cooperative is selected I can't :
- Change the players number to one
- Choose solo mode in the drop down menu

So it's before game start.

But if I put instead displayconditions with minplayers or maxplayers it doesn't do anything, all is displayed all the time.

Can you help me ?

Thanks in advance,
User avatar
ufm
Posts: 1345
Joined: 06 January 2017, 08:38

Re: Game options conditons problem

Post by ufm »

That part of docs is outdated (there was a framework change regarding player spaces of the table).

Don't make 'solo' as a selectable option. Instead, check the player count in backend to distinguish solo/multiplayer.
Then, display solo options only with maxplayer 1 setting and hide multiplayer options in 1 player.

My code from Fruit Picking:

Code: Select all

$game_options = array(

    100 => array(
        'name' => totranslate('Board setup'),
        'values' => array(
            1 => array(
                'name' => totranslate( 'Mirror setup' ),
                'description' => totranslate( 'The starting player shuffles their 6 Farm Cards and randomly lays a card face up in each of the round spaces of their Fruit Island Board. The other players then lay their cards in exactly the same way, copying the order of the starting player.' ),
                'tmdisplay' => totranslate( 'Mirror setup' ),
            ),
            2 => array(
                'name' => totranslate( 'Random setup' ),
                'description' => totranslate( 'Instead of every player copying the same card configuration as the starting player, every player shuffles their Farm Cards and lays down the cards randomly on their Fruit Island Board.' ),
                'tmdisplay' => totranslate( 'Random setup' ),
            ),
        ),
        'displaycondition' => array(
            // Note: do not display this option unless these conditions are met
            array(
                'type' => 'minplayers',
                'value' => array (2, 3, 4),
            ),
        ),
    ),

    101 => array(
        'name' => totranslate('Children variant'),
        'values' => array(
            1 => array(
                'name' => totranslate( 'No' ),
                'description' => totranslate( 'Once a player completes any of the Market Card sets shown on the Market Island Board, complete the current round so that each player has played the same number of turns. Then, the game ends.' ),
            ),
            2 => array(
                'name' => totranslate( 'Yes' ),
                'description' => totranslate( 'Don’t use the Market Island Board. From the Market Card deck, reveal the first three cards to be used as the Market. The price for each Market Card will simply be the number of fruit depicted on it. The game ends when any player buys 5 Market Cards.' ),
                'tmdisplay' => totranslate( 'Children variant' ),
            ),
        ),
        'displaycondition' => array(
            // Note: do not display this option unless these conditions are met
            array(
                'type' => 'minplayers',
                'value' => array (2, 3, 4),
            ),
        ),
    ),

    102 => array(
        'name' => totranslate('Solo difficulty'),
        'values' => array(
            0 => array(
                'name' => totranslate( 'Banan-apprentice' ),
                'description' => totranslate( 'Do not remove any seed before starting the game.' ),
                'tmdisplay' => totranslate( 'Banan-apprentice' ),
            ),
            1 => array(
                'name' => totranslate( 'Pear to the Throne' ),
                'description' => totranslate( 'Remove 1 seed before starting the game.' ),
                'tmdisplay' => totranslate( 'Pear to the Throne' ),
            ),
            2 => array(
                'name' => totranslate( 'Queen Berry of Straw' ),
                'description' => totranslate( 'Remove 2 seeds before starting the game.' ),
                'tmdisplay' => totranslate( 'Queen Berry of Straw' ),
            ),
            3 => array(
                'name' => totranslate( 'Lord of the Plums' ),
                'description' => totranslate( 'Remove 3 seeds before starting the game.' ),
                'tmdisplay' => totranslate( 'Lord of the Plums' ),
            ),
            4 => array(
                'name' => totranslate( 'Alexander the Grape' ),
                'description' => totranslate( 'Remove 4 seeds before starting the game.' ),
                'tmdisplay' => totranslate( 'Alexander the Grape' ),
            ),
            5 => array(
                'name' => totranslate( 'Fruit Pickasaurus Rex' ),
                'description' => totranslate( 'Remove 5 seeds before starting the game.' ),
                'tmdisplay' => totranslate( 'Fruit Pickasaurus Rex' ),
            ),
        ),
        'displaycondition' => array(
            // Note: do not display this option unless these conditions are met
            array(
                'type' => 'maxplayers',
                'value' => 1
            ),
        ),
    ),


);
tet2brick
Posts: 11
Joined: 06 May 2022, 11:04

Re: Game options conditons problem

Post by tet2brick »

Hi,

Thank you it worked !

I did that before but I think I must have made a mistake somewhere because it was not working.

But now it is.

So thanks again :)
Post Reply

Return to “Developers”