Making-of for my GPT-generated game
Hello guys,
Here's a step-by-step guide on generating content with GPT's API for your game:
1. Familiarize Yourself with OpenAI: Visit platform.openai.com or chat.openai.com to interact with GPT 3.5 and GPT 4. There is a cost involved, but you'll gain valuable experience with these advanced AI models.
2. Understand OpenAI's GPT API: Review the documentation at [OpenAI's API Reference](https://platform.openai.com/docs/api-reference). Remember, an API is an online resource that you interact with using code (we'll be using JavaScript in this case).
3. Prepare Your Environment: Install Node.js to execute JavaScript scripts, and use npm (Node's package manager) to install 'axios', 'json', and 'openai' modules in your command-line interface (CLI).
4. Generate Background Information: Using chat.openai.com, generate background details for each character and geography location.
5. Create a Summary: Generate a summary of the 100 nodes (story points) you will produce on chat.openai.com. This summary includes 10 major plot points from start to end. Use the background details you generated previously for this process.
6. Generate Detailed Nodes: Now move to platform.openai.com/playground. Select GPT4 as your model from the dropdown. Paste the background and the summary of each 10-node pack into the input field. Instruct the AI to generate 10 detailed nodes per query in a JSON format based on this information.
7. Prepare Your JSON Files: Transform the generated nodes into a valid JSON array and save it in a .json file. Each node in this file will follow this format:
8. Create Dialogue and Narratives: Download and run the 'gpt4summaries' and 'gpt4narratives' scripts to create dialogue and narrative prose within the JSON files. You'll need to replace the character backgrounds in these scripts with the ones you generated.
9. Run the Scripts: Use the 'node' command in your CLI to run 'node gpt4summaries.js'. This will separate the JSON array into 100 individual files, with each file representing a narrative node. Then, run 'node gpt4narratives.js'. This script will process each JSON file located in the "purelist" folder and add a "text" attribute which will contain 2 paragraphs of narration derived from the node's existing summary. If the script crashes because of limitations, don't panic and just re-run it as it will skip the nodes that have already been processed.
10. Input Your API Key: For both scripts, you will need to input your OpenAI API key found on the OpenAI platform.
11. Import into Unity: Import these JSON files into Unity and display the text using Unity's Text/TextMeshPro. More details about this process will be provided later if people are interested.
This guide should help you generate AI-created content for your game with OpenAI's GPT models. More steps might follow to fully integrate this content int he game engine.
Files
Dreams of Draco
Text-based Adventures generated by GPT's revolutionary AI
Status | In development |
Author | Lywald |
Genre | Interactive Fiction |
Tags | artificial-intelligence, Fantasy, Indie, Singleplayer, Story Rich, Surreal, Text based |
Leave a comment
Log in with itch.io to leave a comment.