Page 1 of 1
Storing intermediate or secret values in statistics
Posted: 08 October 2022, 13:56
by salty-horse
I have an "average number of points" statistic that I can only set at the end of the game.
Can I use that statistics to score the sum, and only divide it at the end of the game?
Does this cause problems if the game ends prematurely (by players quitting)? Are statistics displayed in that situation?
Also, is it OK to store information in statistics that should be hidden from other players? Are the stats only observable at the end of the game?
Re: Storing intermediate or secret values in statistics
Posted: 10 October 2022, 08:13
by Een
It's better to not use statistics out of their regular scope.
I'd advise using a game state variable for this.
Re: Storing intermediate or secret values in statistics
Posted: 10 October 2022, 09:31
by salty-horse
OK.
What about hidden information? Are the accumulated statistics hidden from players until the end of the game?
Re: Storing intermediate or secret values in statistics
Posted: 10 October 2022, 09:40
by salty-horse
Followup question to the recommendation: What's the recommended way for using per-player game state variables?
I currently have hardcoded player1Foo, player2Foo variables, and translate from player ID to player index when I access them.
Is there a way to initialize these dynamically with the player IDs as part of the name?
Re: Storing intermediate or secret values in statistics
Posted: 10 October 2022, 10:02
by Tisaac
salty-horse wrote: ↑10 October 2022, 09:40
Followup question to the recommendation: What's the recommended way for using per-player game state variables?
I currently have hardcoded player1Foo, player2Foo variables, and translate from player ID to player index when I access them.
Is there a way to initialize these dynamically with the player IDs as part of the name?
Not sure to understand the question. What are you trying to achieve ?
Re: Storing intermediate or secret values in statistics
Posted: 10 October 2022, 10:43
by Een
salty-horse wrote: ↑10 October 2022, 09:31
OK.
What about hidden information? Are the accumulated statistics hidden from players until the end of the game?
At the moment yes, but I don't think we can guarantee that for the future, so it would probably be better to compute these kind of statistics at the end of the game.
Re: Storing intermediate or secret values in statistics
Posted: 10 October 2022, 10:44
by Een
salty-horse wrote: ↑10 October 2022, 09:40
Followup question to the recommendation: What's the recommended way for using per-player game state variables?
Please don't do that

Much better/cleaner to add a field on the player table in the database (I was thinking table statistic and not player statistic when I suggested using game state variables)
Re: Storing intermediate or secret values in statistics
Posted: 10 October 2022, 13:28
by salty-horse
Een wrote: ↑10 October 2022, 10:44Please don't do that

Much better/cleaner to add a field on the player table in the database (I was thinking table statistic and not player statistic when I suggested using game state variables)
Ah, of course! Thanks!