Entry for #NFTHack 2021 https://hack.ethglobal.co/showcase/secret-heros-reckb8Gx0K55ezLIA
Secret Heroes is a card game based on secretNFTs on SNIP-721 standard on Secret Network. Leveraging privacy properties of Secret Network, SNIP-721 enables private ownership and private metadata in NFTs.
Players can buy NFT cards (heroes) with four different skills. Players can “battle” their cards against 2 other players. The game randomly determines a skill to evaluate and determines a winner based on which card has the highest value for that skill. The winner receives all the cards used in the battle. No player has any information about other players’ cards at any point excpept the winning card.
Each card is a secretNFT, minted by a secret contract
- Name - Created by website; public metadata
- Image or 3D Model - Generated by Unity, based on scores; image not stored in the NFT
- Skill x 4 - Randomly generated by NFT minting contract - range from 1-100; private metadata
- Rarity - Based on skill scores; cards with skill (any) score above 90
- Weapons
- Engineering
- Biotech
- Psychics
Overview
- Players can purchase hero packs in exchange for SCRT. When they press a purchase button, Keplr TX is prompted, then player pays with SCRT. When purchase resolves, players are shown their purchased heroes.
- Each pack has 3 heroes: When a player calls the minting contract (makes the payment), the minting contract calls the SNIP721 contract to mint 3 different cards.
- For each card, the skills are calculated by a PRNG event (4 different PRNG is created for each card). The skills then set the rarity for the card.
- Players can view all their heroes
- Players can select which hero they want to use in battle
- Players see their battle history
- There is a battle arena where players can battle their heroes against 2 other players (3 players total in a fight)
- When players enter a battle, they send their card into a battle contract and wait for 2 other players to join
- When 3 players are in the battle, the contract randomly chooses 1 of the 4 skills to evaluate the battle on. This is shown in the UI, along with the players name (secret network address) and the battle begins (might be animated)
- The card with the highest point for the chosen skill wins the battle. The winning player takes all other NFTs in the fight. i) If there is a tie, the sum of all skills determines the winner. ii) If there is a tie, the game is a tie and all cards are returned to all players
- When the fight ends (battle_history_query): i) Player is shown the skill that’s chosen for the fight ii) If a player won, they’re shown their hero and all the heroes they won. iii) If a player lost, they’re shown the skill level of winning card for the chosen skill + the card they lost Each step in this process should have a 2-3 block delay so that there’s an excitement element