Overseas access: www.kdjingpai.com
Ctrl + D Favorites

AI-Gamble is an interactive fiction game platform based on Large-scale Language Modeling (LLM). It generates unique storylines, characters, and visual story line diagrams in real-time based on the player's chosen story genre (e.g., Eastern Fantasy, Western Magic, etc.) through artificial intelligence technology. Players can experience immersive branching narratives and explore multiple story endings through simple choices. The project uses FastAPI backend, Vanilla JavaScript frontend and Mermaid.js to render the story structure map, supports Docker deployment, and is suitable for users who like interactive storytelling and AI technology. The whole system is designed to be efficient and easy to operate, suitable for quick start.

Function List

  • Dynamic Story Generation : The AI generates openings, developments and multiple endings in real time according to the type of story chosen by the player, supporting a variety of literary styles such as Eastern fantasy and Western magic.
  • Randomizing Writers and Works : Each time a new game is played, the system randomly generates virtual "authors" and "book titles" that match the type of story, increasing the sense of fun and immersion.
  • Visual story line diagrams : At the beginning of the game, a story structure map is generated and displayed on the front-end via Mermaid.js, so that the player can visualize the story branches and endings.
  • branching narrative : Each choice made by the player changes the direction of the story, leading to different plots and endings, enhancing interactivity.
  • Dynamic Writing Style : AI Adapt the narrative style to the type of story, e.g., ancient or fantasy, to enhance immersion.

Using Help

Installation process

AI-Gamble is a Docker-based project that is easy to install and suitable for local running. Here are the detailed installation and usage steps:

precondition

  • Install Docker and Docker Compose.
  • Prepare a valid OpenAI API key for invoking the AI story generation service.

Configuration environment

  1. Creating an environment variable file ::
    • Project use .env file to store sensitive information, such as OpenAI API keys.
    • In the project root directory, copy the provided example files:
      # Windows
      copy .env.example .env
      # macOS/Linux
      cp .env.example .env
      
  2. compiler .env file ::
    • show (a ticket) .env file, fill in your OpenAI API key.
    • Modify other configurations as needed, such as database connection information or Redis settings.

Initiation of projects

  1. Getting the service up and running ::
    • In the project root directory, run the following command:
      docker-compose up --build
      
    • This command pulls the required images, builds and starts the FastAPI backend, Redis and other services.
  2. Compile front-end styles (optional) ::
    • If you need to modify the Tailwind CSS styles, open a new terminal and run it:
      npm run build
      
    • This command listens for and compiles front-end style files in real time. tailwind.cssThe
  3. Access to applications ::
    • Open your browser and visit http://localhost:1888The
    • Once the page loads, you'll be presented with the main game screen, where you can select the story type and start the game.

Discontinuation of services

  • check or refer to Ctrl+C Stop the Docker container.
  • If you need to clean the container, run:
    docker-compose down
    

Usage

Start new game

  1. show (a ticket) http://localhost:1888, enter the main game screen.
  2. Choose the type of story (e.g. "Eastern Fantasy" or "Western Magic").
  3. Click the "Start" button, the system will call the AI to generate the initial scene, virtual writer, book title and story line map.
  4. The interface displays the story's opening content and the story structure rendered by Mermaid.js, showing potential branches and endings.

play

  1. Read a text description of the current scene.
  2. Follow the prompts to choose an option (e.g. "Enter the forest" or "Talk to the mystery man").
  3. After submitting your choices, the AI generates the next section of story content based on your decisions, and the interface updates to show the new scene.
  4. The story line map dynamically highlights the branch you are currently on, making it easy to track the progress of the story.
  5. Keep choosing until the story reaches a certain ending.

View story line map

  • In the game interface, Mermaid.js renders a story line diagram showing all possible branches and endings.
  • Click on a node in the graph to preview a brief description of the corresponding scenario (if supported by the API).
  • Charts help players understand the impact of choices on the direction of the story.

Managing Game Sessions

  • Create a new game : By POST /api/v1/game Create a new game and get the initial scene and story map.
  • Submit Selection : Use POST /api/v1/game/{game_id}/choice, submit the player's choice for the next scene.
  • View Status : By GET /api/v1/game/{game_id} Get Current Westhaven AI-Gamble: dynamically generated interactive fiction game
0Bookmarked
0kudos

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

inbox

Contact Us

Top

en_USEnglish