codeday-hom / hit-or-miss

Hit or Miss game - online version
0 stars 1 forks source link

Players can join a game #5

Closed robmoore-i closed 1 year ago

robmoore-i commented 1 year ago

When a game is created and the creator is in the lobby, other players can visit a URL either like/game/w2eguang3ydfp/lobby to join the game. For a game that has not yet stared, the URL /game/<game id> redirects to /game/<game id>/lobby.

When a new player visits the URL game lobby, they are added to the game's set of players, and all the players who are in the lobby are able to see that a new player has joined the game. In general, the game lobby shows all of the players who are in the game. The game's creator can additionally see a "Start game" button, as described in https://github.com/codeday-hom/hit-or-miss/issues/4.

When a new player joins the game, they will be assigned a random name. For now, I suggest choosing a random English noun, such as the name of an animal, appended with 3 random digits e.g. fish-351, bird-078, lion-223, dog-165 etc.

Something to bear in mind is that later in the project, we will want to add a step in between visiting the URL of a game lobby, and joining as a member of a game. Players will want to be able to choose the name that represents them in a game, rather than being assigned a random name. However, such features are not completely necessary, which is why we will visit it as an improvement layer in development, and not immediately.

Review

#22

Tests

backend/src/test/kotlin/com/game/main/ServerTest.kt backend/src/test/kotlin/com/game/main/GameWebSocketTest.kt