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.
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.
- 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
- Python 3.12 or higher
- Node.js 18+ and npm
- Google Gemini API key
git clone https://github.com/Cillian-Cooke/hackathon.git
cd hackathonCreate a .env file in the project root:
touch .envAdd your Gemini API key to the .env file:
GEMINI_API_KEY=your_gemini_api_key_here๐ Getting a Gemini API Key:
- Go to Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy the key and paste it in your
.envfile
# 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.txtcd my-react-app
npm installStart both the backend server and frontend in separate terminals:
Terminal 1 โ Backend:
source venv/bin/activate # If not already activated
uvicorn server:app --reloadTerminal 2 โ Frontend:
cd my-react-app
npm run devOpen your browser to http://localhost:5173
For a terminal-based experience:
source venv/bin/activate
python cli.py- Start โ The AI Dungeon Master sets the scene
- Type Actions โ Enter what your character does (e.g., "I search the room", "Attack the goblin")
- 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
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
fastapiโ Web framework for the APIuvicornโ ASGI servergoogle-genaiโ Gemini AI SDKpython-dotenvโ Environment variable managementpydanticโ Data validation
reactโ UI frameworkreact-iconsโ Icon componentsviteโ Build tool and dev server
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 |
Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License โ see the LICENSE file for details.
- Claude Builder Club @ TCD for hosting the hackathon
- Google Gemini for the AI capabilities
- FastAPI for the excellent Python web framework
- Vite for the blazing fast frontend tooling
Made with โค๏ธ at the Claude Builder Club @ TCD Hackathon