0xFableOrg / 0xFable

A fully on-chain trading card game. There will be elves, wizards & shit. Drama and broken friendships also.
https://twitter.com/0xFableGame
BSD 3-Clause Clear License
103 stars 35 forks source link

Fetch game ID for game creator #115

Open norswap opened 5 months ago

norswap commented 5 months ago

Currently, we fetch the game ID on load from the inGame dict which is only populated when effectively joining (not creating) a game.

This was by design, as we want to enable a game creator to create multiple games that he may not necessarily participate in (for tournaments, etc).

However, for the current UX flow which assumes 2-player matches where the creator takes part, this is annoying, as the creator can create a game, reload, and lose track of the created game.

This is not fatal (it's still possible to join the previously created game, or create a new one), but for the demo we should store on chain the ID for a created game and fetch.

Probably just populating inGame at creation time (and modifying later checks to allow the creator to join) is the way to go for now.

norswap commented 5 months ago

This will also fix another issue that we have:

→ both the joinGame and createModal are displayed, with the createGame modal displaying on top and displaying the option to join the game (even though it's already joined)

Proper redirects as per the above will prevent this from happening.

However it is still abnormal: the createGameModal should autoupdate to detect the game was successfully joined and so not offer to join. That's what the code seems to be doing too, so there's a need to investigate this.