Error deploying

Game development with Board Game Arena Studio
Post Reply
User avatar
GoDodyGo
Posts: 42
Joined: 14 August 2020, 07:30

Error deploying

Post by GoDodyGo »

Can someone explain how I can overcome this deployment error? What am I supposed to fix? I cannot decipher the error. I have deployed before but it's been several months. I noticed since the last time I deployed, the way gameoptions is held has changed (now in JSON file). Also some fields are no longer valid in gameinfos.inc.php. I thought I removed all offending fields but it still will not deploy. What do I do?
Reloading game options for game liverpoolrummy
Sorry, an unexpected error has occurred...

Wrong formatted data from BGA gameserver 1 (method: getStudioGameInfos):
Fatal error: Uncaught TypeError: GameMetadata::getRawGamePreferences(): Return value must be of type array, null returned in /var/tournoi/release/tournoi-241023-1437-gs/www/game/module/mainsite/gamemetadata.game.php:848 Stack trace: #0 /var/tournoi/release/tournoi-241023-1437-gs/www/game/module/mainsite/gamemetadata.game.php(702): GameMetadata->getRawGamePreferences('...') #1 /var/tournoi/release/tournoi-241023-1437-gs/www/game/module/table/table.game.php(727): GameMetadata->getGamePreferences('...') #2 /var/tournoi/release/tournoi-241023-1437-gs/www/game/module/gameserver/gameserver.game.php(779): Table::getTablePreferencesForGame('...') #3 /var/tournoi/release/tournoi-241023-1437-gs/www/action/gameserver/gameserver.action.php(60): Gameserver->getStudioGameInfos(Array) #4 /var/tournoi/release/tournoi-241023-1437-gs/www/action/gameserver/gameserver.action.php(104): action_gameserver->callClusterJob('...') #5 /var/tournoi/release/tournoi-241023-1437-gs/www/include/APP_Action.inc.php(494): action_gameserver->getStudioGameInfos() #6 /var/tournoi/release/tournoi-241023-1437-gs/www/include/webActionCore.inc.php(198): APP_Action->performServerAction('...') #7 /var/tournoi/release/tournoi-241023-1437-gs/www/index.php(356): launchWebAction('...', '...', '...', true, false, NULL, true, false) #8 {main} thrown in /var/tournoi/release/tournoi-241023-1437-gs/www/game/module/mainsite/gamemetadata.game.php on line 848
(reference: GS0 05/11 08:12:51)

My gameoptions.jason is this:

Code: Select all

{
	"100": { "name": "Number of decks",
			 "values": {
				 "2": { "name": "2 decks" },
				 "3": { "name": "3 decks" },
				 "4": { "name": "4 decks" },
				 "5": { "name": "5 decks" }
			 },
			 "default": 2
	},
	"102": { "name": "Game Length (Set and Run targets needed for each hand)",
			 "values": {
				"1" : { "name": "1 hand (2 Sets)" },
				"2" : { "name": "1 hand (1 Set & 1 Run)" },
				"3" : { "name": "1 hand (2 Runs)" },
				"4" : { "name": "1 hand (3 Sets)" },
				"5" : { "name": "1 hand (2 Sets & 1 Run)" },
				"6" : { "name": "1 hand (1 Set & 2 Runs)" },
				"7" : { "name": "1 hand (3 Runs)" },
				"8" : { "name": "2 hand game (2Sets, 2Runs)" },
				"9" : { "name": "3 hand game (2Sets, 1Set2Runs, 3Runs)" },
				"10": { "name": "Short game (2Sets, 2Runs, 2Sets1Run, 3Runs)" },
				"11": { "name": "Full game (2Sets, 1Set1Run, 2Runs, 3Sets, 2Sets1Run, 2Run1Set, 3Runs)" },
				"12": { "name": "May I variant (2S, 1S1R, 2R, 3S, 2S1R, 2R1S, 3R & deal contract + 1)" }
			 },
			 "default": 9
	},
	"103": { "name": "Liverpool consequence",
			 "values": {
				 "0": { "name": "Bonus to caller" },
				 "1": { "name": "Penalty to discarder" }
			 },
			 "default": 0
	},
	"104": { "name": "Maximum number of Jokers (normally 2x per deck)",
			 "values": {
				"0"  : { "name": "0 no jokers" },
				"1"  : { "name": "1 joker"  },
				"2"  : { "name": "2 jokers" },
				"3"  : { "name": "3 jokers" },
				"4"  : { "name": "4 jokers" },
				"5"  : { "name": "5 jokers" },
				"6"  : { "name": "6 jokers" },
				"7"  : { "name": "7 jokers" },
				"8"  : { "name": "8 jokers" },
				"9"  : { "name": "9 jokers" },
				"10" : { "name": "All (2x number of decks)" }
			 },
			"default": 10
	},
	"105": { "name": "Number of buys",
			 "values": {
				 "0": { "name": "3 per hand" },
				 "1": { "name": "Unlimited" }
			 },
			 "default": 0
	},
	"106": { "name": "Always deal 11 cards",
			 "values": {
				 "0": { "name": "No" },
				 "1": { "name": "Yes" }
			 },
			 "default": 0
	},
	"108": { "name": "Enable wish list",
			 "values": {
				 "0": { "name": "No" },
				 "1": { "name": "Yes" }
			 },
			 "default": 0
	},
	"109": { "name": "Allow joker swapping",
			 "values": {
				 "0": { "name": "No" },
				 "1": { "name": "Yes" }
			 },
			 "default": 1
	}
}

My gameinfos.inc.php is this:

Code: Select all

<?php

/*
    From this file, you can edit the various meta-information of your game.

    Once you modified the file, don't forget to click on "Reload game informations" from the Control Panel in order in can be taken into account.

    See documentation about this file here:
    http://en.doc.boardgamearena.com/Game_meta-information:_gameinfos.inc.php

*/

$gameinfos = array(

// Name of the game in English (will serve as the basis for translation) 
'game_name' => "Liverpool (Cozy Oaks) Rummy",

// Game publisher (use empty string if there is no publisher)
'publisher' => 'Sevron L Publishing',

// Url of game publisher website
'publisher_website' => 'http://www.sevronlpublishing.com/',   

// Board Game Geek ID of the publisher
'publisher_bgg_id' => 171,

// Board game geek ID of the game
'bgg_id' => 15878,

// Players configuration that can be played (ex: 2 to 4 players)
'players' => array( 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 ),    

// Suggest players to play with this number of players. Must be null if there is no such advice, or if there is only one possible player configuration.
'suggest_player_number' => 4,

// Discourage players to play with these numbers of players. Must be null if there is no such advice.
'not_recommend_player_number' => null,
// 'not_recommend_player_number' => array( 2, 3 ),      // <= example: this is not recommended to play this game with 2 or 3 players

// Estimated game duration, in minutes (used only for the launch, afterward the real duration is computed)
'estimated_duration' => 75,           

// Time in second add to a player when "giveExtraTime" is called (speed profile = fast)
'fast_additional_time' => 90,           

// Time in second add to a player when "giveExtraTime" is called (speed profile = medium)
'medium_additional_time' => 120,           

// Time in second add to a player when "giveExtraTime" is called (speed profile = slow)
'slow_additional_time' => 300,           

// If you are using a tie breaker in your game (using "player_score_aux"), you must describe here
// the formula used to compute "player_score_aux". This description will be used as a tooltip to explain
// the tie breaker to the players.
// Note: if you are NOT using any tie breaker, leave the empty string.
//
// Example: 'tie_breaker_description' => totranslate( "Number of remaining cards in hand" ),
'tie_breaker_description' => "",

// If in the game, all losers are equal (no score to rank them or explicit in the rules that losers are not ranked between them), set this to true 
// The game end result will display "Winner" for the 1st player and "Loser" for all other players
'losers_not_ranked' => false,

// Game is "beta". A game MUST set is_beta=1 when published on BGA for the first time, and must remains like this until all bugs are fixed.
'is_beta' => 0,

// Is this game cooperative (all players wins together or lose together)
'is_coop' => 0, 

// Colors attributed to players
'player_colors' => array( "ff0000", "008000", "0000ff", "ffa500", "773300", "00a500", "ff8033", "7780ff","330077", "00ff77", "807700", "33ff77", "8000ff", "80ff00", "80a533", "a5a533" ),

// Favorite colors support : if set to "true", support attribution of favorite colors based on player's preferences (see reattributeColorsBasedOnPreferences PHP method)
'favorite_colors_support' => true,

// When doing a rematch, the player order is swapped using a "rotation" so the starting player is not the same
// If you want to disable this, set this to true
'disable_player_order_swap_on_rematch' => false,

// Game interface width range (pixels)
// Note: game interface = space on the left side, without the column on the right
'game_interface_width' => array(

    // Minimum width
    //  default: 740
    //  maximum possible value: 740 (ie: your game interface should fit with a 740px width (correspond to a 1024px screen)
    //  minimum possible value: 320 (the lowest value you specify, the better the display is on mobile)
    'min' => 740,

    // Maximum width
    //  default: null (ie: no limit, the game interface is as big as the player's screen allows it).
    //  maximum possible value: unlimited
    //  minimum possible value: 740
    'max' => null
),

//////// BGA SANDBOX ONLY PARAMETERS (DO NOT MODIFY)

// simple : A plays, B plays, C plays, A plays, B plays, ...
// circuit : A plays and choose the next player C, C plays and choose the next player D, ...
// complex : A+B+C plays and says that the next player is A+B
'is_sandbox' => false,
'turnControl' => 'simple'

////////
);
User avatar
thoun
Posts: 1618
Joined: 10 December 2020, 22:25

Re: Error deploying

Post by thoun »

Can you try with gamepreferences.json file containing {} instead of being empty?
User avatar
GoDodyGo
Posts: 42
Joined: 14 August 2020, 07:30

Re: Error deploying

Post by GoDodyGo »

I changed gamepreferences.json file to contain {} instead of being empty and the error disappeared!

Later today I will try to fully deploy it but you got me through this issue, thanks!
User avatar
tabicat
Posts: 47
Joined: 01 December 2016, 23:17
Location: Austin, TX

Re: Error deploying

Post by tabicat »

I had to put my project on pause for the past several months, but I'm getting back to it now. I'm experiencing this same bug.

Unfortunately, I also know very little about writing web apps in general, so a lot of my progress is just trial-and-error.

Is there a wiki page or something that outlines the changes? I have neither a gameoptions.json nor a gamepreferences.json file. Where did these come from? Where do they belong?

Unexpected error: Wrong formatted data from gameserver 1 (method: createGame): JSON_ERROR_SYNTAX <br />
<b>Fatal error</b>: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /var/tournoi/release/games/canterbury/999999-9999/canterbury.game.php:76
Stack trace:
#0 /var/tournoi/release/games/canterbury/999999-9999/canterbury.game.php(76): implode(Array, '...')

Here are lines 69-76:

Code: Select all

       $sql = "INSERT INTO player (player_id, player_color, player_canal, player_name, player_avatar) VALUES ";
        $values = array();
        foreach( $players as $player_id => $player )
        {
            $color = array_shift( $default_colors );
            $values[] = "('".$player_id."','$color','".$player['player_canal']."','".addslashes( $player['player_name'] )."','".addslashes( $player['player_avatar'] )."')";
        }
        $sql .= implode( $values, ',' );
canterbury.game.php is just a renamed version of the Reverse sample code.
User avatar
thoun
Posts: 1618
Joined: 10 December 2020, 22:25

Re: Error deploying

Post by thoun »

invert the implode parameters, it's linked to the PHP8 upgrade ;)

You can also get read only access to Reversi cproject to look at the updated code ;)
Post Reply

Return to “Developers”