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
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