FTWinston / RobotInterrogation

Web app for playing Inhuman Conditions
http://interrogation.ftwinston.com
22 stars 8 forks source link

Game Lobbys #35

Open Spinnernicholas opened 3 years ago

Spinnernicholas commented 3 years ago

I would like to have a game lobby that shows all players and allows them to choose if they want to be the interviewer or suspect in the next interview. This game lobby would replace the existing confirm/swap positions view.

Player Names

Having a game lobby that lists all the players will require each player to have a name. Eventually, it would be nice to allow each player to set their own name but if that is not in place before this, I propose we generate random names in a similar way to how the interview IDs are generated. We can have two lists, first names and last names. One of each can be chosen at random and then the result is checked to make sure it is unique for that specific lobby. If a collision occurs, I think we should only reroll the first name because that will increase the likelihood that two players will share the same last name which I think would create some interesting banter.

Lobby Owner

The player that creates the game will be the initial owner of the lobby. They should be able to pass ownership to another player through the game lobby interface. The owner will have the ability to lock the lobby with a password and set custom settings for the lobby/interview.

Initial Lobby Settings

I propose we start with at least these settings.

Spinnernicholas commented 3 years ago

I added default player name generation as described. 200 first names(100 male, 100 female), 100 last names. They were taken from top most popular US baby names so they're very white washed. We can add more diversity later. https://github.com/Spinnernicholas/RobotInterrogation/commit/834761dedfa0dde61079a721e14642dc0ca45200

FTWinston commented 3 years ago

Yeah this sounds sensible. I'd like to avoid adding too much extra UI when setting up a 2 player game, which will presumably still be the most common use case. Perhaps Start a Game should continue to work like it currently does, and we add an extra Custom Game button? I'm on the fence about that myself.

A sensible follow up to this change would be to allow spectators to become players, somehow. Perhaps in position selection, both interviewer and suspect could choose to become spectators (only if there are already spectators?), and spectators could choose to claim a free position.

Spinnernicholas commented 3 years ago

I wasn't planning on going full force into this today but I might as well use this motivation while I have it, lol.

I think I have some ideas on how to keep the UI simple for people who want to set up a quick 2 player game.

Here's a question. We have to be able to link players from the client back to the players on the server. We can't use player index within the interview directly because players can join and leave. I can think of a quick workaround but it would be easy just to use the connection id like the server already does. I'm not very familiar with SignalR. Is there any reason we can't send one client's connection id to another client? Like is there a security risk or anything?

FTWinston commented 3 years ago

Yeah that's the common approach AFAIK. I've seen it done before for e.g. private messages.

Edit: Worth noting in passing that the ID will change if someone reconnects.