AI Text Game Generator is a web-based platform designed to automatically generate text-based games for both game creators and players. By leveraging AI agents, the platform streamlines the game creation process and offers an engaging experience for players. The core functionalities include generating game concepts based on user inputs, providing illustrative images for games, and allowing players to select and play generated games.
- Simplify Game Creation: The platform aims to simplify the game creation process by automating the generation of game concepts and providing supporting imagery.
- Enhance Player Experience: For players, AutoGame Generator offers a diverse range of text-based games with accompanying images, enhancing immersion and enjoyment.
- Utilize AI Technologies: Leveraging AI agents like Stability AI and Coophive, the project demonstrates the potential of artificial intelligence in creative endeavors such as game development.
- Visit the AI Game Generator website.
- Input the game title, description, objectives, and context (or setting) for the game.
- The AI agent will generate an image for the game based on the provided title using Stability AI.
- Another AI agent will generate the game content based on the input provided.
- Review and refine the generated game as needed.
- Access the AutoGame Generator website.
- Browse through the available games or search for specific titles.
- Select a game to play.
- Each step of the game will contain an illustrative image generated by an AI agent using Coophive.
- Follow the prompts and make choices to progress through the game.
- Enjoy the immersive experience and engage with the storyline.
- FastAPI
- MongoDB
- OpenAI
- Huggingface
- Stability AI
- Coophive
- React
- Python 3.10
- Install the following dependencies
pip install -r requirements.txt
- Set up file
.env
containing the following variables
HUGGINGFACE_TOKEN=<your huggingface token>
OPENAI_API_KEY=<your openai api key>
MONGODB_USER=<your mongodb user>
MONGODB_PASSWORD=<your mongodb password>
AUTH_USER=<your auth user>
AUTH_PWD=<your auth password>
STABILITY_KEY=<your stability key>
Note:
- The
AUTH_USER
andAUTH_PWD
are used for the FastAPI authentication. You can use any username and password. But they should be included in the Authorization header.
python app.py
GET /
: Return "Hello World" to check if the server was started successfullyPOST /make_move
: Make a movePOST /games
: Create a new gameGET /games
: Get all gamesGET /games/{id}
: Get a game given an id
Request body
id
: The id of the gamemsg
: The message from the user.- If the message is empty, we start the game.
- If the message is
q
orexit
, we end the game
Example
{
"id": "65ecb118cfae096591875b53",
"msg": "hello"
}
Response
message
: The response message from the AIimage_prompt
: The image prompt from the AI to generate an image for the messageis_finished
: Whether the game is finished or not
Example
{
"message": "You wake up in the middle of a dark and eerie maze, with no idea how you got there. The walls are tall and made of cold stone, with twists and turns in every direction. You can hear the sound of your own heartbeat echoing through the corridors. \n\nAs you start to explore, you come across a fork in the path. To your left, you see a dimly lit corridor with strange markings on the walls. To your right, you hear the faint sound of running water. \n\nWhat will you do next? \n1. Go left \n2. Go right",
"image_prompt": "Dark maze fork",
"is_finished": false
}
Request body
title
: The title of the gamedescription
: The description of the gameobjective
: The objective of the gamecurrent_setting
: The current setting of the gamecreated_by
: The creator of the game
Example
{
"title": "Maze runner",
"description": "A text game to escape from a maze",
"objective": "Escape the maze to find the treasure in the end",
"current_setting": "You are stuck in a maze. There are a lot of obstacles",
"created_by": "duybuile"
}
Response
id
: The id of the game
Example
{
"id": "65ecb118cfae096591875b53"
}
MIT