Unexpected error: Propagating error from gameserver 1 (method: createGame): BGA service error (reference: GS1 25/11 18:1

Game development with Board Game Arena Studio
Post Reply
User avatar
Yu-wolf-or-Oru
Posts: 14
Joined: 15 July 2020, 12:27

Unexpected error: Propagating error from gameserver 1 (method: createGame): BGA service error (reference: GS1 25/11 18:1

Post by Yu-wolf-or-Oru »

Hi everyone,
Im new to BGA,programming,english... and I want to implement my own game.

Question↓
I get this error when I try to start the game.
"Unexpected error: Propagating error from gameserver 1 (method: createGame): BGA service error (reference: GS1 25/11 18:1"

I have looked at the following URL, but cannot figure out where the problem is.
https://boardgamearena.com/doc/Troubleshooting

Can someone please tell me what is wrong?

dbmodel.sql↴
CREATE TABLE IF NOT EXISTS `card` (
`card_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`card_type` int(11) NOT NULL,
`card_type_arg` int(11) NOT NULL,
`card_location` varchar(16) NOT NULL,
`card_location_arg` int(11) NOT NULL,
PRIMARY KEY (`card_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `token` (
`token_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`token_type` int(11) NOT NULL,
`token_location` varchar(16) NOT NULL,
`token_location_arg` int(11) NOT NULL,
PRIMARY KEY (`token_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

game.php↴
protected function setupNewGame( $players, $options = array() )
{
$sql = "DELETE FROM player WHERE 1 ";
self::DbQuery( $sql );
// Set the colors of the players with HTML color code
// The default below is red/green/blue/orange/brown
// The number of colors defined here must correspond to the maximum number of players allowed for the gams
$gameinfos = $this->getGameinfos();
$default_colors = $gameinfos['player_colors'];

// Create players
// Note: if you added some extra field on "player" table in the database (dbmodel.sql), you can initialize it there.
$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,',');
self::DbQuery( $sql );

if ($gameinfos['favorite_colors_support'])
$this->reattributeColorsBasedOnPreferences($players, $gameinfos['player_colors']);
self::reloadPlayersBasicInfos();


/************ Start the game initialization *****/

// Init global values with their initial values
self::setGameStateInitialValue( 'roundCount', 0 );
// Set current trick color 0(=no trick color)
self::setGameStateInitialValue( 'trickColor', 0 );
// Set current dominantSuit 1=red,2=blue,3=green
self::setGameStateInitialValue( 'dominantSuit', 0 );
// Set current highestValue
self::setGameStateInitialValue( 'highestValue', null );
// Set current highestValueSuit
self::setGameStateInitialValue( 'highestValueSuit', null );
// Set current highestValueHolder
self::setGameStateInitialValue( 'highestValueHolder', null );
// Set current sameValueCount
self::setGameStateInitialValue( 'sameValueCount', null );
// Set current imitationCardTo
self::setGameStateInitialValue( 'imitationCardTo', null );
// Init game statistics
// (note: statistics used in this file must be defined in your stats.inc.php file)
self::initStat( "table", "round_Nbr", 0 );
self::initStat( "player", "getfire", 0 );
self::initStat( "player", "getwater", 0 );
self::initStat( "player", "getwood", 0 );
//create tokens
$sql = "DELETE FROM token WHERE 1 ";
self::DbQuery( $sql );
$sql = "INSERT INTO token (token_id, token_type, token_location, token_location_arg) VALUES ";
$values = array();
for($token_id=0;$token_id<=17;$token_id++){
if($token_id<=5){
$token_type = 1;
//1:red,2:blue,3:green
}
else if($token_id>5 && $token_id<=11){
$token_type = 2;
}
else{$token_type = 3;
}
$token_location = 'tokensontable';
$token_location_arg = 0;
$values[]= "('".$token_id."','".$token_type."',$token_location,'".$token_location_arg."')";
};
$sql .= implode($values,',');
self::DbQuery( $sql );


//create cards
$cards = array();
foreach( $this->card_attribute as $attribute_id => $attribute ) // fire,water,wood,imitation
{
if($attribute_id !== 4){
for( $value=2; $value<=7; $value++ ) // 2, 3, 4, ... 7
{
$cards[] = array( 'type' => $attribute_id, 'type_arg' => $value, 'nbr' => 1);
}
}
else{
$cards[] = array('type' => $attribute_id, 'type_arg' => 0, 'nbr' => 1);
}
}
$this->cards->createCards( $cards, 'deck' );
}

Sorry for any inconvenience this newbie may cause you.
Greetings
User avatar
Shazzypaz
Posts: 89
Joined: 27 December 2020, 15:22

Re: Unexpected error: Propagating error from gameserver 1 (method: createGame): BGA service error (reference: GS1 25/11

Post by Shazzypaz »

Best way to track it down is to comment out parts of the dbmodel.sql and the game.php file until the problem is no longer occurring, and then start adding things back in. It's a sql or php syntax error.

It's best to keep your source code in a personal git repository, so that if your game suddenly starts to fail, you can easily determine what you changed and rollback if needed.
User avatar
SwHawk
Posts: 133
Joined: 23 August 2015, 16:45

Re: Unexpected error: Propagating error from gameserver 1 (method: createGame): BGA service error (reference: GS1 25/11

Post by SwHawk »

Yu-wolf-or-Oru wrote: 25 November 2022, 18:28 dbmodel.sql↴
CREATE TABLE IF NOT EXISTS `token` (
`token_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`token_type` int(11) NOT NULL,
`token_location` varchar(16) NOT NULL,
`token_location_arg` int(11) NOT NULL,
PRIMARY KEY (`token_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
Looks like you're trying to copy the Deck base table here, but we haven't seen the init statements that are supposed to go into the game constructor ? Are they there ? Also, the token table lacks the token_type_arg column which you would need to add to manage it with the Deck component.

Also, you can use one table for both your tokens and cards as long as you keep some column/value to discriminate between the two... For instance, your cards could have type_args between 1 and 9 and then your tokens between 10 and 19...
User avatar
Jonathan2004
Posts: 23
Joined: 21 April 2020, 19:06

Re: Unexpected error: Propagating error from gameserver 1 (method: createGame): BGA service error (reference: GS1 25/11

Post by Jonathan2004 »

Yu-wolf-or-Oru wrote: 25 November 2022, 18:28
/************ Start the game initialization *****/

// Init global values with their initial values
self::setGameStateInitialValue( 'roundCount', 0 );
// Set current trick color 0(=no trick color)
self::setGameStateInitialValue( 'trickColor', 0 );
// Set current dominantSuit 1=red,2=blue,3=green
self::setGameStateInitialValue( 'dominantSuit', 0 );
// Set current highestValue
self::setGameStateInitialValue( 'highestValue', null );
// Set current highestValueSuit
self::setGameStateInitialValue( 'highestValueSuit', null );
// Set current highestValueHolder
self::setGameStateInitialValue( 'highestValueHolder', null );
// Set current sameValueCount
self::setGameStateInitialValue( 'sameValueCount', null );
// Set current imitationCardTo
self::setGameStateInitialValue( 'imitationCardTo', null );
Hello, I am a newbie too.
I see a lot of global variables here, did you define all of these in game.php > __construct ? (I already had this problem ...)
User avatar
Yu-wolf-or-Oru
Posts: 14
Joined: 15 July 2020, 12:27

Re: Unexpected error: Propagating error from gameserver 1 (method: createGame): BGA service error (reference: GS1 25/11

Post by Yu-wolf-or-Oru »

Shazzypaz wrote: 25 November 2022, 20:41 Best way to track it down is to comment out parts of the dbmodel.sql and the game.php file until the problem is no longer occurring, and then start adding things back in. It's a sql or php syntax error.

It's best to keep your source code in a personal git repository, so that if your game suddenly starts to fail, you can easily determine what you changed and rollback if needed.
Dear Shazzypaz
Thanks for sharing a good way to verify. I will try it.
User avatar
Yu-wolf-or-Oru
Posts: 14
Joined: 15 July 2020, 12:27

Re: Unexpected error: Propagating error from gameserver 1 (method: createGame): BGA service error (reference: GS1 25/11

Post by Yu-wolf-or-Oru »

Jonathan2004 wrote: 26 November 2022, 16:04 Hello, I am a newbie too.
I see a lot of global variables here, did you define all of these in game.php > __construct ? (I already had this problem ...)
Dear Jonathan2004

Thank you for your reply.
I have defined all the global variables, but looking at the other replies, it seems that I am using dbmodel incorrectly.
It is very nice to hear back from a fellow beginner.
Good luck to both of us.
User avatar
Yu-wolf-or-Oru
Posts: 14
Joined: 15 July 2020, 12:27

Re: Unexpected error: Propagating error from gameserver 1 (method: createGame): BGA service error (reference: GS1 25/11

Post by Yu-wolf-or-Oru »

SwHawk wrote: 26 November 2022, 00:05
Looks like you're trying to copy the Deck base table here, but we haven't seen the init statements that are supposed to go into the game constructor ? Are they there ? Also, the token table lacks the token_type_arg column which you would need to add to manage it with the Deck component.

Also, you can use one table for both your tokens and cards as long as you keep some column/value to discriminate between the two... For instance, your cards could have type_args between 1 and 9 and then your tokens between 10 and 19...
Dear SwHawk
I was thinking of using the database without the Deck component.
However, since my current ability is such that I don't know how to write an init statement to be included it in the game constructor to perform the above method, I thought it would be more practical to handle it with the Deck component as you advised.
Your advice was very helpful. Thank you so much.
Post Reply

Return to “Developers”