GithubHelp home page GithubHelp logo

ai-text-game's Introduction

AI Text Game

Description

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.

Objectives

  • 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.

How to Play the Game:

Game Creators:

  1. Visit the AI Game Generator website.
  2. Input the game title, description, objectives, and context (or setting) for the game.
  3. The AI agent will generate an image for the game based on the provided title using Stability AI.
  4. Another AI agent will generate the game content based on the input provided.
  5. Review and refine the generated game as needed.

Players:

  1. Access the AutoGame Generator website.
  2. Browse through the available games or search for specific titles.
  3. Select a game to play.
  4. Each step of the game will contain an illustrative image generated by an AI agent using Coophive.
  5. Follow the prompts and make choices to progress through the game.
  6. Enjoy the immersive experience and engage with the storyline.

Dependencies

  • FastAPI
  • MongoDB
  • OpenAI
  • Huggingface
  • Stability AI
  • Coophive
  • React

Requirements

  • Python 3.10

Pre-requisites

  • 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 and AUTH_PWD are used for the FastAPI authentication. You can use any username and password. But they should be included in the Authorization header.

Usage

Start your server

python app.py

List of APIs

  • GET /: Return "Hello World" to check if the server was started successfully
  • POST /make_move: Make a move
  • POST /games: Create a new game
  • GET /games: Get all games
  • GET /games/{id}: Get a game given an id

POST /make_move

Request body

  • id: The id of the game
  • msg: The message from the user.
    • If the message is empty, we start the game.
    • If the message is q or exit, we end the game

Example

{
    "id": "65ecb118cfae096591875b53",
    "msg": "hello"
}

Response

  • message: The response message from the AI
  • image_prompt: The image prompt from the AI to generate an image for the message
  • is_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
}

POST /games

Request body

  • title: The title of the game
  • description: The description of the game
  • objective: The objective of the game
  • current_setting: The current setting of the game
  • created_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"
}

Contributors

License

MIT

ai-text-game's People

Contributors

duybuile avatar jstimpson avatar jamnic98 avatar

Stargazers

Bharath Babu avatar

Watchers

 avatar

Forkers

jamnic98

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.