Playing the global jingle sound even when player is still active

Game development with Board Game Arena Studio
Post Reply
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

Playing the global jingle sound even when player is still active

Post 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.
Last edited by MikeIsHere on 21 July 2020, 17:58, edited 1 time in total.
User avatar
RicardoRix
Posts: 2540
Joined: 29 April 2012, 23:43

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

Post 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?
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

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

Post 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.
User avatar
paramesis
Posts: 398
Joined: 28 April 2020, 05:00

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

Post 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.
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

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

Post 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
User avatar
Xom
Posts: 28
Joined: 30 September 2014, 19:21

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

Post 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?
Post Reply

Return to “Developers”