Skip to content

Cillian-Cooke/hackathon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ‰ AI Dungeon Master

A web-based D&D adventure game powered by Google's Gemini AI. Experience dynamic, AI-generated storytelling with persistent campaigns, randomized characters, and immersive settings.

Python React Gemini License

๐Ÿ† Hackathon Winner

This project was built at the Claude Builder Club @ TCD Hackathon (December 2025) and won:

  • ๐Ÿฅ‡ Best Team Collaboration
  • ๐ŸŽจ Most Creative Use of Claude

It has since been moved from Claude to Google Gemini due to costs.


โœจ Features

  • AI-Powered Dungeon Master โ€” Dynamic storytelling that adapts to your choices
  • Randomized Adventures โ€” Each reset generates new characters, settings, and themes
  • Persistent Campaigns โ€” Your progress is automatically saved
  • Multiple Themes โ€” Medieval Fantasy, Steampunk, Sci-Fi, Post-Apocalyptic, and more
  • Character Variety โ€” Random races (Human, Elf, Dwarf, Orc) and classes (Warrior, Mage, Rogue, Engineer, Cleric)
  • Dark/Light Mode โ€” Toggle between themes for comfortable play
  • CLI & Web Modes โ€” Play in your terminal or browser

๐Ÿ“‹ Prerequisites

  • Python 3.12 or higher
  • Node.js 18+ and npm
  • Google Gemini API key

๐Ÿš€ Getting Started

1. Clone the Repository

git clone https://github.com/Cillian-Cooke/hackathon.git
cd hackathon

2. Set Up Environment Variables

Create a .env file in the project root:

touch .env

Add your Gemini API key to the .env file:

GEMINI_API_KEY=your_gemini_api_key_here

๐Ÿ“ Getting a Gemini API Key:

  1. Go to Google AI Studio
  2. Sign in with your Google account
  3. Click "Create API Key"
  4. Copy the key and paste it in your .env file

3. Install Python Dependencies

# Create virtual environment
python -m venv venv

# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

4. Install Frontend Dependencies

cd my-react-app
npm install

๐ŸŽฎ Running the Game

Web Mode (Recommended)

Start both the backend server and frontend in separate terminals:

Terminal 1 โ€” Backend:

source venv/bin/activate  # If not already activated
uvicorn server:app --reload

Terminal 2 โ€” Frontend:

cd my-react-app
npm run dev

Open your browser to http://localhost:5173

CLI Mode

For a terminal-based experience:

source venv/bin/activate
python cli.py

๐ŸŽฏ How to Play

  1. Start โ€” The AI Dungeon Master sets the scene
  2. Type Actions โ€” Enter what your character does (e.g., "I search the room", "Attack the goblin")
  3. Special Commands:
    • ๐Ÿ“– Summary of Story โ€” Get a recap of your adventure
    • ๐Ÿ‘ค Player Status โ€” View your character's stats and abilities
    • ๐Ÿ”ฅ Reset Campaign โ€” Start a completely new adventure

๐Ÿ—๏ธ Project Structure

hackathon/
โ”œโ”€โ”€ my-react-app/       # Node Modules and React Deps
โ”‚   โ””โ”€โ”€ src/ 
โ”‚       โ””โ”€โ”€ main.jsx    # React application entry
โ”œโ”€โ”€ cli.py              # CLI game engine & DM logic
โ”œโ”€โ”€ server.py           # FastAPI backend server
โ”œโ”€โ”€ style.css           # Application styles
โ”œโ”€โ”€ index.html          # HTML entry point
โ”œโ”€โ”€ .env                # Environment variables (create this)
โ”œโ”€โ”€ .gitignore          # Git ignore rules
โ”œโ”€โ”€ requirements.txt    # Python dependencies
โ”œโ”€โ”€ package.json        # Node dependencies
โ””โ”€โ”€ README.md           # This file

๐Ÿ“ฆ Dependencies

Python

  • fastapi โ€” Web framework for the API
  • uvicorn โ€” ASGI server
  • google-genai โ€” Gemini AI SDK
  • python-dotenv โ€” Environment variable management
  • pydantic โ€” Data validation

Frontend

  • react โ€” UI framework
  • react-icons โ€” Icon components
  • vite โ€” Build tool and dev server

๐Ÿ”ง Configuration

The game can be customized by modifying constants in cli.py:

Setting Description Default
GEMINI_MODEL AI model to use gemini-2.5-flash
TOTAL_STAT_POINTS Points for character stats 30
max_output_tokens Response length limit 2048

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.

๐Ÿ™ Acknowledgments


Made with โค๏ธ at the Claude Builder Club @ TCD Hackathon

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors