Inspiration

We wanted to make an NFT game that was easy to play, had a low barrier of entry, and could be played quickly.

What it does

We have users sign in using an external wallet or their email address. After users sign in, we have them mint a cosmie to play with. Each cosmie has its set of perks. Some are better at attack and some have stronger defense. We then have players play against each other. If a player loses, then their cosmie gets burned.

How we built it

Our tech stack uses NextJs, Typescript, React, and Vercel to create and host the game. To sign in using an external wallet or email, we are using WAGMI. For the game engine, to calculate the "damage" of an attack, we are using ChainLink VRF to generate a random number. We also leverage Supabase to connect two players for a match and store user battle information. To connect and interact with our smart contracts, we used Viem.

Challenges we ran into

One of the biggest challenges we ran into was how long it took to get data back from our smart contracts. We were able to mitigate this by pre-calling the contract before starting the actual game. The other challenge we ran into was connecting two players and sending data between them. We solved this by leveraging Supabase to act as a WebSocket manager.

Accomplishments that we're proud of

We deployed our first ERC721 contract, which allows you to mint multiple of the same NFT. Using Chainlinks VRF to add actual randomness to our game.

What we learned

We learned how Chainlink VRF works, and how to better use Chainlink and OpenZepplin libraries.
The best way to create and use WebSockets leveraging Supabase, and how to work with Next.js. We also gained a lot of experience working with Web3 tools such as Viem.

What's next for Cosmies

We have a lot of ideas for what we can do next! With no priority, some ideas we want to implement are

If a player wins, they get a cosmie upgrade; meaning that their NFT is stronger in the next game. We want to make it gasless so that it is very cheap to mint an NFT. A leaderboard of the player with the most wins Add more Cosmie characters that users can mint and play with Gain experience with each win Create an NFT evolution, after a specific number of wins and gaining experience, your Cosmie will evolve Make the game engine more robust and dynamic

Built With

Share this project:

Updates