Minor bug in Hearts tutorial?

Game development with Board Game Arena Studio
Post Reply
User avatar
2lt_yakutaro
Posts: 1
Joined: 09 July 2023, 05:48

Minor bug in Hearts tutorial?

Post by 2lt_yakutaro »

Hi all,
I just recently started learning BGA Studio; I was following the Hearts tutorial to the letter, but run into a problem at the end of step 6: "Game Interface JS Stock".
The problem: when I click on the card in the player's hand, I got a red "unauthorized move" warning in the window, instead of the expected output "on playCard 42" on the console.
I think it comes from a mismatch between this line in the tutorial:

Code: Select all

if (this.checkAction('actPlayCard', true)) {
and state 2 in states.inc.php, which has these two lines:

Code: Select all

"possibleactions" => array( "playCard", "pass" ),
"transitions" => array( "playCard" => 2, "pass" => 2 )
I got stuck on this for a while until I figured it out, so it's something to be aware of when following the tutorial.
User avatar
thoun
Posts: 1620
Joined: 10 December 2020, 22:25

Re: Minor bug in Hearts tutorial?

Post by thoun »

On the tutorial I see the state with playCards as :

Code: Select all

    31 => array(
        "name" => "playerTurn",
        "description" => clienttranslate('${actplayer} must play a card'),
        "descriptionmyturn" => clienttranslate('${you} must play a card'),
        "type" => "activeplayer",
        "possibleactions" => array( "actPlayCard" ),
        "transitions" => array( "playCard" => 32 )
    ), 
Where did you see the bad writing? It should be actPlayCard, as you guessed.
Swinkels
Posts: 8
Joined: 08 November 2021, 14:47

Re: Minor bug in Hearts tutorial?

Post by Swinkels »

The code in states.inc.php is from the template and does not model the state machine of the hearts tutorial:

Code: Select all

"possibleactions" => array( "playCard", "pass" ),
"transitions" => array( "playCard" => 2, "pass" => 2 )
Only later in the tutorial, they set up the state machine with the correct action name 'actPlayCard':

Code: Select all

"possibleactions" => array( "actPlayCard" ),
"transitions" => array( "playCard" => 32 )
I think it is an oversight that the tutorial assumes the correct state machine is already implemented during the "Game Interface JS Stock" section.
Post Reply

Return to “Developers”