/AI-Treasure-Island

A choose your own adventure game that utilises AI in order to create and control the adventure. Makes the story unique every playthrough.

Primary LanguagePythonMIT LicenseMIT

AI Treasure Island

This is an AI choose your own adventure game in which you are marooned on a desert island and have to explore the island in order to proceed through the adventure. This game represents the future posibilites in implementing AI in the narative of video games and creating unique experiences for the players.

- Once the user boots the program they are met with an empty screen in which to greet the AI. The AI will then proceed to write a story and offer the user choices.

- The code performs the following;

  • Creates the pygame window
  • Draws the swirling artwork onto the page.
  • Accepts the user input which is represented at the bottom of the screen
  • Sends the user input through the AI function which sends the question through the OpenAI API along with the context for the question.
  • The AI has also been instructed to construct ASCII art wherever possible along with its narative in order to provide additional immersion to the user.
  • This then returns the answer from the API and represents it on screen.
  • The question and the answer are stored in a dictionary for context for the AI to continue the story whilst remembering what has already occured.

SPACE SPACE SPACE SPACE

This program has been constructed using my GPT API Key however, you will need to generate your own key and add the key to your working enviroment using terminal commands. Please see the OpenAI guide on this for details: https://platform.openai.com/docs/quickstart?context=python.

An example of how this program would work would be to go to OpenAI, purchase a small amount of API credit and then use your secret API token in the terminal using command:

'export OPENAI_API_KEY='THIS WILL BE YOUR KEY'

Please see above GPT guide in regards to setting your key into your system files if required.

GitHub Logo