Intro
Ever since @_4DHD_ launched thebutton.press, I have been thinking about different concepts for onchain games. The game was just a big button on the screen with a timer, and here were the rules:
The timer starts at one hour. Each press resets the timer and subtracts 1 second. The minimum timer is set at 1 minute.
0.001 ETH to press.
Last person to press the button before it hits zero wins all the ETH.
You could also earn 5% of ETH from each press made through a referral link shared by you. It went on for a day I think, and the winner got 13 ETH after pressing the button only 6 times. The dynamics of the game intrigued me. I loved how it grabbed people's attention for a short amount of time, although I thought it would've gone on for much longer.
I pressed the button a few times, and got an NFT for each press.

Since then, I've been thinking about the concept of infinite games that have some financial stake or upside. The idea of creating something that people can play and potentially make money from, forever, was intriguing.
Pong Genesis
Then last month I was driving to the gym, and as I always do on my drive to the gym, I had an idea. I had wanted to make a v2 Farcaster frame for some time, but was busy with other things and never thought of anything fun. Until that day, when I thought of the classic Pong game for some reason. It'd be in a v2 frame and with a USDC prize pool that players could add to and would win the whole pool if they got the highest score that day.

Building
A few days later I started building. First thing I did was add the Pong game to my website. Once I had the game going, I saw that @rev had relaunched Commit, an onchain accountability protocol. To keep myself accountable to building my idea, I created one for building a v2 Farcaster frame of anything you want in the month of February and 3 people have committed since then.
I had the game going on my website, then I just needed to figure out the frame meta tags and how to use the frame SDK to get the frame rendering in the feed. When frames v1 launched last year, I made a generative art frame that went viral (it still works). It let you click to generate (questionable) art based on your FID, and you could mint one if you wanted. 2k users (or bots) minted one. I expected the v2 frame meta tags to be something similar, but it was actually much simpler. I just had to create one JSON object with some details, and stringify it in my metadata.

Then I just added the frame SDK code in the top of my Pong file, and boom, it was rendering in a frame.

Now the Pong frame had context of the user who opened the frame and I could display the username, pfp and use the FID to send to my backend to store the scores. I launched the frame, and didn't understand why I couldn't add it (sometimes I don't fully read the docs). Then I learned about the Warpcast dev tools in the mobile app and how I needed to associate my domain that I was hosting the frame to my account so clients can verify that my FID does in fact own the domain. That also was very simple. Once that was done, people could add my frame, and I got the recast from the boss.

One mistake I made in building the frame, was not having notifications ready when I launched. I missed an opportunity to store tokens for early users to be able to send them notifications. Nonetheless, I have them set up now and users receive them when the prize pool is about to go out and also when someone adds $5 or more to the prize pool.

After the game was functioning and people could have the scores stored for the day, I added the crypto wallet. I had built web dapps before, and knew the standard process to follow for installing wallets. I got my Warpcast wallet literally a few days before adding the wallet to Pong. I was pleasantly surprised that there was nothing additional I needed to do in my code for adding a wallet to make the Warpcast wallet seamlessly work. With the wallet in the frame, the user can just click one button to connect.

And then to add to the prize pool with your Warpcast wallet, it's just one more click.

The game contract is on Base and the details of how the prize pool and daily payout works can be found on the Pong FAQ.
Side note: one thing I love about frames, is that the frame and web version can have different behavior. For example, the Pong game on web doesn't have the Farcaster user context, but if you connect your wallet you can still participate in the game and be eligible for the prize pool. So while your app is likely a better experience as a frame in the feed, it doesn't have to require a user to have a Farcaster account to participate. Web version below.

What's Next
Since launching a few weeks ago, Pong has been played 258 times by 180 unique users and 15 transactions have been made towards the prize pool. Since the prize pool has been live (for the last 9 days), it has been won by 3 different people. Mostly me, once by @netnose ($11), and once by @77luka.eth ($7). View the payouts on the contract.

On my next frame (spoiler alert - sudoku), I'll have the notifications ready on launch. I like the idea of Pong running forever. Maybe one day, Pong enthusiasts (is that a thing?) will find it, and start gambling high stakes with their friends. Until then, Pong is a nice addition to my website and a fun game I'll play.



- Loading comments...