Skip to content

[pom-lite] multiplayer study workflow #982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Jun 10, 2025
Merged

Conversation

sgfost
Copy link
Contributor

@sgfost sgfost commented Mar 27, 2025

Lite game mode

This adds a new game mode referred to as lite which is based on the solo game mode but allows for a variable amount of players. This means that the solo game mode should be able to be completely replaced by lite game configurations, assuming data is migrated (or the legacy data is kept around)

Note

most of the Solo* and Lite* classes/entities inherit from the same base class to make this eventual refactor/migration a bit easier

multiplayer study

the lite game is used to implement a 3-player prolific study flow similar to the existing solo study flow. Multiplayer studies can be created in the same place in the admin interface and the configuration/treatments/event cards remain the same

the entry-point for each mode is:

  • solo: <HOST>/study/prolific/solo?prolificId=<PROLIFIC_PARTICIPANT_ID>&studyId=<PROLIFIC_STUDY_ID>
  • multiplayer: <HOST>/study/prolific/multiplayer?prolificId=<PROLIFIC_PARTICIPANT_ID>&studyId=<PROLIFIC_STUDY_ID>

configuration

  1. run migrations npm run migrate
  2. re-load fixtures npm run load-fixtures:prod

saachibm and others added 14 commits February 3, 2025 16:47
pom-lite will be the base for solo and 'simplified' multiplayer game
modes

all lobbies (including for pom-lite multiplayer will inherit from the
same base lobby)
and simplify the lobby that will be used for multiplayer games
implements the lite multiplayer game room with commands/lobby transfer
and lots of refactoring in order to extract reuse shared functionality
between the solo lite and multiplayer lite versions

the lobby is working, however the game room itself is not and is missing
persistence to the db + multiplayer specific UI elements
these all share common base classes, and solo records will ideally
be migrated to lite records once all of the other components are

TODO: uncomment/migrate lite entities
@sgfost sgfost changed the title [pom-lite] mutliplayer study workflow [pom-lite] multiplayer study workflow Apr 22, 2025
sgfost added 12 commits April 22, 2025 15:23
* added player tracking for multiplayer study participants + squashed
  with prior migration

TODO: add client side transition for the game reset

TODO: implement litegame service methods that the game logic (commands)
now need
* add lite game events/treatments fixtures, which are a copy of the solo
  ones (as with everything else here, until lite game can replace solo)
and fix the game not resetting properly by restarting the game loop
after clearing the room clock

TODO: fully integrate the study participant status into the flow
and instructions on the 'round 0' waiting period (which need to be
updated)
TODO: add handling for when players abandon the group,
currently the game simply proceeds and allows them to rejoin
onJoin will revert it back since we give them the opportunity to rejoin
in the case of disconnection, etc.

also, properly dispose of the game by calling EndGameCmd if all players
leave
and some style/linter fixes
sgfost added 6 commits May 20, 2025 10:33
the shared lobby queue is now FIFO, which, in conjunction with a timeout
that starts when the last player joins the lobby ensures that players
will not wait in the lobby for more than TIMER * (NUM_PLAYERS - 1), or
10 min in the case of 3-player games with a 5 minute timeout

also:
* scale the event card thresholds by the same system health scaling
  factor (num of players)
* correct max rounds for prolific variable game to 11
* give more time (45s for reading instructions)
@sgfost sgfost changed the base branch from lite-game-mode to main May 21, 2025 16:39
@sgfost sgfost requested a review from Copilot May 21, 2025 17:06
Copilot

This comment was marked as resolved.

sgfost added 3 commits May 21, 2025 11:47
more 'and the other players' language
by checking whether we are on the 2nd game + gameOver OR study complete
instead of just study complete
@sgfost sgfost merged commit 92d1dec into virtualcommons:main Jun 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants