Currently, the only way to add new human players to your game is by sharing the URL with a friend. But we could implement a lobby listing open games where random people could join. I'm imagining:
A public/private setting when creating a game to opt into randos joining
Continue to use Registry to track GameServer processes, but make use of its value option to attach metadata to each game process, such as whether it's public, and whether it's available to join (we'd use Registry.update_value once a game starts to mark it as unavailable to join.
The lobby could use Registry.match to find all games that are public and open to join
Alternatively, we could use a separate :game_lobby registry and avoid the metadata juggling: only add public games to that registry and unregister them once they start and cannot be joined. This seems simpler, and I see no downside to two overlapping registries. 🤔
Prerequisites
Thinking about this more, there may be a need for some foundational features to support opening the game up to random people:
[ ] A turn timer: if random people can join your game, it would be unfortunate if they ghost you and the game cannot continue (I assume this is not a problem when playing with friends). I envision a 1-minute turn timer after which your turn automatically ends, and if 2 of your turns in a row end automatically you're kicked out and replaced with an AI player, perhaps?
Currently, the only way to add new human players to your game is by sharing the URL with a friend. But we could implement a lobby listing open games where random people could join. I'm imagining:
Registry
to trackGameServer
processes, but make use of itsvalue
option to attach metadata to each game process, such as whether it's public, and whether it's available to join (we'd useRegistry.update_value
once a game starts to mark it as unavailable to join.Registry.match
to find all games that are public and open to joinAlternatively, we could use a separate
:game_lobby
registry and avoid the metadata juggling: only add public games to that registry and unregister them once they start and cannot be joined. This seems simpler, and I see no downside to two overlapping registries. 🤔Prerequisites
Thinking about this more, there may be a need for some foundational features to support opening the game up to random people: