Unexpected error: Invalid player number for this game: 1

Game development with Board Game Arena Studio
Lone Boardgamer
Posts: 19
Joined: 16 September 2020, 21:49

Re: Unexpected error: Invalid player number for this game: 1

Post by Lone Boardgamer »

I assume BGA Studio source code is not available anywhere, right? Would be much easier for me to simply debug the issue by looking into the parent class code.
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Unexpected error: Invalid player number for this game: 1

Post by Tisaac »

Several things : this error simply means something wrong is happening in setup, nothing related to players. Dumping during setup does not work so you wont be able to see what is wrong.
Only solution : comment everything in the setup and in the first state (return [ ] for args for instance). Once the game load, you can uncomment and refresh the page, you will be able to detect if something is wrong in the args of the first state. Otherwise simply uncomment setup step by step until you find the issue.
And you should probably join the discord server, it will be easier to help you over there
Lone Boardgamer
Posts: 19
Joined: 16 September 2020, 21:49

Re: Unexpected error: Invalid player number for this game: 1

Post by Lone Boardgamer »

Tisaac wrote: 24 June 2021, 11:36Only solution : comment everything in the setup and in the first state (return [ ] for args for instance). Once the game load, you can uncomment and refresh the page, you will be able to detect if something is wrong in the args of the first state. Otherwise simply uncomment setup step by step until you find the issue.
Could you, please, be more specific? Which setup? Do you mean setup() function in JS file? Also where is first state?

This is my first game implementation, I didn't get used to framework yet, sorry.
Lone Boardgamer
Posts: 19
Joined: 16 September 2020, 21:49

Re: Unexpected error: Invalid player number for this game: 1

Post by Lone Boardgamer »

Tisaac wrote: 24 June 2021, 11:36 And you should probably join the discord server, it will be easier to help you over there
I don't use Discord, but if you really think it's easier to get help there, I can try. Which discord server exactly?
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Unexpected error: Invalid player number for this game: 1

Post by Tisaac »

Lone Boardgamer wrote: 24 June 2021, 12:36
Tisaac wrote: 24 June 2021, 11:36 And you should probably join the discord server, it will be easier to help you over there
I don't use Discord, but if you really think it's easier to get help there, I can try. Which discord server exactly?
https://discord.gg/mkMPqEVc

I was talking about the general setup of the game, so the setupNewGame and any game state before you reach your first (multi/single) active state.
Lone Boardgamer
Posts: 19
Joined: 16 September 2020, 21:49

Re: Unexpected error: Invalid player number for this game: 1

Post by Lone Boardgamer »

Tisaac wrote: 24 June 2021, 12:45 I was talking about the general setup of the game, so the setupNewGame and any game state before you reach your first (multi/single) active state.
The only setup I am aware of is in states.inc.php, stats.inc.php, gameoptions.inc.php and gameinfos.inc.php files. I've checked them all, commented custom lines of code but still see the same error. This is extremely frustrating, because I can't even properly debug it by looking into framework's source like I used to :-(
Lone Boardgamer
Posts: 19
Joined: 16 September 2020, 21:49

Re: Unexpected error: Invalid player number for this game: 1

Post by Lone Boardgamer »

Got it solved. Thanks for helping!
User avatar
xtyner
Posts: 2
Joined: 14 May 2020, 12:29

Re: Unexpected error: Invalid player number for this game: 1

Post by xtyner »

Even though Lone Boardgamer is already glad, I want to share my experience so others are maybe faster than me:

I had the same problem and was searching for the reason. I want to develop (another) card game and started like every time by initializing the cards.
Then I tested to enter the game and got the same error: Invalid player number for this game: 1

I checked with older games I developed and didn't find the reason.
But now I did.

You have to initialize the table of your cards in the database (sounds reasonable). For this you need to write sql-code in the file dbmodel.sql (in there, there is already the initialization of a card game in comments).

For more information open the Hearts tutorial in section Game Database and Game Initialisation
https://en.doc.boardgamearena.com/Tutorial_hearts

Cheers
User avatar
disu
Posts: 62
Joined: 10 February 2016, 08:47

Re: Unexpected error: Invalid player number for this game: 1

Post by disu »

Honestly I think the error text not helps too much... :)

In my case I've the same error and my problem is in the dbmodel.sql.
I've change a field name withoud changing it in index dexlaration. So it was a SQL error so, as you supposed, it was before setupNewGame call.
Post Reply

Return to “Developers”