GameFi
  • General Intro
  • 📃R & D
  • 💻Workshop
    • 🏎️NFT Web App Integration
      • 📄Prerequirements
      • Decentralized Storage
      • Smart Contract NFTs
      • Creating the React Dapp
      • Updating Startup File, Wallet Connect & Main Menu
      • Fetching NFTs, Stacks and Hiro API
      • Rendering NFTs owned
      • Selecting an NFT
      • Mapping Scenes
      • Creating the playable game
  • 🪙Trustless Rewards - M1
    • General idea
    • Flow Lobbies
    • Smart Contract
  • 🎨Customizable NFTs - M2
    • General Idea
    • Flow Customizable NFTs
    • Smart Contracts
      • Component
      • Customizable Wrapper
  • 🎁Lootbox on Chain - M3
    • General Idea
    • Tech Explained
    • Smart Contracts
      • Item
      • Lootbox
      • Lootbox Manager
  • 📝Message Signing
    • General Idea
    • GameFi Use Cases
    • App Explained
  • 🪵SFTs
    • General Idea & Base SFTs Static Deployments
    • Metadata Structure
    • Static Flow and Smart Contracts
    • Advanced SFTs Dynamic Deployments
    • Dynamic Flow and Smart Contracts
    • Dapp Integrating SFTs
      • Front End
      • Back End
    • Resources
  • ⚡Subnets
    • Overall for subnets
  • Roadmap
  • 💾Decentralized Storage
    • Gaia
    • Pinata
    • Host SFTs and NFTs into Pinata
    • Gaia integration to host game resources
  • 🔗External Knowledge
    • Getting Started
    • Hiro API
    • Stacks Docs
    • Clarity Book
    • Hiro Tutorials
Powered by GitBook
On this page
  • Create Lobby
  • Unique Race Generator
  • Join Lobby
  • Waiting for Confirmation on-chain
  • Race Time
  • DB - Server - Blockchain Combo
  • Rewarding players

Was this helpful?

  1. Trustless Rewards - M1

Flow Lobbies

off-chain & on-chain combination detailed

PreviousGeneral ideaNextSmart Contract

Last updated 2 years ago

Was this helpful?

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.

🪙
creation of a lobby
Scheme displaying the variables in the formula
lobbies created & started with join & race options