Page 1 of 1

[SOLVED] Detect when a player concedes / leaves

Posted: 03 July 2021, 13:38
by junibegood
Canosa is a 2-player game with complete information, the kind of game where the first player may have an advantage.

That's why the publisher and I decided to add meta-statistics (by this I mean statistics that make no sense about a single game, but have meaning when you consider a large set) to check how often first player wins. If you play first and win, you get a 100 in "first player win", your opponent gets a 100 in "second player loss" and everything else stays at 0. Computed on many games, you get a win/loss % for both first and second player.

The problem with this is : I update the stats when the ending condition is met. But players may concede or leave and never reach the ending condition ! All stats remain at 0 in that case and my win/loss % are wrong.

So my question is : can I detect when a player concedes or leaves and update statistics at that moment to count a loss for that player and a win for the opponent ?

Re: Detect when a player concedes / leaves

Posted: 05 July 2021, 09:02
by Een
The game module is not meta, so it follows that you can't really do meta-statistics directly.

For your purpose, a trick might be not to initialize the stat. In that case, if the game does not end normally, the stat would remain null in the database. In this case that stat is not taken into account for computing the average.

But that's just a hack. In the case where meta-analysis is desired by the publisher/designer of the game, the game module responsibility is just to register all data of interest. Then the publisher can request us to set up an export of the data including meta-data such as player number and player order, and apply any type of analysis they want on that dataset.

Re: Detect when a player concedes / leaves

Posted: 07 July 2021, 13:45
by quietmint
The framework gives no indication about when a game ends abnormally (via express stop, abandon, concede). You can upvote this proposal in the studio where I ask for a new callback from the framework for this purpose: https://studio.boardgamearena.com/bug?id=50

Re: Detect when a player concedes / leaves

Posted: 10 July 2021, 18:46
by junibegood
Thanks Een for your answer. I'll ask the publisher what they want to do, but I believe the best would be to remove the stat entirely and rely on data exports later to get this info. Players will likely concede often in this game, computing win % without thoses games would not make much sense.

@quetmint : upvoted, thanks. ;)

Re: Detect when a player concedes / leaves

Posted: 19 August 2021, 09:46
by junibegood
I finally solved this problem by leaving the win/loss stats like they already were, and adding an "unfinished games %" stat that I initialize at 100 for both players and put back to 0 for both players if the game reaches the ending condition. This way the sum of wins, losses and unfinished % should be 100.

I notice a strange behaviour with this stat, here is an example : https://boardgamearena.com/table?table=195306305
One player was kicked for being out of time. We can see that for both player, the "unfinished games %" stat remained at 100 as it should have. What's strange if that if you look at these two players overall stats, the "unfinished games %" stat is still at 0, and so is it for "all players average".

https://boardgamearena.com/playerstat?i ... on=profile
https://boardgamearena.com/playerstat?i ... on=profile

Could it be that unfinished games are already not computed in overall stats ? This would make sense, stuff like number of turns played or average scores would be wrong in most games if these games counted. But if they are already excluded, I don't need an unfinished games stat at all, do I ?

Re: Detect when a player concedes / leaves

Posted: 20 August 2021, 15:27
by Een
I checked and indeed we average only games with a "normal end" (which as you said is logical otherwise averages would not have any meaning).

Sorry didn't think about that in the first place, it would have avoided you trying to find a solution.

Re: Detect when a player concedes / leaves

Posted: 21 August 2021, 18:39
by junibegood
No problem, thanks for checking the actual behaviour.

I'll remove the "unfinished games" stat, then.