An AI-powered interactive fiction and storytelling engine that brings characters to life through dynamic conversations and objective-driven gameplay.
- Gamified Experience: Blends traditional AI chat with structured gameplay. Your actions are constantly evaluated against specific story objectives you must complete to advance the narrative.
- Autonomous Character AI: Every character possesses their own distinct personality, independent thought process, and unique way of analyzing and reacting to the evolving situation.
- Dynamic World State: The environment naturally shifts around you as time passes, scenes transition, and characters autonomously decide to enter or leave your current location.
- Python 3.10+
- Google Gemini API key
- Clone the repository:
git clone https://github.com/Jit-Roy/The-Endless-Tale.git
cd "The Endless Tale"- Install dependencies:
pip install -r requirements.txt- Create a
.envfile in the root directory and add your Google Gemini API keys. The system uses two separate keys to allow parallel processing between character responses and background narrative tasks:
GOOGLE_API_KEY=your_primary_api_key_here
BACKGROUND_GOOGLE_API_KEY=your_background_api_key_here
(Note: You can use the same key for both, but using two different keys helps avoid rate limits during heavy parallel generation).
Simply run the app script to launch the graphical interface:
python app.pyYou can easily build your own dynamic adventures!
Create a new folder in the root directory named after your story (e.g., Space Odyssey). Inside this folder, create two subfolders:
characters/story/
Inside the story/ folder, create a single JSON file (e.g., main_story.json). This file outlines the narrative progression:
{
"title": "Space Odyssey",
"description": "A journey to the stars.",
"objectives": [
"Wake up from cryo-sleep",
"Fix the main engine",
"Navigate the asteroid field"
]
}Inside the characters/ folder, create a separate JSON file for each character (e.g., captain_smith.json). This gives the AI personality and context:
{
"name": "Captain Smith",
"traits": ["Brave", "Strategic", "Stern"],
"speaking_style": "Authoritative and concise.",
"background": "Veteran of the Galactic War.",
"relationships": {
"Player": "Loyal crew member"
},
"goals": ["Ensure the safety of the ship"],
"knowledge_base": ["Ship schematics", "Galactic history"]
}The system will automatically detect your new story and characters the next time you run python app.py!
Response Time Expectation: Because the system manages an intricate, dynamic world—evaluating heavy narrative context, tracking objectives, and generating parallel decisions for autonomous character behaviors—API calls are computationally intensive. On average, it takes about 40 seconds for a new message to appear in the UI. Please be patient while the engine computes the next phase of your story!
Contributions are welcome! Feel free to submit issues or pull requests.
This project is open source and available under the MIT License.

