Page 1 of 1

Playing the global jingle sound even when player is still active

Posted: 16 July 2020, 10:22
by MikeIsHere
So in Cribbage I have this piece of code where nextPlayer can call nextPlayer again if your opponent can't play a card

States:

Code: Select all

30 => array(
        "name" => "nextPlayer",
        "description" => "",
        "type" => "game",
        "action" => "stNextPlayer",        
        "transitions" => array("playerTurn"=> 20, "nextPlayer"=> 30, "go"=>33, "ClearBoard"=> 35, "endGame" => 90)
game.php NextPlayer

Code: Select all

function stNextPlayer() {
	$player_id = self::activeNextPlayer();
	
	// if you can play you must play simple 
	if (self::playPossible($player_id)) {        
		self::giveExtraTime( $player_id );
		$this->gamestate->nextState('playerTurn');
		return;
	}

	// Else -- Why can't we play 

	....
	// Did we say Go 
	if ($player_id == self::getGameStateValue('go_player_id'))
	{            
		// turn it back over to that player 
		$this->gamestate->nextState('nextPlayer');
		return;
	}
	...	
}
And this all works great, except for the fact that a player plays a card and doesn't realize it is still their turn if they don't read the banner. I would like to play the global jingle after every card is played AND it is active player.

Re: Playing the global jingle sound even when player is still active

Posted: 21 July 2020, 09:58
by RicardoRix
One thing: That's a game state and not a "type" => "activeplayer".
No player should be doing stuff here.... :?:

So have you quoted the wrong state you think you're looping around?

Re: Playing the global jingle sound even when player is still active

Posted: 21 July 2020, 17:57
by MikeIsHere
Here is the state

Code: Select all

    20 => array(
    		"name" => "playerTurn",
    		"description" => clienttranslate('${actplayer} must play a card'),
    		"descriptionmyturn" => clienttranslate('${you} must play a card'),
    		"type" => "activeplayer",
            "possibleactions" => array( "playCard"),            
    		"transitions" => array( "nextPlayer" => 30, "ClearBoard"=> 35, "endGame" => 90)
    ),
Here is the code from stNextPlayer

Code: Select all

function stNextPlayer() {
	$player_id = self::activeNextPlayer();
	
	// if you can play you must play simple 
	if (self::playPossible($player_id)) {        
		self::giveExtraTime( $player_id );
		$this->gamestate->nextState('playerTurn');
		return;
	}

	// Else -- Why can't we play 

	....
	// Did we say Go 
	if ($player_id == self::getGameStateValue('go_player_id'))
	{            
		// turn it back over to that player 
		$this->gamestate->nextState('nextPlayer');
		return;
	}
	...	
}
So it goes playerTurn->nextPlayer->nextPlayer->playerTurn
And the jingle does not go off.

Re: Playing the global jingle sound even when player is still active

Posted: 21 July 2020, 19:48
by paramesis
It's not supposed to play the jingle effect between two activeplayer states where it is your turn. There are a lot of games, such as Tzolk'in, where your turn consists of multiple state changes, and it would be very annoying if it played the jingle every time you place a worker. Plus, the BGA framework already uses several cues to indicate it's still your turn:
  • hourglass by your name
  • hourglass on the action bar
  • your timer going down
  • those triangle things on the page title
I think it's useful to ask in cases like this, is it more confusing or ambiguous about whether it's still your turn than any other game on the platform? If not (and I suspect it's not if it's a simple card play), I wouldn't worry about the jingle. Many players turn sounds off anyway.

Re: Playing the global jingle sound even when player is still active

Posted: 22 July 2020, 12:57
by MikeIsHere
Sure I can understand why the default behavior is that way, I was just wondering if I had the flexibility to override it

Re: Playing the global jingle sound even when player is still active

Posted: 09 September 2020, 21:05
by Xom
This is relevant to my game Oh-Seven, too. I think it might make sense for my game to play the jingle once per trick, even if the player played last in one trick, winning it, and immediately had another turn, to lead the next trick.

But first I have the problem that the jingle doesn't play at all in realtime games, except at the start of bidding, which is a simultaneous turn. In turn-based games the jingle works as expected. Any guesses?