This is a documentation for Board Game Arena: play board games online !

Game options and preferences: gameoptions.inc.php

Eus Board Game Arena
Mont d’ar merdeerezh Mont d’ar c’hlask

In this file, you can define your game options (= game variants) and user preferences.

Note: If your game has no variants or preferences, you don't have to modify this file.

Game Options

Game options is something selected by table creator and usually correspond to game variation, for example if game includes expansion or certain special rule.

$game_options = array (
        
        100 => array (
                'name' => totranslate ( 'my game option' ),
                'values' => array (
                        
                        // A simple value for this option:
                        1 => array (
                                'name' => totranslate ( 'option 1' ) 
                        ),
                        
                        // A simple value for this option.
                        // If this value is chosen, the value of "tmdisplay" is displayed in the game lobby
                        2 => array (
                                'name' => totranslate ( 'option 2' ),
                                'tmdisplay' => totranslate ( 'option 2' ) 
                        ),
                        
                        // Another value, with other options:
                        //  beta=true => this option is in beta version right now.
                        //  nobeginner=true  =>  this option is not recommended for beginners
                        3 => array (
                                'name' => totranslate ( 'option 3' ),
                                'beta' => true,
                                'nobeginner' => true 
                        ) 
                ) 
        ) 
);

Note²: All options defined in this file should have a corresponding "game state labels" with the same ID (see "initGameStateLabels" in yourgame.game.php)


            self::initGameStateLabels ( array (
                       ...
                       "my_first_game_variant" => 100,
             ) );


IMPORTANT: After you edited and deployed this file you have to go to control panel and press "Reload game options configuration"

User Preferences

User preferences is something cosmetic about the game interface which however can create user wars, so you can satisfy all user by giving them individual preferences. Do not use this unless absolutely necessary and usually only after game has been in production for a while. If you add these currently only admins can apply these settings, so you would have to contact them after editing this file.

$game_preferences = array(
    100 => array(
			'name' => totranslate('Notation style'),
			'needReload' => true, // after user changes this preference game interface would auto-reload
			'values' => array(
					1 => array( 'name' => totranslate( 'Classic' ), 'cssPref' => 'notation_classic' ),
					2 => array( 'name' => totranslate( 'Tournament' ), 'cssPref' => 'notation_tournament' )
			)
	)
);

There is two ways to check/apply this. In java Script

 if (this.prefs[100].value == 2) ...

This checks if preferences 100 has selected value 2.

Second, if cssPref specified it will be applied to the body tag. So you can use different css styling for the preference.

As user you have to select them from the Gear menu when game is started. On studio only user0 will have it actually working (bug?).