The Night Before Crisis is a web-based game where players take on the role of one of Santa’s trusted elves. Santa has mysteriously disappeared just days before Christmas, and it’s up to the player to find him through a series of choices and adventures. Each scene is uniquely generated using AI, this includes an AI generated story fragment, AI generated choices extracted from the story and an AI generated illustration of the current scene. This in total creates the key elements of our completely AI generated choose-your-adventure Christmas game.
Visit christmas.AndrewGeorgiou.co.uk to play the game!
I wrote a Medium article about the creation of this project, check it out!
- Interactive storytelling with player choices affecting the narrative
- AI-generated story segments using Google's Gemini 1.5 Flash
- AI-generated illustrations for each scene using Replicate's Flux-Schnell model
- Responsive design that works on both desktop and mobile
- Background Christmas music
- Story state management to ensure coherent narrative progression
- Rate limiting to manage API usage
- Frontend: React with Tailwind CSS
- Backend: Python with Flask
- AI Models:
- Text Generation: Google Gemini 1.5 Flash
- Image Generation: Replicate's Flux-Schnell
- Python 3.x
- Node.js and npm
- Google Gemini API key
- Replicate API key
- Clone the repository
git clone https://github.com/A-Georgiou/ChristmasAdventure.git
cd ChristmasAdventure
- Install backend dependencies
cd backend
pip install -r requirements.txt
- Install frontend dependencies
cd frontend
npm install
- Set up environment variables
# Create .env file in backend directory
GOOGLE_API_KEY=your_gemini_api_key
REPLICATE_API_KEY=your_replicate_api_key
- Start the development servers
# Start backend server
cd backend
flask app.py
The game uses a state machine to track three distinct story phases:
- Beginning
- Middle
- Conclusion
Each phase influences how the AI generates the next part of the story, ensuring a coherent narrative arc with proper build-up and resolution.
The application implements rate limiting to manage API costs:
- 30 requests per day per user
- Approximately 5-6 complete stories per day
You can modify the prompts in the backend to create different types of adventures. The core system can be adapted for various themes beyond Christmas.
Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch
- Submit a pull request
Andrew Georgiou
- Google's Gemini API for text generation
- Replicate's Flux-Schnell model for image generation
- The open-source community for inspirational Christmas-themed projects