Inspiration
Murder Mysteries have always been captivating us, and combing it with storytelling, logic and suspense made it more fun. We wanted to create an interactive experience where players feel like real detectives using AI and not just as a storytelling engine but as a reasoning partner as well.
What it does
It generates a fresh murder mystery game on each play through. Our goal was to create realistic and engaging cases every time with unique story lines, where players can freely interrogate AI characters built by our model and get to a conclusion on their own.
How we built it
MysteryAI uses Gemini AI API to create a murder mystery scenario!(story,victim,suspect,witness). We ran an embedded comparison using hugging face transformers against previous cases to avoid story repetition. We used Firestore Firebase Google nosql database to store all the cases and vectorized database of cases. For each conversation between the user and the character suspects , we generated prompts using RAG to feed character knowledge.
Challenges we ran into
Our First challenge was the number of prompts we could send to Gemini API which could lead to an infinite loop which we overcame by keeping some constraints and limitations in such a way that a conclusion is reached in accountable number of Interrogatory questions.
Going forward, we faced the problem of Repetitive AI responses which might have been hallucinations. We overcame this by using Retrieval Augmented Generation to feed the previous case history to remind the model.
Then we noticed too many similarities in cases generated by AI. This led to us to use cosine similarity to reduce the repetition of cases. this Cosine similarity loops through the case history that is stored in the database to find similarities and returns the case only if it is not a repetition. This reduced the repetition percentage by 70%.
Accomplishments that we're proud of
Case Similarity Prevention and Live AI powered interrogation.
What we learned
We learnt a lot about prompt engineering, implementing RAG using cosine similarity. Handling LLM limitations like hallucinations.
What's next for MysteryAI
There are chances the user might not be able to guess the murderer and this might go into an infinite loop. We can try to use RAG feedback loop to tighten the Gemini Narratives which will result in more engagement. Improving difficulty levels based on the users skills. We can also make the game dynamic by introducing time-based clues unlocking or misdirection.
Built With
- firebase
- geminiapi
- huggingfaceapi
- javascript
- react
- tailwindcss
Log in or sign up for Devpost to join the conversation.