C

CeloPatti

A fun card game built using React Native and Celo

The problem CeloPatti solves

CeloPatti is a fun card game that is in its very initial stage in terms of UI,UX and game logic due to the limited time constraints of the fellowship. But the main motive was to make the celo ecosystem draw its attention towards games and the possibilities they can bring with them. Most of the blockchain based games at present are mainly focused on the web based platforms. Being mobile first platform, Celo has native support to the mobile apps with Celo Dappkit and valora wallet. Also what I came across was ,there were no any games being built on celo ecosystem at the point of writing this( Note: CeloHub was taken as the reference store to search the apps). Games possess high potential in bringing more users to the platform. The icing over the cake is the low transaction fees and fast block times of the Celo blockchain which helps to make the platform an ideal choice for building various kind of fun games.

Coming to the features of the game, the first thing is that it is fully decentralized in the sense that it is solely powered by blockchain smart contract only. The architecture is kept simple, and no any intermediate centralized API's are used in between.Instead more effort is put forward in writing smart contract and putting up definations for various kinds of events there.

Talking about the other feature, the game is powered by real time websockets updates. Effective state management and websockets listeners are implemented in app that listens to blockchain events and provides real time notifications about the enrollment of players in game room and the winner being picked.

Challenges I ran into

A lot of the development time was spent writing the smart contract for this game. The smart contract consists of a factory contract that keeps the records of all the game rooms created and the game room contract itself. So, it was hard to decide on what functionalities to keep and what events to define to make the game possible. Also, I faced some trouble implementing the IERC20 interface for celo stable token in the smart contract, especially the testing part. Luckily, I came to know about the celo plugin for the remix which made my testing process really simpler. After being done with the smart contract, I was stuck for a while for implementing the successful event listeners for the game. After some search, I found the event listener script written by crites Josh ( developer at cLabs) that uses the websocket endpoint for celo blockchain.After some testing, I was able to successfully implement the event listeners in the app. The third challenge was to maintain the effective state management in the game. As I am pretty new to the react native ecosystem, I do not know much about it. I had to learn Redux for it , that somehow took a considerable amount of time, but at the end I was able to achieve what I was planning for.

Technologies used

Discussion