This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
The Ghost Detective is an AI-powered mystery game set in the eerie Blackthorn Manor.
The Nocturne Prototype, a clockmaker’s most valuable invention, has vanished from a locked study. As Detective Rowan Hale—a methodical investigator who does not believe in ghosts—you must examine evidence, question suspects, investigate strange occurrences, and decide what really happened.
I interpreted “Ghost in the Machine” as a mystery where the supernatural and the artificial meet. The manor is full of unsettling stories, but the detective’s job is to separate what can be established from what remains unexplained. An AI-powered detective assistant adds another layer: you can ask questions, test theories, and explore the case conversationally.
The project was inspired by classic detective stories, haunted-house mysteries, and the idea of making an investigation feel less like following a fixed path and more like building your own theory.
Demo
Play the game: The Ghost Detective — Streamlit Community Cloud
I’ll include screenshots of the game interface and investigation flow here.
The project’s source code is available on GitHub:
The Ghost Detective — GitHub Repository
Code
The project is built with Python and Streamlit. The main components are:
-
app.py— the game interface and investigation flow -
case_data.py— the case narrative, suspects, clues, incidents, and solution -
detective.py— the Gemma-powered detective assistant -
styles.css— the custom casebook-inspired interface
The code is organized so that the mystery’s structured information and the AI assistant’s conversational behavior remain separate.
How I Built It
I built the game using Python, Streamlit, and Google’s Gemma model.
Streamlit handles the interactive interface: the casebook, evidence examination, suspect profiles, unexplained incidents, notebook, hints, interrogation room, and verdict submission.
The mystery itself is defined in structured case data. The detective assistant receives relevant case context and the player’s questions, allowing it to respond in character and help the player explore their theories.
I used hosted Gemma inference rather than running a model locally. This let me focus on the game mechanics and experience without requiring a large model download or local GPU setup.
The game is deployed on Streamlit Community Cloud, making it accessible to anyone with the app link. The API credentials are configured through Streamlit’s Secrets settings rather than being included in the public repository.
One design choice I cared about was preserving the distinction between evidence, witness claims, and interpretation. The AI should help the player reason about the mystery—not simply declare a solution or treat every strange event as proof of a haunting.
Why Does Open Innovation Matter?
Open innovation made this project feel achievable.
Open-weight models such as Gemma give developers the opportunity to experiment with AI-powered experiences without having to build a model from scratch. They make it easier to explore new applications, learn how models behave, and design around their strengths and limitations.
For a small project like this, that accessibility matters. I could combine Gemma with familiar tools like Python and Streamlit to build something interactive and creative.
It also made me think more carefully about the role of AI in a game: rather than replacing the mystery’s underlying logic, the model can become a conversational layer that makes the experience richer.
The Spirit of It
There is something unsettling about a house where every strange sound might have an ordinary explanation—but none of the explanations feel quite complete.
I wanted the player to experience that tension: the feeling of being a skeptical detective in a place that seems determined to challenge their skepticism.
The most interesting part of a mystery is not always the final answer. Sometimes it is the moment when the evidence points one way, the witnesses insist on another, and you have to decide what you believe.
Prize Category
Best Use of Gemma
I used Google’s Gemma model as the conversational detective assistant, allowing players to question the case, explore theories, and engage with the mystery in a more flexible way. Rather than replacing the game’s structured evidence and intended solution, Gemma adds an interactive reasoning and storytelling layer to the investigation.
Thanks for checking out The Ghost Detective! 🕯️
Top comments (0)