[Résolu] Erreur à la création d'une partie - [solved] Error when creating a game

Game development with Board Game Arena Studio
Post Reply
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

[Résolu] Erreur à la création d'une partie - [solved] Error when creating a game

Post by fafa-fr »

salut

Je suis un p'tit nouveau, plutôt novice en programmation, et j'ai uploadé un très très petit projet, cothimfos, pour essayer la pateforme BGA studio, et voir ce que j'arrivais à faire.

Et forcément j'ai une erreur dès la création de la première partie.

Code: Select all

Unexpected error: Wrong formatted data from BGA gameserver 1 (method: createGame): 
Notice: Undefined variable: actplayer in /var/tournoi/release/games/cothimfos/999999-9999/states.inc.php on line 66 
Notice: Undefined variable: you in /var/tournoi/release/games/cothimfos/999999-9999/states.inc.php on line 67
{"status":1,"data":true}
Le message d'erreur dit que les variables actplayer et you (qui permettent de mettre les pseudos dans les messages d'informations sur qui doit faire quoi) ne sont pas définies. Est-ce que c'est ça qui provoque une erreur ? J'imagine que non, c'es marqué "Notice", ça veut bien dire que c'est juste une information, pas une erreur fatale ?

J'ai cherché un peu, j'ai pas vu d'erreurs de ce type mentionnées dans le forum, je suis allé voir la page Practical debugging, qui conseille d'aller voir le Gameserver error log. Est-ce que c'est ce qu'on peut trouver dans notre page de gestion de projet sous le nom "Get recent errors from production" ? Quand je clique sur les deux liens, j'ai les messages suivants :

Code: Select all

Client error: TypeError: _12 is null. During /admin/studio/getErrorsFromProduction.html Received: {"status":1,"data":null} 

Client error: TypeError: _15 is null. During /admin/studio/getSyntaxErrorsFromProduction.html Received: {"status":1,"data":null} 
Est-ce que quelqu'un a une idée de ce qui peut poser problème ? J'ai regardé si j'avais pas d'erreur de syntaxe dans mes fichiers mais j'ai rien trouvé (ce qui ne veut pas dire qu'il n'y en a pas).

Merci d'avance
Last edited by fafa-fr on 19 April 2016, 17:52, edited 1 time in total.
User avatar
apollo1001
Posts: 191
Joined: 21 July 2015, 10:41

Re: Erreur à la création d'une partie - Error when creating a game

Post by apollo1001 »

Welcome, and good luck with your project.

The error message would suggest that there is either a problem in your states file.

If it is your first project, it might be worth taking a look at the studio documentation for a states file: http://en.doc.boardgamearena.com/Your_g ... es.inc.php (if you haven't already found it).

The state should look something like this:

Code: Select all

    10 => array(
        "name" => "playerTurn",
		"description" => clienttranslate('${actplayer} must play a disc'),
		"descriptionmyturn" => clienttranslate('${you} must play a disc'),
        "type" => "activeplayer",
        "args" => "argPlayerTurn",   
        "possibleactions" => array( 'playDisc' ),
        "transitions" => array( "playDisc" => 11, "zombiePass" => 11 )
    ),
Feel free to post the code for your state and we'll take a look.
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: Erreur à la création d'une partie - Error when creating a game

Post by fafa-fr »

Hi, and thanks for your help.

This is the code of my state :

Code: Select all

    10 => array(
      "name" => "playerTurn",
      "description" => clienttranslate("${actplayer} must place a monster"),
      "descriptionmyturn" => clienttranslate("${you} must place a monster"),
      "type" => "activeplayer",
      // "args" => "argPlayerTurn",
      "possibleactions" => array ( "placeItem" ),
      "transitions" => array( "itemPlaced" => 11 )
    ),
As you can see, I almost didn't change anything in the states.inc.php file taken from reversi example. The only difference is the "args" line that is commented out (and some double quotes instead of single quotes).

Here's my whole states.inc.php file : (header comments removed)

Code: Select all

<?php
$machinestates = array(

    // The initial state. Please do not modify.
    1 => array(
        "name" => "gameSetup",
        "description" => "",
        "type" => "manager",
        "action" => "stGameSetup",
        "transitions" => array( "" => 10 )
    ),
    
    
    10 => array(
      "name" => "playerTurn",
      "description" => clienttranslate("${actplayer} must place a monster"),
      "descriptionmyturn" => clienttranslate("${you} must place a monster"),
      "type" => "activeplayer",
      // "args" => "argPlayerTurn",
      "possibleactions" => array ( "placeItem" ),
      "transitions" => array( "itemPlaced" => 11 )
    ),
    
    11 => array(
      "name" => "nextPlayerOrEnd",
      "description" => clienttranslate("What happens next"),
      "type" => "game",
      "action" => "stNextPlayerOrEnd",
      "updateGameProgression" => true,
      "transitions" => array( "nextTurn" => 10, "endGame" => 99 )
    ),
    

    // Final state.
    // Please do not modify.
    99 => array(
        "name" => "gameEnd",
        "description" => clienttranslate("End of game"),
        "type" => "manager",
        "action" => "stGameEnd",
        "args" => "argGameEnd"
    )

);
Do you think there's something wrong in it ?

Thanks again :)
User avatar
apollo1001
Posts: 191
Joined: 21 July 2015, 10:41

Re: Erreur à la création d'une partie - Error when creating a game

Post by apollo1001 »

fafa-fr wrote:

Code: Select all

      "description" => clienttranslate("${actplayer} must place a monster"),
      "descriptionmyturn" => clienttranslate("${you} must place a monster"),
Okay, I see your problem: you have used " instead of ' .

So it should be:

Code: Select all

      "description" => clienttranslate('${actplayer} must place a monster'),
      "descriptionmyturn" => clienttranslate('${you} must place a monster'),
Fingers crossed it now lets your game start :D
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: Erreur à la création d'une partie - Error when creating a game

Post by pikiou »

fafa-fr if you don't want to learn PHP through the official documentation, you could google the error messages you get and read as much as possible about them. You'd have found out what was wrong, and you'd have learnt a lot more in the process ^^
(I'm learning about other languages with the same process and it works great!)
I'm telling you this, because you'll encounter many more errors, some really obscure because they will be triggered by the BGA framework you don't have the source code of, and if you ask each time about these PHP errors, completing your game will take years :(
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: Erreur à la création d'une partie - Error when creating a game

Post by fafa-fr »

apollo1001 wrote:Fingers crossed it now lets your game start :D
Yes, it does, thank you ! (well, at least it lets the game page load, now it's time for debugging. But not today, it's late.)
I can't remember why I changed the single quotes into double quotes, even though I had already read once about the difference in variable parsing. I think I wasn't paying attention at that moment.

Pikiou, no problem with your post (I'm not offended or something), but just so you know, I want to learn PHP through documentation (official or not), and I've begun to (doc and exercises downloaded and partially read). I think that learning by trying and googling would not be very effective, at least for me. I've been reading "fucking manuals" for more than ten years, and I'm very happy with that way of learning.
And I'm not the kind of guy who often asks questions in forums without searching in documentation or forums. The reason why I asked here this time, is that the error messages didn't seemed meaningful enough to me to make an effective web search. After having read your post I tried, just to see if I would have found out what was wrong, but I think I wouldn't have, the search answers weren't connected to the problem (even though I tried more than 1 or 2 search expressions). But still, I learnt in the process, because I found this, so you were right on this point. (If anyone have some suggestions on how I could have done a successful search in this case, it can help me in the future.)

And last point, I hope that completing my game won't take years, because as i said in my first post, it's a very, very, very small project, and if it's not finished in a few weeks (I don't have much time to work on it), I think I'll give up. But now that the game page loads, it'll be easier to debug by myself.
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: [Résolu] Erreur à la création d'une partie - [solved] Error when creating a game

Post by fafa-fr »

My (so-called) "game" is finished ! :mrgreen: (well, it's playable, say, but it could be better)
I had told you, it's a very small project. Now I'm gonna take time to study a little more in depth, and maybe I'll join a little project (I'd love to help coding tichu, if ever I improve enough), or begin a new one.
Post Reply

Return to “Developers”