Both group_by_arrival_time and wait_for_all_groups?

202 views
Skip to first unread message

Peter Cock

unread,
Dec 10, 2021, 11:35:21 AM12/10/21
to oTree help & discussion
Hello all,

In our game we have groups of 6, and I have been using a wait page with:

group_by_arrival_time = True

That has been working, however for running the game either in-person or over a video call, we want all the players to be kept somewhat in sync with each other for verbal instructions.

I have therefore altered the wait-and-group page to add this:

 wait_for_all_groups = True

I was expecting this to combine the behaviours, so the first 6 players form group 1 (and stay waiting), the next 6 players form group 2 (and stay waiting), until everyone has arrived and been grouped.

What seems to be happening is it waits for everyone, but they are all in group 1 (which is now well over the target of players_per_group = 6.

Looking at the source code, especially views/abstract.py, my impression is these two settings cannot be combined. Should I use two wait pages instead? One group_by_arrival_time page to make my groups of 6, followed by a wait_for_all_groups page to get everyone synchronised?

Peter

Chris Crabbe

unread,
Dec 10, 2021, 2:42:35 PM12/10/21
to Peter Cock, oTree help & discussion
Hi Peter -

The way I would do this is by setting a session.var named something like session.vars['all_players_arrived_round_'+subsession.round_number] to False in creating_session.

Then in the group_by_arrival_time_method, I'd first test if len(waiting_players) == len(subsession.get_players()).  If it is, I'd set session.vars['all_players_arrived_round_"+subsession.round_number] = True

Then I'd put my grouping code inside a "if  session.vars['all_players_arrived_round_"+subsession.round_number] " conditional

The reason I would need to set a subsession-wide flag is that the first time len(waiting_players)==len(subsesison.get_players()), your group_by_arrival_time_method would spit out a group of 6, and then the next time it runs waiting_players won't be equal to len(subsession.get_players()) anymore.  So that trigger needs to set the flag to true so you can spit out the other groups afterwards too.

Thanks,
--Chris

--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/b961421b-b10a-49cd-9caf-4d77d430808cn%40googlegroups.com.

Peter Cock

unread,
Dec 10, 2021, 2:59:58 PM12/10/21
to oTree help & discussion
So possible in theory, but it will need me to write some custom code. I will look at that next week, thank you!

Peter

Peter Cock

unread,
Dec 13, 2021, 6:19:10 AM12/13/21
to oTree help & discussion
Pondering this over the weekend, by adopting a global wait, we don't actually need to use group-by-arrival time anymore. The default groups of size 6 allocated by player number will be fine. So, I'll keep it simple:
Reply all
Reply to author
Forward
0 new messages