mattgallagher92 / safe-consequences

A SAFE stack app for playing consequences, the classic pen-and-paper game
1 stars 0 forks source link

Create a room #1

Closed mattgallagher92 closed 3 years ago

mattgallagher92 commented 3 years ago

As a player I want to create a room So that I only play with people I know

mattgallagher92 commented 3 years ago

I plan to use four-letter codes like netgames.io. Seems to work for them and I'm sure they get much more traffic than I expect to (I expect a maximum of one room at a time!). I don't expect the lack of password to be a problem.

mattgallagher92 commented 3 years ago

Once a room has been created:

mattgallagher92 commented 3 years ago

I decided to go with asking for a player's name when they click to create a room. This is consistent with netgames.io.

mattgallagher92 commented 3 years ago

In 437010cf92097303ff8e06aa838862ecf4c39e57, I made a change to not modify a User record unless the user clicks the submit button, rather than modifying it as they enter text in a form. This seems more natural to me, but does add some complexity, which might not be worth it.

It also leads to some coupling between the part of the update function handling the CreateRoom Msg and the UsernamePage Page, because form validation is handled in that part of the update function. I could reduce the coupling by, for example, introducing a new SubmitNameInput Msg, whose corresponding part of the update function handles validation, and sends on an appropriate command if the input is valid. I'll try that next.

Once that change is made, it's worth considering whether the delay of modification to the User record has made things simlper or more complex.

mattgallagher92 commented 3 years ago

I like the new changes. I think they simplify things by avoiding mixing concerns, so I'm going to keep them.