D

Dodging Turtis

May the fastest turtle win

The problem Dodging Turtis solves

NFTs and Gaming

Games, in general, are fun to play and our game “Dodging Turtis” is one of them. This game can improve your reflexes as it can get really challenging. Furthermore, you can also earn money by selling your Turtle NFTs in our own marketplace. When we think of NFTs, the first applications which spring to anyone’s mind are usually collectibles and gaming. One of the most powerful things about NFTs is their ability to fundamentally change digital ownership. Until now, we’ve never really owned the digital items that we purchase. We purchase in-game items/abilities and treat them as our own, but the reality is that they don’t belong to us, they belong to the game publishers. If it gets shut down tomorrow, all of your in-game items will disappear forever. The beauty of Game and NFT collectibles is that their ownership is not managed by their centralized creators, it is managed via smart contracts in a decentralized fashion. This means that even if our game “Dodging Turtis” gets shut down or censored, your rights to transfer or sell your turtle will, in theory, still remain intact.
On top of this, game items have never been truly unique before. With NFTs, we have the ability to create items that are differentiated, have their own characteristics and provenance. “Dodging Turtis” mints unique Turtle NFTs every time a user achieves a new checkpoint. Depending on how high the checkpoint is, a speed is generated for the Turtle NFT which is then stored as a trait-type in the NFT’s metadata.

Moving beyond gaming

  • Every Turtle NFT’s shell has a unique pattern that represents India’s traditional art patterns.
  • Ultimately ERC721, the standard governing the implementation of NFTs, is so broad that it can encompass an unlimited range of different applications. During our discussion, we touched upon numerous different use cases, from using NFTs to represent real estate, IP rights, licensing, and even to represent living things.

Challenges we ran into

Last month's EthOdyssey hackathon was a great learning experience. We all are from different parts of India. Through the collective effort of every team member, we were able to build something great. Some of the challenges we faced are mentioned below.

  • We as a team didn’t have any experience with game development and we were not aware of any tools for making games so, it took time for us to get a hold of game development using Phaser.
  • Furthermore, randomizing the Turtle image/character for the NFT was a hurdle. We overcame it by building a custom API. We used image blending of different components to create a random turtle.
  • Storing the images in IPFS using a custom API was a bit challenging task as well. We used nft.storage to store the NFT metadata to Filecoin and IPFS.
  • Getting the IPFS hash into the smart contract using chainlink was a toiling assignment. We overcame it by creating 2 different endpoints in the Custom API which split up the IPFS Hash into 2 parts. From the smart contract, we made 2 API calls to fetch the IPFS Hash as only 32 bytes of data can be retrieved using Chainlink Oracles for a single GET request whereas the IPFS base32 hash had 59 characters.
  • The deployment of a smart contract to Matic Mumbai Testnet was a bit challenging as we could not find the appropriate node which provides an RPC URL. We ended up using Alchemy which was really cool.
  • We had other issues while migrating the smart contract. We couldn’t figure out what the error was for a while. We later noticed that we were using the same Chainlink Oracle and Job ID used for Rinkeby TestNet. We solved this problem by using an Oracle named LinkRiver which provided a job to use GET requests from an API to fetch bytes32 data.
  • Properly ending the game and mint a new NFT from the dApp, resolving Metamask RPC errors and the rate-limiting of the IPFS gateway were some other problems that we tackled.

Discussion