"safe" player IDs [SOLVED]

Game development with Board Game Arena Studio
Post Reply
User avatar
JonChambers
Posts: 97
Joined: 03 July 2021, 11:40

"safe" player IDs [SOLVED]

Post by JonChambers »

I'm storing player IDs as global variables, but sometimes I want to use the same global to say something like "no player has yet..." or "there is no longer a player such that..."

So, let's suppose I record that as "7". That's going to be all well and good until the 7th person to get an account with BGA tries to play and everything crashes.

Or does it work like that? Is there a player_id 7 out there somewhere? What player_id can I be 100% confident doesn't exist?

(Yes, I know, there are workarounds that don't assume any player numbers don't exist, but if there are any that don't yet and will never exist, that will be very useful.)
Last edited by JonChambers on 28 September 2021, 05:50, edited 1 time in total.
User avatar
JonChambers
Posts: 97
Joined: 03 July 2021, 11:40

Re: "safe" player IDs

Post by JonChambers »

Just pulled open the database and released it was a signed int, so I'm fairly confident there are no negative player ids on the server.

I'll mark this as solved, but keep it up just in case another developer finds this trick useful.
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: "safe" player IDs [SOLVED]

Post by Tisaac »

Just use 0 if you want to mark it as "null".
Post Reply

Return to “Developers”