Page 1 of 2

Detecting realtime or turnbased mode

Posted: 11 July 2021, 05:39
by Idsky
I would love to be able to detect whether a game is being played real-time or turn-based to make some small improvements to the experience in these 2 cases.

Is there an acceptable nice way to do this? There's nothing to identify this in the self::getGameinfos()

In the game Factum (currently in Alpha) we have multi player active while multiple players choose a card. I want to keep the players active to allow them to change their mind if they want, up until all players have chosen. The slowest player to choose doesn't get the chance to change their mind.
But this is very annoying if playing turn-based -- in that case I'd want a 'confirm' button.

Similarly, each round starts with one player volunteering to be the story-teller to lead the round.
I have all players active here with a button to volunteer. This works well real-time but is annoying in turn-based as BGA keeps bringing you back to the game even if you don't want to volunteer.
I think the best option is to have a 'No thanks' button for turn-based mode to de-activate yourself and force one of the remaining players to volunteer, though this is not good if the remaining player(s) have not thought of a story, and then one of the players that initially hit 'no thanks' *does* think of a good story to lead the round! It's not a voluntary process if often the last player to come online is then forced to volunteer.
It'd be nice if BGA turn-based had a 'skip this table for a while' option or something.
Any suggestions?

Re: Detecting realtime or turnbased mode

Posted: 11 July 2021, 07:44
by Tisaac
See concept code, that's very similar to your need.
Previous version was distinguishing between TB and RT so check older version of the code (github Syarwin)

Re: Detecting realtime or turnbased mode

Posted: 11 July 2021, 11:04
by robinzig
According to the docs:

Code: Select all

Table.isAsync
return true if game is turn based, false if realtime, undocumented (why?)
(That's on the server side, obviously. If you need to know it on the client side I guess you can just call the above on the server side in getAllDatas to send this info to the client.)

Re: Detecting realtime or turnbased mode

Posted: 11 July 2021, 19:07
by tchobello
there are also two fields in Global Table DB about time allowed...
don't recall which one.

Re: Detecting realtime or turnbased mode

Posted: 12 July 2021, 01:09
by gilthe
An alternative might be to make your way of letting players (re)decide/continue/finalize a settable game option. If it's well-documented, you should be able to steer users to make the right choice for RT/TB.

I can see 2 problems:
(- The game looks awfully similar to Dixit, which has no license available from what I can tell: I made a table since I was curious)
- The second issue is conceptually different to me: it seems you rely on a volunteer to step forward but you don't describe what the mechanism is supposed to be for when there is none. Everybody goes into time penalty? Random choice? Finalizing "No thanks" only makes sense if that will always let the game continue meaningfully, irrespective of RT/TB.

Re: Detecting realtime or turnbased mode

Posted: 12 July 2021, 04:56
by Idsky
With the judge, 2 teams and story master crown I thought the game was unique and interesting enough to agree to develop it for the game designer. I've seen some other games that use art cards as well.

The storyteller needs to volunteer each turn of the game (the only limitation is that it cannot be the same player twice in a row). While this gives them a chance to earn more points, that is not guaranteed. Any kind of forced storyteller rotation I think will result in less interesting stories and delays (delays don't matter in turn-based but we want both game modes to play in a similar way).

As suggested above, if I do put in the 'No Thanks' button (it might be 'I can't think of a story!') for turn based and all-but-one player clicks it, the last remaining player will automatically be forced to be the storyteller. So if you're the last one to come online to the turn-based game you might be forced to tell the story for the round but hopefully that won't happen too often and more often than not someone who has thought of a good story to go with one of their cards will volunteer before that happens.

Re: Detecting realtime or turnbased mode

Posted: 12 July 2021, 05:02
by Idsky
tchobello wrote: 11 July 2021, 19:07 there are also two fields in Global Table DB about time allowed...
don't recall which one.
Thanks, yes I did see that global values 8 and 9 appear to be maximum play time and time per turn in seconds (I think), but checking those undocumented integers isn't a 'nice' way of determining game mode.

Re: Detecting realtime or turnbased mode

Posted: 12 July 2021, 05:13
by Idsky
robinzig wrote: 11 July 2021, 11:04 According to the docs:

Code: Select all

Table.isAsync
return true if game is turn based, false if realtime, undocumented (why?)
Oh that's nice, thanks. Why indeed!

Re: Detecting realtime or turnbased mode

Posted: 18 July 2021, 13:14
by Idsky
Since it's undocumented it might be a good idea to use it like this in yourgamename.game.php:

Code: Select all

$definitely_turn_based = ( method_exists($this, 'isAsync') && $this->isAsync() );
Works for me! Gives a boolean true or false value.

Re: Detecting realtime or turnbased mode

Posted: 23 July 2021, 02:01
by tsaunat
6nimmit allows changing of played card the whole time while the rest of the group is choosing, just as the first example. I'm not sure how it's accomplished.

I don't know how to accomplish the second example but in "the crew" at the beginning of each round allows for people to choose to pass cards, it waits until everyone has chosen yes/no/no opinion and skips it in the "next table" button, but you can come back and change your mind... I'm guessing if everyone declines rather than force the slowest as volunteer you would just randomly choose a person?


Those two mechanics seem to work equally well in turn based and real time play.