Hello! This has been a side project for a few months now. I thought it would be fun to make a fully AI-generated game and it was, haha. Here's the journey so far:<p>I prototyped this in ChatGPT by prompting it to be an adventure game. It worked great but was limiting as it was constrained to just the ChatGPT interface and no expanded features were possible.<p>The next move was to make a web UI for it and add action buttons. I initially avoided using the function calling features and had GPT-4 just return <button> tags but obviously that broke pretty quickly (worked to prototype though!). So function calling it is! It now generates 1) the next game turn text, 2) an optional list of buttons for actions the user can take and 3) an optional image prompt for DALL-E to visualize the turn all in one API call.<p>The tech stack is flask/python, sqlite, ubuntu, gunicorn, nginx and html/css/javascript. I'm an Android developer and don't make a lot of websites. So ChatGPT wrote nearly all the code for this game, with me making only modifications and bug fixes as we went along. I learned a lot about basic sysadmin (and vim!) along the way<p>Someone asked me in a thread for some specific examples of how the prompting would look. So here you go! This prompt isn't perfect and still WIP. This is specifically the function calling prompt - a simpler one is used when function calling isn't needed (if the user disables buttons/images).<p><pre><code> messages = [
{"role": "system", "content": "You are an adventure game. Continue the game and respond only withthe text adventure game data. Make sure some action happens in each turn and make sure the game isn't too easy; problems should occur that the user has to solve. Make sure the game stays more sci-fi than fantasy. Keep it nerdy but still accessible to mainstream audience. Don't write too long of responses, but give yourself enough room to write in detail. Generate the next turn in an adventure game. This must include content for 1) the game turn text, 2) the action buttons, and 3) the prompt for DALL-E to make an Image for the turn. For the action buttons, give the player a few options for their next steps. Keep the list items' text short and actions should be written from the perspective of the player. Use function calling. Make sure to include all 3 elements: turn text, 2-4 creative and varied action buttons, and a detailed yet concise and sci-fi image prompt for visualizing the turn. Stay in-character as the game itself, and refuse unrelated queries."},</code></pre>
]<p>The games' opening lines/prompts are also generated - but manually with ChatGPT-4. I have it generate the json that matches my db schema so I can just copy and run it. This is ripe for fast-follow: generate new games on the fly! I'd like to make tags and incorporate user prompts to generate you custom games!<p>The game requires an account to play (free) since the costs will add up and my rate limits will get hit. Each turn in the game costs you 2-6 "space gold" depending on your settings. For today I'm giving every new user 50 space gold when you sign up so that you can try out the game. 1 space gold = 1 US penny ($0.01). And you can get more space gold by inviting friends to sign up or buying it directly.<p>So what do you think about it? Please do let me know any constructive criticism as I'm launching too early it feels like!
Some extra context that didn't fit in the description above:
Each game turn picks an OpenAI model to use - runs on a different GPT model depending on my rate limits, current usage, etc. Interestingly I haven't found much difference in game quality between GPT-4 and GPT-3.5. IMO the coding quality is dramatically higher in 4 but 3.5 seems more than capable for this game. There's no UI switch for you to choose your model yet but I plan on adding something like that soon.<p>The site I'm launching this on is a Space / AI experiment site. The main page is DALL-E images generated from prompts that are generated by GPT-4, for example. I am hoping to add more fun new experiments like a constant GPT-4 conversation where multiple agents with different specializations talk to each other about space exploration (ie, "You're an astrophysicist talking to a rocket enginner and a biologist about exoplanet exploration" etc).<p>About the image generations: Unfortunately DALL-E 3 API access isn't open yet (Monday?!) so the image quality is less than what you'd hope for - but that should change soon. Also, my GPT-created image prompts for the visualizations by DALL-E are not great. I think it's currently only reading the last turn in the game to make the prompt, so there is not much hope at continuity. Working on using one of the larger-context GPT-3.5 models to generate better image prompts (I don't have GPT-4 32k context access yet)