Flow Lobbies

off-chain & on-chain combination detailed

Create Lobby

User creates lobby by calling the contract from the game interface

Unique Race Generator

Each lobby is unique. It uses a combination of multiple formulas to generate a random road that is in the set parameters. By doing so, 2 lobbies with exact same input for creation will be different.

Join Lobby

Players can pay to enter the lobby using the smart contract by joining the lobby with the id from the game interface

Waiting for Confirmation on-chain

The lobby is in checking state. It waits to get confirmed on-chain. Till then, for increased security, it cannot be joined, because it may fail before it gets confirmed on-chain.

Race Time

The game checks the on-chain contract's read-only function that gives a list of the users that paid the entry price. If the read-only of get-score returns any value it means the join got confirmed for that player on that lobby. After the check confirms, the player can race as many times as he wants before the time of the lobby ends.

DB - Server - Blockchain Combo

The results are published on-chain every 10 minutes ~ 1 stacks block.

Rewarding players

A pre-determined formula determines how much in rewards each player receives based on the scores and places they got of their best run in the lobby. Any type of formula can be used, paying only the first 5 or only the first to increase competitiveness, paying everybody in smaller amounts to incentivize participation. We picked one in the middle that rewards the first few places the most, while also sending a piece of the rewards to the other players.

Last updated