Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BQ31X/thudbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿบ Thudbot - The Space Bar AI Assistant

Python 3.12+ FastAPI Next.js LangGraph

An intelligent AI assistant for The Space Bar adventure game that provides contextual hints.

Quick Start

  1. ๐ŸŽฌ Watch the video to get oriented to Thudbot

  2. ๐Ÿงช Try out Thudbot locally

    1. Follow the Quick Start steps below

    2. Try these Example Questions

๐Ÿš€ Project Overview

Thudbot is an AI-powered player companion for The Space Bar, a cult-classic adventure game from legendary game designer Steve Meretzky.

It provides contextual, spoiler-sensitive hints through an immersive, in-universe interface: the playerโ€™s Personal Digital Assistant (PDA), Zelda.

Designed as a standalone web tool, Thudbot keeps you grounded in the game worldโ€”even when you need help solving its trickiest puzzles.

Built with LangGraph, FastAPI, and Next.js, Thudbot is a stepping stone toward fully agentic NPCs for the Boffo Games universe.

๐ŸŽฌ Demo Video

Watch the 2min Demo Video

See Thudbot in action

๐Ÿงช Testing Thudbot

Not familiar with "The Space Bar" game? No problem! Here are ready-to-test examples:

Game Hint Examples (Tests RAG system)

Q: "Where is the bus token?"
Expected: Thud explains it's in a cup, with character-specific advice

Q: "How do I get the token from the cup?" 
Expected: Step-by-step hint about asking Thud for help or looking carefully

Q: "When does the shuttle to Karkas 4 leave?"
Expected: Specific time (22:50) with character commentary about checking monitors

โœจ Features

  • ๐ŸŽฎ Game Hint System: RAG-powered hints for The Space Bar adventure game puzzles
  • ๐Ÿ›ก๏ธ Robust Error Handling: Graceful error recovery
  • ๐ŸŒ Web Interface: Next.js frontend
  • โšก FastAPI Backend: High-performance Python API server
  • ๐Ÿงช Comprehensive Testing: Robust test suite

โšก Quick Start

๐Ÿณ Fastest Way: Docker Compose

# Clone the repo
git clone https://github.com/BQ31X/thudbot.git
cd thudbot

# Add your API keys to .env (copy from .env.example)
cp .env.example .env
# Edit .env with your OPENAI_API_KEY

# Start everything with Docker
cd infra
docker compose up --build

# โœจ Thudbot backend now at: http://localhost:8000

๐Ÿ“ฆ Traditional Setup

Prerequisites

  • Python 3.13+
  • Node.js 20+

1. Environment Setup

# ๐Ÿ“ฆ Clone the repo
git clone https://github.com/BQ31X/thudbot.git
cd thudbot


# Install Python dependencies (backend)
cd apps/backend
uv sync

# Install Node.js dependencies (frontend)
cd ../frontend
npm install

2. Configuration

# Return to project root and copy environment template
cd ../..
cp .env.example .env

# Edit .env and add your API keys:
# OPENAI_API_KEY=your_api_key_here
# LANGCHAIN_API_KEY=your_langchain_key_here  # Optional: for LangSmith tracing

3. Run the Application

Terminal 1 - Backend:

cd apps/backend
uv run python -m thudbot_core

Terminal 2 - Frontend:

cd apps/frontend
npm run dev

Access: Open http://localhost:3000 in your browser!

๐Ÿ—๏ธ Architecture

Frontend (Next.js) โ†’ Backend (FastAPI) โ†’ Agent (LangGraph)

Built with:

  • Backend: FastAPI + LangChain + OpenAI GPT-4
  • Frontend: Next.js + React + Tailwind CSS
  • Data: CSV hint database + Qdrant vector store

๐Ÿ“Š RAG Evaluation & Performance

Data-driven retriever selection using comprehensive evaluation:

  • ๐Ÿ““ Full evaluation in: 00_Thud_construction.ipynb
  • ๐Ÿงช Framework: RAGAS metrics (context recall, entity recall, noise sensitivity)
  • ๐Ÿ“‹ Golden dataset: 12 synthetically generated test queries
  • ๐Ÿฅ‡ Platinum dataset: Selected subset of 5 queries, produced by applying a LangChain-based rewriting prompt to the golden dataset, followed by manual selection for evaluation focus and cost control
  • โš–๏ธ Compared retrievers: Naive, BM25, Multi-query
  • ๐ŸŽฏ Result: Multi-query retrieval selected based on superior performance

Key findings:

  • Multi-query retrieval significantly improved context precision
  • Enhanced handling of ambiguous game terminology
  • Better retrieval of relevant hints for complex puzzles

See notebook for detailed metrics, comparison tables, and methodology.

๐Ÿงช Testing

Run the comprehensive test suite:

# Run all tests
uv run pytest

# Run tests with the commit script
./check_and_commit.sh "your commit message"

Test coverage includes:

  • Data validation (CSV exists & structure)
  • Module imports (all components load)
  • File organization (required files present)
  • Basic functionality verification

๐ŸŽฎ Usage Examples

Ask about game puzzles:

"How do I get the token from the cup?"
โ†’ "The bus token is in the cup; make sure Thud has it before you hop on the bus."

Get general game help

"When is the shuttle to Karkas 4?"
โ†’ "The shuttle to Karkas 4 departs at 22:50."

๐Ÿ“– Project Structure

thudbot2/
โ”œโ”€โ”€ apps/
โ”‚   โ”œโ”€โ”€ backend/            # Python FastAPI backend
โ”‚   โ”‚   โ”œโ”€โ”€ thudbot_core/   # Core application code
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ *_node.py   # LangGraph workflow nodes
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ api.py      # FastAPI backend server
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ langgraph_flow.py # Main workflow orchestration
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ state.py    # Shared state management
โ”‚   โ”‚   โ”œโ”€โ”€ data/           # CSV hint database
โ”‚   โ”‚   โ”œโ”€โ”€ tests/          # Backend test suite
โ”‚   โ”‚   โ”œโ”€โ”€ pyproject.toml  # Python dependencies & config
โ”‚   โ”‚   โ””โ”€โ”€ Dockerfile      # Backend container image
โ”‚   โ””โ”€โ”€ frontend/           # Next.js frontend
โ”‚       โ”œโ”€โ”€ app/            # Next.js app directory
โ”‚       โ”œโ”€โ”€ public/         # Static assets (PDA interface)
โ”‚       โ””โ”€โ”€ package.json    # Node.js dependencies
โ”œโ”€โ”€ infra/
โ”‚   โ”œโ”€โ”€ compose.yml         # Docker Compose (default)
โ”‚   โ””โ”€โ”€ compose.prod.yml    # Production Docker Compose
โ”œโ”€โ”€ docs/                   # Project documentation
โ”œโ”€โ”€ notebooks/              # Jupyter notebooks used for prototype development
โ”œโ”€โ”€ .env                    # Environment variables (not in git)
โ”œโ”€โ”€ README.md               # This file
โ””โ”€โ”€ check_and_commit.sh     # Test runner and commit script

๐Ÿšจ Troubleshooting Tips

  • Make sure .env is properly configured with a valid OpenAI key.
  • Restart both frontend and backend if switching API keys or files.
  • Backend logs appear in the terminal where you run uv run python -m thudbot_core.
  • For Docker Compose issues, try docker compose down then docker compose up --build.

๐Ÿ“„ License

This project is copyrighted and all rights are reserved. Leo DaCosta 2025

About

AI player companion for The Space Bar

Resources

Stars

Watchers

Forks

Packages

No packages published