Introduction
Text-based adventure games were among the earliest forms of digital entertainment, immersing players in interactive storytelling through simple text commands. Inspired by these classic games, I set out to create my own using AWS Bedrock, Amazon’s managed GenAI service. This article details how I leveraged generative AI, AWS infrastructure, and modern development tools to build and deploy my game, Kroz, bringing an old-school experience to modern cloud-based architecture.

What is described in this article is also available here in form of slides - also, in a more available way! If you want to skip straight to a next-to-bedrock powered game, go instead here
The Concept: Bringing Text Adventures Back
What is a Text Adventure Game?
A text adventure is an interactive fiction game where the player interacts with the game world using text-based commands. The game presents descriptions of rooms, objects, and situations, and the player inputs actions to navigate the story.
Why Use AWS Bedrock?
Amazon Bedrock provides access to powerful foundation models like Amazon Titan, which allow developers to generate structured JSON data for game elements dynamically. This enables procedural generation of game content, making it scalable and adaptive to player inputs.
System Architecture
Key AWS Components
My solution is built on several AWS services:
- Amazon Bedrock: Generates game content and responses.
- AWS Lambda: Processes user inputs and interacts with Bedrock.
- Amazon API Gateway: Serves as the main communication layer between the frontend and backend.
- AWS Cognito: Manages user authentication.
- Amazon CloudFront & S3: Hosts the static frontend of the game.
- AWS CDK: Automates infrastructure deployment.
Game Design & Implementation
Generating Game Content with AWS Bedrock
I used Amazon Titan models in Bedrock to generate structured JSON data representing game levels. Here’s an example of a JSON prompt to Bedrock:
{
"task": "Generate a JSON structure to model a textual adventure game with 5 rooms. Each room should have a title, description, and a list of items."
}
Bedrock then returns:
{
"rooms": [
{ "title": "Dark Dungeon", "description": "A cold, damp room with flickering torches.", "items": ["Torch", "Old Key"] },
{ "title": "Hidden Library", "description": "Books line the walls, covered in dust.", "items": ["Ancient Tome", "Silver Coin"] }
]
}
This allows dynamic world-building without manually scripting every room.
Processing Player Input
The player interacts with the game by typing commands (e.g., “go north”, “pick up key”). AWS Lambda functions parse these commands and determine the appropriate game response. Using Bedrock’s models, we generate dynamic responses:
{
"task": "Given the player's current location and command, return the next game state."
}
This ensures that game logic is handled efficiently in a serverless manner.
Deployment & Infrastructure as Code
Automating with AWS CDK
I used AWS Cloud Development Kit (CDK) to deploy the infrastructure. Key constructs include:
- CloudFront & S3 for hosting
- API Gateway & Lambda for backend logic
- Cognito for authentication
Example CDK TypeScript snippet for deploying the Lambda function:
const gameLambda = new lambda.Function(this, 'GameHandler', {
runtime: lambda.Runtime.NODEJS_18_X,
handler: 'index.handler',
code: lambda.Code.fromAsset('lambda'),
});
Hosting the Game Frontend
The static frontend is served using S3 and CloudFront, providing a fast and scalable way to deliver the game UI. The frontend interacts with the backend through API Gateway.
Results & Future Improvements
The game, available at kroz.madeddu.xyz, successfully demonstrates how AWS Bedrock can power interactive storytelling. Future enhancements include:
- Expanding procedural generation to include non-playable characters (NPCs).
- Adding multiplayer elements via WebSockets.
- Enhancing AI-generated narratives for richer interactions.
Conclusion
By leveraging AWS Bedrock and modern cloud architecture, I was able to bring the spirit of classic text adventures into the AI era. This project showcases how generative AI can enhance game development, making content creation more dynamic and scalable.
Want to build your own AI-powered text adventure? Start exploring Amazon Bedrock today!