AWS Builder Center
Weekend Creative Challenge: AI Mystery Game

Weekend Creative Challenge: AI Mystery Game

An AI-powered mystery game where you generate, investigate, and solve unique cases.

Series: WeekEnd-Challenges (7 articles)

  1. …
  2. 3
    Weekend Creative Challenge: AI Mystery Game This article
AWS SBG Tech Lead ’25 • Founder GunnerJyo • AWS Certified • Graphic Designer • YT Streamer

Vision & What the App Does

I wanted to build a creative application that turns generative AI into an interactive experience rather than simply producing a text response. For this challenge, I created AI Mystery Game, a browser-based game where players can generate and solve original mysteries created by AI.
The player selects a difficulty level and a mystery category such as Logic, Crime, Fantasy, Science, or Adventure. The application then generates a unique mystery containing a title, story, clues, and a question that the player must solve.
The creative output is different every time because the mystery is generated dynamically using Amazon Nova Lite through Amazon Bedrock. Players can investigate the generated story, request a hint when they are stuck, and submit their answer for AI evaluation.
The application is designed to make generative AI feel interactive and entertaining. Instead of simply asking an AI a question, the player becomes part of an AI-generated mystery.

How I Built It

I built the application using a simple HTML, CSS, and JavaScript frontend with a serverless AWS backend.
I started by designing the game interface with controls for selecting difficulty and category. The interface provides three main interactions: generating a mystery, requesting a hint, and submitting an answer.
For the backend, I created an AWS Lambda function using Python. Instead of creating separate functions for every feature, I designed one Lambda function that handles multiple actions based on the request.
The Lambda function supports three actions:
  • generate creates a new mystery.
  • hint generates a useful clue without directly revealing the answer.
  • check evaluates the player's answer and returns feedback and a score.
For mystery generation, I created a structured prompt that asks Amazon Nova Lite to return a title, story, question, answer, and explanation in JSON format. This made it easier for the JavaScript frontend to process and display the generated content.
The frontend communicates with Lambda through Amazon API Gateway. When the player clicks the Generate Mystery button, JavaScript sends an HTTP POST request containing the selected difficulty and category. API Gateway receives the request and invokes the Lambda function.
Lambda then sends the appropriate prompt to Amazon Bedrock using the Bedrock Converse API. After receiving the model response, Lambda sends the result back through API Gateway to the browser.
During development, one of the first challenges was testing the Lambda function with different event formats. Direct Lambda test events and API Gateway requests have different structures, so I modified the function to handle both formats.
Another challenge was connecting the browser frontend to the API. Browser security restrictions required CORS configuration in API Gateway. After configuring CORS and redeploying the API, the frontend was able to communicate with the AWS backend successfully.
I also tested the Lambda function independently before connecting it to the frontend. This made it easier to identify backend problems before debugging the entire application.
The frontend is deployed on Netlify so that the finished game can be accessed publicly without requiring users to run the project locally.

AWS Services Used / Architecture Overview

The project uses three main AWS services.

Amazon Bedrock

Amazon Bedrock provides access to Amazon Nova Lite, which generates the mysteries, creates hints, and evaluates player answers.

AWS Lambda

AWS Lambda runs the Python backend without requiring server management. It processes the incoming requests and communicates with Amazon Bedrock.

Amazon API Gateway

Amazon API Gateway provides the HTTP API endpoint connecting the frontend with the Lambda backend.

Architecture

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Player
│
▼
Web Frontend
HTML / CSS / JavaScript
│
│ HTTP POST
▼
Amazon API Gateway
│
│ Invokes
▼
AWS Lambda
Python Backend
│
│ Bedrock Converse API
▼
Amazon Bedrock
Amazon Nova Lite
│
▼
Mystery / Hint / Answer Evaluation
│
▼
AWS Lambda
│
▼
API Gateway
│
▼
Web Frontend
The application is triggered by player interactions. For example, clicking Generate Mystery sends a POST request to API Gateway. API Gateway invokes Lambda, and Lambda sends the appropriate prompt to Amazon Nova Lite through Amazon Bedrock. The generated creative content is then returned to the frontend.

What I Learned

This challenge gave me practical experience building an interactive generative AI application using AWS.
I learned how to use the Amazon Bedrock Converse API from AWS Lambda and how prompt design can be used to control different AI behaviors. Creating separate prompts for mystery generation, hints, and answer evaluation helped me understand how the same AI model can support multiple application features.
I also gained more experience with serverless architecture. Using API Gateway and Lambda allowed me to build the backend without managing a traditional server.
Another important lesson was the importance of structured AI responses. Asking the model to return JSON made it much easier for the frontend to process the generated mystery and display the different parts of the game.
I also learned more about CORS and how browser applications communicate with serverless APIs.
Most importantly, this project showed me that generative AI can be used to create interactive experiences, not just traditional chat applications. A simple combination of AI-generated content and game mechanics can turn a basic web application into something engaging and creative.

Live Demo & Source Code

The frontend is deployed on Netlify for public access, while the application's backend and AI processing are powered by Amazon API Gateway, AWS Lambda, and Amazon Bedrock.

Conclusion

AI Mystery Game combines generative AI with a simple interactive game experience. Players can generate new mysteries, investigate the stories, request hints, and submit their answers for AI evaluation.
The project demonstrates how Amazon Bedrock, AWS Lambda, and API Gateway can be combined to create a creative serverless application with an experience that is different every time the player uses it.
lambda
IAM
API
API-C

Series: WeekEnd-Challenges (7 articles)

  1. …
  2. 3
    Weekend Creative Challenge: AI Mystery Game This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article