
Weekend Creative Challenge: QuestForge
QuestForge is an AI-powered interactive text adventure where every player choice shapes the story. The world remembers your decisions through persistent game state, creating a different adventure every time you play.
Vision & What QuestForge Does
QuestForge is a browser-based, AI-powered interactive text adventure where the player becomes the main character in an unfolding story.
I wanted to build something more engaging than a simple AI story generator. Instead of generating a story once and stopping, QuestForge lets the player make decisions that actually shape the world. Every choice can change what happens next, and the game keeps track of the player's progress throughout the adventure.
When starting a game, the player chooses a genre and character archetype. QuestForge then generates the opening scene and presents several actions the player can take. The player chooses an action, and the story continues based on that decision.
The interesting part is that the world has memory.
QuestForge tracks things such as:
- Health
- Gold
- Reputation
- Inventory
- NPC relationships
- Discovered secrets
- Story progress
For example, if a player betrays a merchant early in the game, that relationship can affect a later chapter. The application does not simply rely on the AI remembering what happened. The important game state is stored in DynamoDB and supplied to the model whenever the next scene is generated.
The guiding idea behind QuestForge is:
The model writes the story. The application owns the state.
This separation makes the experience much more reliable while still allowing the AI to create a different adventure every time someone plays.
How I Built It
I built QuestForge as a React frontend backed by a serverless AWS architecture.
The gameplay loop is intentionally simple.
A player first selects a genre and character archetype. QuestForge creates a new game session and generates the first scene. After that, every choice is sent to the backend.
The backend retrieves the current game state from DynamoDB and builds a context for the AI containing:
- The selected genre and character archetype.
- The player's current health, gold, reputation, and inventory.
- Current NPC relationships and discovered information.
- A rolling summary of the adventure.
- The most recent scenes.
- The player's latest choice.
The AI then generates the next part of the story and returns structured information containing the new scene, available choices, and any changes that should happen to the game state.
One of the biggest technical decisions was keeping state management outside the AI.
For example, instead of allowing the model to directly decide that a player's health is now 40, it returns a state change such as
healthDelta: -10 . The application validates that value and applies the change to the player's actual state.This prevents the AI from accidentally changing unrelated values or corrupting the game state.
I also used OpenAI Structured Outputs with a JSON schema and validated the response on the backend with Zod. This was important because the application needs predictable data for things like choices, state changes, and story summaries.
During development, I initially experimented with Amazon Bedrock for the generative AI component. However, I reached the available Bedrock usage limit during development, so I switched the generation layer to OpenAI. I kept the rest of the architecture on AWS, including the frontend hosting, API, compute, database, and secret management.
This also reinforced an important lesson for me: the AI provider does not need to own the entire application. The application architecture can remain independent from the model provider.
AWS Services Used / Architecture Overview
QuestForge uses several AWS services while keeping the architecture completely serverless.
- AWS Amplify Hosting hosts the React frontend and provides continuous deployment from GitHub.
- Amazon API Gateway HTTP API provides the public API endpoint and handles requests from the frontend.
- AWS Lambda contains the backend game logic, validation, prompt construction, OpenAI integration, and state management.
- Amazon DynamoDB stores game sessions, player state, story chapters, choices, and other game data.
- AWS Systems Manager Parameter Store stores the OpenAI API key as a SecureString so the secret is not hardcoded into the application.
- Amazon CloudWatch provides logs for monitoring Lambda executions and debugging the application.
The basic request flow is:
Player → Amplify → API Gateway → Lambda → DynamoDB + OpenAI → Lambda → API Gateway → Player
DynamoDB acts as the source of truth for the game. OpenAI is responsible for generating the creative content, while AWS handles the application infrastructure and persistent state.
This separation means the game can keep its state consistent even though the story itself is generated dynamically.
Architecture Diagram

What I Learned
The biggest lesson from building QuestForge was that an AI application does not have to let the AI control everything.
At first, it is tempting to put the entire story history into the model and let it figure everything out. That approach becomes unreliable as the game gets longer. The model might forget an item, change a player's statistics, or contradict something that happened several chapters earlier.
Separating creative generation from application state solved a lot of these problems.
DynamoDB became the source of truth for important game information, while the AI only received the context it needed to write the next scene.
I also learned how useful structured model outputs are when building applications that need to consume AI responses programmatically. Returning a predictable schema made it much easier to validate the response and safely apply state changes.
Another lesson was that serverless architecture makes this type of project surprisingly straightforward. Lambda handles the backend logic, API Gateway exposes it, DynamoDB stores the state, and Amplify handles the frontend deployment. I did not need to manage a traditional server just to run an interactive game.
Finally, switching from Bedrock to OpenAI after reaching my Bedrock usage limit reminded me to keep the AI layer loosely coupled. The application should not depend on the model provider for things that the application itself can control.
Try QuestForge
You can play the live version here:
QuestForge is built around a simple idea: give the player a world, let them make the decisions, and let the story remember the consequences.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article