Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

seangeng/based-adventure

Open more actions menu

Repository files navigation

Base Quest

This is an experimental Farcaster frame app for an AI text-based adventure powered by the Base L2. Base Quest is still a work in progress and subject to change.

Base Quest Splash Screen

Want to play?

Follow me on Farcaster for the latest game link: https://warpcast.com/seangeng

Features

  • AI Driven Gameplay ✅
  • Leaderboard ✅
  • Option to continue vs start a new game ✅
  • Issue Character NFTs on Base & save state to them ✅
  • Notifications
  • Character attributes
  • Game backgrounds & environments (✅ testing)
  • $EXP Tokens
  • Character profile links & PvP (✅ testing)
  • Multi-player quests

How it Works

Technical Diagram

This high level diagram explains the frame states & how menu actions are managed generically. Buttons can be passed to the menu in the GET parameter, and map to the business logic - essentially acting as a router.

Several awesome SDKs & frameworks are leveraged to accelerate developement:

Coinbase OnChain Kit: For frame helpers & future onchain actions.

Neynar: Making it easy to interact with Farcaster

OpenAI: For chat completions & image generation.

Inngest: For executing background jobs (there is latency when generating images + certain onchain actions)

Vercel: For hosting, and easy programmatic OpenGraph image generation:

Basic AI Workflow

Base Quest uses the OpenAI GPT 3.5 Turbo model to narrate & continue the storyline. That means each user's journey is completely unique!

Check out the /src/app/api/prompt/route.tsx file to see how the AI prompt loop works:

  1. AI generates the prompt & button options
    • system: You are the narrator in a choose your own adventure text-based game.
    • The user is a {class} starting their first adventure.
    • Write a character narration prompt (up to 100 characters), and present the user with either 2 or 4 action options to continue the story.
    • Action options should be either emoji(s) or short button text (up to 14 characters)
    • Return a JSON response like so: { }
  2. Present options as next frame og:buttons
  3. Feed the previous prompt & user selected action to the next prompt screen

Onchain Interactions

To avoid timeouts and for better resiliency - Inngest is leveraged to run serverless jobs async & in the background. This pattern has better monitoring, auto-retrys, and decouples business logic from the frame rendering.

Check out /src/app/inngest/functions.tsx to see how this works.

We use the InstaMint.sol contract - developed by my team at Coinbase & optimized for gas & ease of use! The NFT factory contract is available at: Sepolia Testnet: 0x4d64cAc5Bd09c7CaC9748D1E5a63A30Ee40B6A40 Base Mainnet: 0x85db63af3f0cfac7813abb4dfca6d713e937a5dd

Want to build onchain?

The future is onchain. Does this interest you? Do you think you can do better? Coinbase hires the top 1% of developers - reach out to me for a possible referral: https://www.linkedin.com/in/seangeng/

About

Farcaster Frames Text-based Adventure on the Base L2

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.