Dynamic Narrative Generation for Autogenesis with an Al Story Writer Agent on AWS

Client

Ten Trillion Triangles

Location

India

Industry

Gaming & Entertainment

Services & Tech

Amazon Bedrock, AWS Lambda, Amazon S3, Amazon API Gateway, Model Context Protocol

Client

Ten Trillion Triangles

Location

India

Industry

Gaming & Entertainment

Services & Tech

Amazon Bedrock, AWS Lambda, Amazon S3, Amazon API Gateway, Model Context Protocol

Project Overview

Ten Trillion Triangles, a game development studio, needed a way to generate fresh storylines that react to player choices without breaking the game’s narrative logic. Their title, Autogenesis, requires dynamic narrative creation that stays consistent across gameplay sessions while still feeling surprising and “random” in a fun way. Avahi built an Al story writer agent that generates creative narratives, tracks game state and story facts over time, and gives developers granular control through guardrails and customization tools. The result is a scalable story generation system designed for game engine integration through APIs.

About The
 Customer

Ten Trillion Triangles is a gaming and entertainment company focused on building innovative game experiences. For Autogenesis, the team is designing gameplay that evolves based on player decisions, requiring narrative content that is both dynamic and consistent within the game universe.

The 
Problem

Static storylines limit replay value and reduce player immersion in choice-driven games. Ten Trillion Triangles needed an Al system that could generate compelling narratives on demand, incorporating enough randomness to keep players excited while still maintaining coherence in the overallarc.

To be viable for real gameplay, the system also had to preserve continuity across sessions, tracking facts, names, prior events, and game state so the story would not contradict itself. On the development side, the team needed strong controls and guardrails, including customization capabilities and protections that prevent players from exploiting narrative systems in ways that could break fairness or progression.

Why AWS

AWS provided the services needed to run story generation workflows elastically and expose them safely to the game application through secure APls. With Amazon Bedrock, the solution could leverage foundation models for narrative generation and consistency checks, while serverless orchestration enabled scalable execution without requiring dedicated infrastructure.

AWS services also supported durable storage for game context and generated story artifacts, making it easier to manage state across sessions and integrate the system with the game engine via standard RESTful interfaces.

Why Ten Trillion Triangles Chose Avahi

Ten Trillion Triangles chose Avahi for the ability to design an agentic system that balances creativity with control, which is essential in game storytelling. Avahi implemented a recursive workflow that carries game state forward and introduced developer-oriented customization mechanisms and guardrails to keep narratives consistent and gameplay fair. Avahi also delivered an integration-ready API approach that aligns with game engine consumption patterns, setting the system up for Unreal Engine connectivity.

Solution

Avahi built an Al story writer agent designed to produce dynamic narratives that respond to evolving game state. The workflow is recursive, meaning each generation cycle ingests the current game state, including prior story decisions and world facts, and uses that context to shape the next narrative segment. Prompts are dynamically assembled, with system and user instructions adapting based on the state, enabling consistent storytelling across sessions without losing novelty.

To ensure high-quality narrative output, Avahi implemented model selection informed by data science benchmarking, choosing the best-fit LLMs for creative generation while maintaining narrative structure. The solution includes a game state management layer that tracks key entities and facts such as names, events, and world rules, reducing contradictions and continuity breaks

Developer control was built in through guardrails and creative tuning mechanisms. These controls help constrain the model’s behavior, prevent player exploitation, and support customization of tone, randomness, and narrative boundaries. For backend integrations, Avahi incorporated Model Context Protocol tooling to standardize how the agent connects with downstream systems and services.

The system is exposed through a RESTful API layer with JSON responses for straightforward game engine integration. AWS Lambda orchestrates the story generation workflow serverlessly, Amazon S3 stores game context and generated story outputs, and Amazon API Gateway provides the API endpoints. A unit testing framework was also delivered to demonstrate and validate system behavior and capabilities.

Key Deliverables

  • Al story writer agent for dynamic narrative generation in Autogenesis
  • Recursive workflow that feeds current game state into each generation cycle
  • Dynamic prompt assembly adapting to game state changes
  • LLM selection approach based on data science benchmarking
  • Game state management to track facts, names, and narrative continuity across sessions
  • Developer customization controls for creativity and narrative boundaries
  • Guardrails to prevent exploitation and support gameplay fairness
  • Model Context Protocol tooling for backend integrations
  • RESTful API layer with JSON responses for game engine consumption
  • Serverless orchestration using AWS Lambda
  • Unit testing framework demonstrating system capabilities

Project
 Impact

Ten Trillion Triangles gained a narrative generation system that produces fresh, engaging storylines while preserving continuity across sessions, a critical requirement for player trust and immersion. The solution also gives developers practical controls to tune creativity and enforce guardrails, making the system suitable for real gameplay scenarios and scalable integration via APls.

Ready to Transform Your Business with AI?

Let’s explore your high-impact AI opportunities together in a complimentary session

Ready to Transform Your Business with AI?

Let’s explore your high-impact AI opportunities together in a complimentary session

Ready to Transform Your Business with AI?

Book Your Free Ignition AI Workshop

Let’s explore your high-impact AI opportunities together in a complimentary half-day session

View Our Case Studies

See how we’ve delivered measurable results for businesses like yours