Inspiration

The combination between EVM and Cosmos-sdk made possible a whole range of projects which weren't possible before. Games with significant logic on-chain can now be played at a much higher speed, unlocking new opportunities.

What it does

The player starts with an "uncovered" matrix of tiles. Underneath, tiles are grouped in pairs of two (In the hackathon MVP, the pairing is between colors: we have pairs of green, red, blue, etc tiles. But in the real game I plan to have different visual symbols, like dice, letters, hexagrams).

A game turn consists in the flipping of two tiles. The game sends a request to the chain, which, upon a successful transaction, sends back the "uncovered" tiles. If the tiles are matched, they remain uncovered. If the tiles don't match, they are shown for a brief period of time (so the player can memorize them) then they are flipped back.

There is an element of randomness which should increase engagement: there is no upfront guarantee the matrix is solvable. To prevent the inspection of the "uncovered" tile, we don't actually have one on chain. Instead, at each flipping transaction, the smart contract generates two random numbers, in the interval of the possible tiles (if we have only 4 possible colors, in the interval 1-4, if we have 8 possible colors, in the interval 1-8, etc). After the numbers are generated, they are stored on chain, but the remaining "tiles/numbers" are never shown.

If the matrix is solved, meaning all tiles are uncovered, the result is made into an NFT, which is now belonging to the player, proof that he completed a game.

We start with 4x4 matrixes, and, after 8 solved games, we advance at 8x8 matrixes. All subsequent levels will not use primary visual symbols (colors, in this case), but the previously solved matrixes, as NFTs. So, instead of 8 pairs of basic colors, the player should memorize one of the 8 previously solved matrixes.

More info is available in the Github repo, under docs/Game Mechanics.

How we built it

The initial version was built in JavaScript, to test various parts of the algorithms. Then we moved to Solidity smart contracts, using hardhat as tooling. UI is built with React.

Challenges we ran into

The initial deployment of smart contract was challenging, especially because lack of informative error messages from MetaMask.

Accomplishments that we're proud of

Porting a JS game in Solidity, with all the quirks of the blockchain programming paradigm.

What we learned

A lot of stuff related to:

  • wallet integration with JS clients
  • random number generation in Solidity and its limitations
  • general coding in Solidity (not token / transfer related, that is)

What's next for Flippando

Should the project continues, there are quite a few hurdles that needs to be tackled:

  • improve randomness generation in Solidity
  • make a final resolution about the solvability of the game: do we keep the possibility of matrixes to get stuck, or do we implement on chain mechanisms for enforcing solvability
  • add utility tokens . . .
  • go live

Built With

Share this project:

Updates