Skip to main content

๐ŸŽฎ AI-Powered CLI Text Adventure Game - Create infinite stories with LLM

Project description

๐ŸŽฎ LLMAdventure - AI-Powered Text Adventure Game

PyPI version Python 3.8+ License: MIT Downloads Stars

Create infinite stories with AI-powered procedural generation ๐Ÿš€

LLMAdventure is the ultimate CLI text adventure game that uses Google's Gemini 2.5 Flash to generate unique, dynamic stories, worlds, and characters. Every playthrough is different, every choice matters, and every adventure is unforgettable.

โœจ Why Choose LLMAdventure?

  • ๐ŸŽฏ Infinite Content: AI generates unique stories, quests, and worlds
  • ๐ŸŽฎ Rich Gameplay: Combat, exploration, character progression, and more
  • ๐ŸŽจ Beautiful CLI: Stunning terminal interface with colors and animations
  • ๐Ÿ”Œ Extensible: Plugin system for custom content and mods
  • ๐ŸŒ Multi-Platform: Works on Windows, macOS, and Linux
  • ๐Ÿ“š Educational: Learn AI, game development, and storytelling
  • ๐Ÿš€ Fast: Optimized for performance and responsiveness

๐Ÿš€ Quick Start

# Install from PyPI
pip install llmadventure

# Start your adventure
llmadventure

That's it! No complex setup, no dependencies to manage. Just pure adventure.

๐ŸŽฏ Features

๐Ÿง  AI-Powered Storytelling

  • Dynamic Narrative Generation: Every story is unique and adaptive
  • Context-Aware Responses: AI remembers your choices and adapts the story
  • Procedural World Building: Infinite worlds with unique locations and lore
  • Character Generation: Rich NPCs with personalities and backstories

โš”๏ธ Rich Gameplay Systems

  • Combat System: Turn-based combat with strategy and tactics
  • Character Progression: Level up, gain abilities, and evolve your character
  • Inventory Management: Collect, use, and trade items
  • Quest System: Dynamic quests that adapt to your choices
  • Exploration: Discover hidden locations and secrets

๐ŸŽจ Beautiful Interface

  • Rich Terminal UI: Colors, progress bars, and animations
  • Responsive Design: Works on any terminal size
  • Accessibility: High contrast modes and screen reader support
  • Customizable: Themes and appearance options

๐Ÿ”Œ Extensible Architecture

  • Plugin System: Create custom content and mods
  • API Access: Integrate with other applications
  • Web Interface: Optional web-based UI
  • Multiplayer Support: Play with friends (coming soon)

๐Ÿ“– Examples

Basic Usage

from llmadventure import Game

# Start a new adventure
game = Game()
game.start_new_game("Hero", "warrior")

# Explore the world
game.move("north")
game.look_around()
game.attack("dragon")

Custom Plugin

from llmadventure.plugins import Plugin

class MyCustomPlugin(Plugin):
    def on_combat_start(self, player, enemy):
        # Add custom combat mechanics
        pass
    
    def on_quest_complete(self, player, quest):
        # Give custom rewards
        pass

Web Integration

from llmadventure.web import WebServer

# Start web interface
server = WebServer()
server.start(host="0.0.0.0", port=8000)

๐Ÿ› ๏ธ Installation

From PyPI (Recommended)

pip install llmadventure

With Optional Dependencies

# Full installation with all features
pip install "llmadventure[full]"

# Web interface
pip install "llmadventure[web]"

# AI/ML features
pip install "llmadventure[ai]"

# Data analysis
pip install "llmadventure[data]"

From Source

git clone https://github.com/llmadventure/llmadventure.git
cd llmadventure
pip install -e .

๐Ÿ”ง Configuration

API Key Setup

  1. Get a Google AI API key from Google AI Studio
  2. Set your API key:
# Environment variable
export GOOGLE_API_KEY=your_key_here

# Or in .env file
echo "GOOGLE_API_KEY=your_key_here" > .env

Configuration File

Create ~/.config/llmadventure/config.yaml:

api:
  provider: "google"
  model: "gemini-2.5-flash"
  
game:
  auto_save: true
  difficulty: "normal"
  theme: "dark"
  
ui:
  colors: true
  animations: true
  sound: false

๐ŸŽฎ Game Controls

Command Action Aliases
n, north Move north up, u
s, south Move south down, d
e, east Move east right, r
w, west Move west left, l
look Look around l, examine
inventory Show inventory i, inv
attack <target> Attack creature fight, hit
use <item> Use item consume, equip
talk <npc> Talk to NPC speak, chat
save Save game s
quit Quit game exit, q
help Show help h, ?

๐Ÿ—๏ธ Architecture

llmadventure/
โ”œโ”€โ”€ core/           # Core game logic (game, player, world, combat, inventory, quest, evolution, creature)
โ”œโ”€โ”€ engine/         # AI, LLM interface, memory, procedural generation, prompt templates
โ”œโ”€โ”€ cli/            # Command line interface (display, menus)
โ”œโ”€โ”€ utils/          # Utilities (config, file_ops, logger)
โ”œโ”€โ”€ plugins/        # Plugin system
โ”œโ”€โ”€ web/            # Web interface (if enabled)

main.py             # Entry point
requirements.txt    # Python dependencies
pyproject.toml      # Build system and metadata
README.md           # Project documentation

๐Ÿ”Œ Plugin Development

Create custom content with our plugin system:

from llmadventure.plugins import Plugin, register_plugin

@register_plugin
class MyPlugin(Plugin):
    name = "My Custom Plugin"
    version = "1.0.0"
    
    def on_game_start(self, game):
        # Add custom game mechanics
        pass
    
    def on_combat_turn(self, player, enemy):
        # Modify combat behavior
        pass

๐ŸŒ Web Interface

Start the web interface for a graphical experience:

# Install web dependencies
pip install "llmadventure[web]"

# Start web server
llmadventure --web

# Or programmatically
from llmadventure.web import start_web_server
start_web_server(port=8000)

๐Ÿ“Š Analytics & Insights

Track your adventures with built-in analytics:

from llmadventure.analytics import AdventureTracker

tracker = AdventureTracker()
stats = tracker.get_player_stats()
print(f"Adventures completed: {stats['adventures']}")
print(f"Creatures defeated: {stats['creatures_defeated']}")
print(f"Distance traveled: {stats['distance_traveled']}")

๐Ÿงช Testing

Run the comprehensive test suite:

# Install test dependencies
pip install "llmadventure[dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=llmadventure

# Run specific test categories
pytest -m "not slow"
pytest -m integration

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new features
  5. Submit a pull request

Development Setup

git clone https://github.com/SoftwareApkDev/llmadventure.git
cd llmadventure
pip install -e ".[dev]"
pre-commit install

Code Quality

We use several tools to maintain code quality:

  • Black: Code formatting
  • isort: Import sorting
  • flake8: Linting
  • mypy: Type checking
  • pytest: Testing

๐Ÿ“ˆ Performance

LLMAdventure is optimized for performance:

  • Fast Startup: < 1 second to begin playing
  • Responsive UI: Real-time updates and animations
  • Efficient AI: Optimized prompts and caching
  • Memory Efficient: Minimal resource usage

๐Ÿ† Success Stories

"LLMAdventure has revolutionized how I think about interactive storytelling. The AI-generated content is consistently engaging and surprising." - Game Developer

"Perfect for teaching AI concepts to students. They love creating their own adventures!" - Computer Science Professor

"The plugin system is incredibly powerful. I've created entire new game modes with just a few lines of code." - Mod Developer

๐Ÿ“š Documentation

๐Ÿ†˜ Support

๐Ÿ™ Acknowledgments

  • Google Gemini 2.5 Flash for AI capabilities
  • Rich library for beautiful CLI interfaces
  • Typer for command-line interface
  • Pydantic for data validation
  • The open-source community for inspiration and support

๐ŸŒŸ Star History

Star History Chart


Ready for your next adventure? ๐Ÿ—ก๏ธโš”๏ธ๐Ÿฐ

pip install llmadventure
llmadventure

Join thousands of adventurers creating infinite stories with AI! ๐Ÿš€

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llmadventure-1.0.0.tar.gz (48.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llmadventure-1.0.0-py3-none-any.whl (46.9 kB view details)

Uploaded Python 3

File details

Details for the file llmadventure-1.0.0.tar.gz.

File metadata

  • Download URL: llmadventure-1.0.0.tar.gz
  • Upload date:
  • Size: 48.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.4

File hashes

Hashes for llmadventure-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4b6230211ef8668853fb5d0b9cbb78e2bd3b006c45dbef402b8ca47d702fa565
MD5 2888d57d2dca146070e2d1f596cc654b
BLAKE2b-256 932a83e61f3655a9cf099e4df1624665573007d1f621236f5b3bf3557f109590

See more details on using hashes here.

File details

Details for the file llmadventure-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: llmadventure-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 46.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.4

File hashes

Hashes for llmadventure-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c31d955c4453bf644b3cb7c503c7f9cae3eb9dd9f87dc96a50f4b2882dc912ca
MD5 d239fa1a109957a4cd2515647737f6b9
BLAKE2b-256 6e1fee5ab137b617745ebf3877b48c7363e74f6e571455f7f584fa71fa6cbb10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page