A customizable Generative AI Adventure Game.
- 🪄 Everything generated on the fly: story, images, & music
- 🎭 Swappable generative models
- 📱 Mobile-first layout
- 💰 Payment-ready
- 🚀 Sharing-ready -- share generated adventure storybooks on Twitter
This game uses:
- Clerk for authentication
- Vercel for web hosting
- Steamship for AI hosting
- Stripe for payments
- FAL.ai for Stable Diffusion hosting
- Civit.ai for hot-loaded Models & LoRAs
- OpenAI for LLM hosting
- Replicate for Music Generation
- Shadcn for ui
This README contains the following sections:
- Deployment - Takes about five minutes to be up and running!
- Running on Localhost - Run the game on localhost.
- Customization - Skin the game with custom models, prompts, and themes.
- Advanced Customization - Modify and re-deploy the game engine itself.
- Learn More - Links to our development community
Important! After your initial deployment, you'll need to configure your database
Once you have access to the environment variables you'll need, deploy the example using Vercel:
- Create an account with Clerk
- Create a new project
- Set the following env vars in Vercel
CLERK_SECRET_KEY=YOUR_CLERK_SECRET_KEY
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=YOUR_CLERK_PUBLISHABLE_KEY
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
STEAMSHIP_API_KEY=YOUR_API_KEY
- From Vercel, open your new project and select the "Storage" tab
- Create a new postgres database
- The environment variables should be automatically set now within vercel. You can verify this by navigating to project settings > environmental variables > looking for postgres related env vars.
More on setting up your database can be found here: https://vercel.com/docs/storage/vercel-postgres/quickstart.
We use prisma to manage database updates, and @vercel/postgres for running queries
- Install the vercel cli
npm i -g vercel
- Install repo dependencies
npm i
- Connect to Vercel
vercel link
. Follow the prompts to connect to the project you just created - Generate the prisma types:
npx prisma generate
To update the production DB:
vercel pull --environment=production
- Create the tables in the DB:
npm run prod:db-push
TO update the development DB:
vercel pull --environment=development
- Create the tables in the DB:
npm run dev:db-push
After configuring your production database. Make sure to re-deploy your project.
You can do that by navigating to your project in Vercel and clicking the redeploy option.
The game gives each user monthly free "Energy" to quest with, and offers paid plans to get more.
Get a Stripe API Key at stripe.com and then set the following environment variables:
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
- Your Stripe publishable keySTRIPE_SECRET_KEY
- Your Stripe secret keySTRIPE_PRICE_ID
- The Price ID of your monthly subscription planSTRIPE_TOPUP_PRICE_ID
- The Price ID of your one-time top-up itemSTRIPE_WEBHOOK_SECRET
- The Webhook secret for Stripe EventsNEXT_PUBLIC_WEB_BASE_URL
- The base URL of your deployment, without a trailing slash
If you don't set up Stripe, the game will still work, but players will have no way to add energy once it is depleted.
This game uses Axiom for cloud logging.
Get an Axiom API Key at axiom.co and then set the following environment variables:
NEXT_PUBLIC_AXIOM_TOKEN
- Your public Axiom tokenNEXT_PUBLIC_AXIOM_DATASET
- Your Axiom logging dataset
This game uses Vercel Analytics for user tracking.
Get a Vercel Analytics ID from your Vercel project page, and then set the following environment variables:
VERCEL_WEB_ANALYTICS_ID
- Your Vercel Analytics ID
To run on localhost:
Install the required dependencies:
npm install
Make sure your .env.local
file is set:
TODO(ted) - what's best practice for this?
Run the development server:
npm run dev
Then open http://localhost:3000 with your browser to see the result.
The non-generative portions of the Game UI are all contained within this NextJS project.
You can start exploring by looking at the pages in app/pages
.
When running on localhost, your browser will update automatically when you edit and save a file.
TODO: Document configuration/
The generative game engine is a separate open-source project deployed to Steamship. It maintains most of the game state -- this web app is mostly a headless client.
By default, this Vercel project is configured to use Steamship's officially supported version of the game engine.
If the modifications you with to make are beyond the provided settings of the official engine, you can easily fork, change, deploy, and use your own. Just follow these steps:
- Fork the game engine repository
- Make any modifications you wish.
- Deploy it as your own Steamship package (
ship deploy
) - Change the
STEAMSHIP_AGENT_VERSION
environment variable in this Vercel project to match your own game engine's handle. If you want to pin it to a specific version, usehandle@version
format.
Note
This agent is under very actively development. We suggest focusing your changes on quest_agent.py
Please join our our discord to build-test with us!
This is an open source effort -- come join our quest!
- Email us! support [at] steamship [dot] com.
Related Repositories:
- Web Interface The web interface is at steamship-core/ai-adventure
- Game Engine The game engine is at steamship-core/ai-adventure-agent
curl -i \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer PASSWORD" \
https://staging.ai-adventure.steamship.com/api/cron/curate-available-agent-pool