A fun & competitive step tracker game where you can walk, use items or bribe other players to win.
Prize Pool
Superwalk is the Android game you'd get if you would mix Fitbit with Mario Party. It works just like a regular step tracker, but includes a turn-based competition where you (mostly) walk to climb in the leaderboard, but you can also use items or bribe other players to get a higher score.
The game is turn-based, with 1 turn lasting 60 minute. During a turn, every players 's step count is automatically recorded. When a turn starts, players can claim a new in-game item, as long as their step count increased compared to the previous turn.
These items can be offensive, defensive, or have a boosting effect, with each items having their own success rate to keep the game fun and unpredictable.
During the first 20 minutes of each turn, players can decide to either use one of their items, attempt to protect themselves from other players' actions, or bribe another user to cancel their attack. Although these actions can change the course of the game, they are not guaranteed to succeed, as using an item or blocking attacks can fail.
Additionally, action will place the player in a cool down period that will last a certain amount of turns. During that period, players won't be able to perform another action, meaning they have to strategize to stay on top.
In addition to bribes, players can bets against one another, making Superwalk a fun way to get a few extra bucks while staying fit and having fun.
Step count: The steps data are recorded and reported automatically
Turns: Each turn lasts 1 hour, during which players can perform actions and pick items. The game operates in a turn-based manner and without any human intervention
Inventory & item airdrop: Players can pick a random item based on their last step count, provided their inventory is not full.
Actions: Players can perform actions such as using items, blocking, or bribing other players. Actions are subject to a cool down period and can only be performed within a specific time window.
Time constraints: All actions (getting a new item, bribing, using an object, blocking attacks) are subject to time constraints and can only be performed within a specific time window, the 20 first minutes of each turn.
Fitness monetization: Players have multiple opportunities to make their fitness activity an additional source of income, by scoring high, receiving bribes (a bribe is proportional to the step count of the briber, meaning the more that person walked, the more they will have to pay to not be attacked), or winning bets against other players.
This project is made of multiple parts :
I was planning on using Thirdweb Engine but could not due to my laptop not having enough resources to run it locally (along with my API and mobile app environment)
The game continuously runs for 24 hours, divided into 60-minute turns, during which each player's step count is automatically reported every 10 minutes, with an automatic reset for every player everyday.
At the beginning of every turn, players can earn new in-game items, as long as their step count increased compared to the previous turn. These items can be offensive, defensive, or have a boosting effect, with each items having their own success rate to keep the game fun and unpredictable.
During the first 20 minutes of each turn, players can decide to either use of their items to change the course of the competition, or bribe another user to cancel their attack.
At the end of each turn, the score of each player is calculated by checking their current step count and applying any modifier applied to them during the turn (boosting items, attacks, if they cancelled an attack with a block...).
At the beginning of every turn, players can earn new in-game items, as long as their step count increased compared to the previous turn. These items can be offensive, defensive, or have a boosting effect, with each items having their own success rate to keep the game fun and unpredictable.
During the first 20 minutes of each turn, players can decide to either use of their items to change the course of the competition, or bribe another user to cancel their attack.
The mobile app (Android only) was bootstrapped using Thirdweb Expo template. It uses xstate store and finite state machines for state management.
It was designed to be interoperable with HealthConnect (replacement of Google Fit API), but I had to switch to manually track steps with expo-sensor instead, as it is currently impossible to filter out manually added steps with HealthConnect](https://github.com/matinzd/react-native-health-connect/issues/51#issuecomment-2231091383).
Sadly this meant also dropping support for iOS, as the expo-sensor Pedometer implementation is completely different between iOS and Android, with Android support lacking the possibility to get step count between 2 dates. Currently, the steps are accounted for using a finite state machine that automatically records them in a databa
Due to these problems, I had to manually implement step tracking, but the source code still showcases a finite state machine for interacting with the HealthConnect SDK (granting permission, reading records etc.).
Authentication was built using Thirdweb Connect, with smart accounts as a priority. Designed for casual, non-crypto users first, Superwalk supports login with Google, email and phone number, but also offers connecting with Farcaster. Upon signing-in, behind the scenes, users are also authentified on the backend, using SIWE (sign-in with Ethereum) and custom API routes.
The interactions that interact with smart contracts (joining the competition, claiming an item, using an item, bribing another user...) are sponsored, another Thirdweb Connect feature.
All on-chain interactions were developed using the Thirdweb React Native SDK.
2 smart contracts were deployed to Base Sepolia via the Thirdweb CLI :
The game smart contract implements all of the game logic. Some functions are available to everyone (joining the game for instance), but most are only allowed to specific wallets addresses meeting certain criteria :
AccessControl
) : reporting step counts, scores, ending a turn to start a new one ;Additionally, the functions of the smart contract are gated with time control.
Being a game, Superwalk had to implement a reliable random number generator to guarantee a fair game. This was done using Pyth Network Entropy. Sadly, this meant not deploying the game contract to Metal L2 testnet and Celo Dango, as the required contracts are not available on those chains yet.
Entropy is used to :
Events are dispatched for most function :
GameItemCreated
: Emitted when a new game item is created by the game master or contract ownerPlayerJoined
: Emitted when a player joins the competition.StepsCountReported
: Emitted when a player's steps are reported.IntentAction
: Emitted when a player requests to perform an action (requires RNG)BribeSent
: Emitted when a bribe is sent from one player to another.ItemUsed
: Emitted when a player uses an item.IntentPickItem
: Emitted when a player requests to pick an item. (requires RNG)ItemPicked
: Emitted when a player successfully picks a random item.ScoreUpdated
: Emitted when a player's score is updated.TurnEnded
: Emitted when a turn ends.The subgraph for the custom game contracted was created using Goldsky no-code deployment tool. It indexes all events defined above. The subgraph is used in various parts of the stack :
etc. ; and in the API to calculate the score of each player for a turn by doing the aggregating all actions that targeted a player
The database and cron jobs were created with Supabase. All tables have RLS enabled and users can't write to it. Only authenticated calls from the API can. The following data are stored :
Steps are recorded every 10 minutes, with a hook verifying that the same player didn't already update their step count in the last 5 minutes.
Cron jobs were set to automate the following :
The API was bootstrapped using Elysia. It is the bridge between multiple parts of Superwalk :