← Back to list

Resurrecting Molyneux’s Dream: How I Use LLMs to Build Reactive RPG Worlds

AI has taken over the entire industry, and developers are massively losing their jobs.

D Krivushkina · 2026-06-16 20:56 · 2 claps · 3.5 min read
#unity #game-development #games #ai #llm
Open on Medium ↗
Wiki topics: LLM · Large Language Models AI · AI · General 🌐 · Web Development 🎮 · Gaming

Resurrecting Molyneux’s Dream: How I Use LLMs to Build Reactive RPG Worlds

AI has taken over the entire industry, and developers are massively losing their jobs.

This is a highly popular narrative that’s currently very profitable to sell to investors. It seems as though corporations have unlocked a new era of efficiency. However, as a gameplay systems engineer, I see a completely different picture.

We’re experiencing a harsh macroeconomic correction following the pandemic hiring “bubble”. According to the ***Unity Gaming Report 2024***, average prototyping time has decreased, while project complexity is steadily growing. By attempting to maintain profit margins with reduced team sizes, studios have triggered a massive inflation of engineering skills. Today’s Middle developer must possess the architectural expertise of yesterday’s Senior.

Paradoxically, this is where the current gaming industry stands. This isn’t a result of an AI technological revolution. It’s a result of too many efforts to optimize something that has always required systemic complexity.

Generative tools are great at writing utilitarian scripts. But they’re incapable of designing a clean, decoupled architecture for an entire project. AI will not set up proper DI, it won’t wire an Event Bus for a dozen microsystems, and it won’t optimize memory management for a specific target device. The bar of requirements has skyrocketed. The market needs engineers capable of designing scalable architecture for the long term and assembling complex ecosystems that operate as a single organism.

Here lies the main mistake of current management in many companies. They’re trying to use innovations simply to make the assembly line cheaper, missing out on their true potential.

Building Living Worlds

LLMs in the hands of a skilled engineer are not a way to save money, but a tool to create worlds with an unprecedented level of immersion. Remember Peter Molyneux’s ambitious dreams of truly living worlds and authentic life simulation? Back then, the industry simply lacked the technological foundation to support that vision.

Computational power finally allows us to calculate complex NPC AI ecosystems, integrate short-term memory, and connect reactive state machines with a dynamic narrative. When a neural network governs character behavior, dynamically influencing the global world state, quest systems, and the player’s inventory — that’s an entirely different level of engagement. Neural networks should add complexity to NPCs, breathe life into ecosystems, and deepen the gameplay, rather than just stamping out “cheap” code.

Players are already tired of the sterile, casual assembly line. Look at the recent release of the Gothic Remake and the resonance surrounding it.

[embed]

The developers refused to bow down to modern casual retention metrics. Surviving in the Old Camp involves severe friction. The need to adapt in a world where any NPC can overpower you in stats, making them feel terrifyingly alive, is the result of a complex interplay between balance, AI, and state management. This is the exact systemic synergy we play RPGs for. The game doesn’t hold your hand, nor does it try to please you. It forces you to think and make mistakes. And that is exactly why you believe in this world.

How I Approach This Technically (Function Calling & Context)

To actually achieve this level of immersion without creating spaghetti code, you need a scalable architecture. In my current project, instead of hardcoding dialogue trees, I use an LLM (Gemini) strictly integrated into the game’s loop via Function Calling and Dynamic Context Injection.

Here is a glimpse of how I construct the dynamic context for the AI. The NPC needs to know the player’s exact state, active quests, and inventory to react organically.

[embed]

// Snippet from NarrativeService.cs
private ContentDTO ConstructSystemInstruction(PromptContext context)
{
    var sb = new StringBuilder();
    sb.AppendLine($"[SYSTEM PROMPT]\n{context.SystemPrompt}\n");
    sb.AppendLine("[DYNAMIC CONTEXT SNAPSHOT]");
    sb.AppendLine($"SceneContext: {context.SceneContext}");
    sb.Append($"PlayerStatus: [{_playerData.Name} is carrying]: ");

    if (context.PlayerInventoryItems.Count > 0)
    {
        foreach (var item in context.PlayerInventoryItems)
        {
            sb.AppendLine($"- {item.Key}: {item.Value}");
        }
    }

    // Injecting narrative flags
    if (context.WorldStateFlags.Count > 0)
    {
        sb.Append($"WorldState: ");
        foreach (var flag in context.WorldStateFlags)
            sb.Append($"{flag.Key}: {flag.Value}; ");
    }

    // Injecting player's quests
    sb.AppendLine($"QuestContext: Active Quest: '{context.QuestName}'. Objective: '{context.ObjectiveDescription}'.");

    return new ContentDTO { Parts = new List<PartDTO> { new() { Text = sb.ToString() } } };
}

The AI isn’t just generating text, it acts as an agent that can interact with the game’s mechanics. Through [NarrativeInterpreter](https://github.com/daridakr/gemini-ai-farm/tree/main/Assets/_Project/Scripts/Gameplay/Narrative/Interpreter).cs, I expose specific tools to the LLM.

For example, if the player convinces an NPC to take a quest item, the AI triggers a function call to remove the item from the player’s inventory and updates the global world state via the Event Bus.

// Snippet from NarrativeInterpreter.cs
private void HandleRemoveQuestItem(JObject args)
{
    string itemName = args["itemName"]?.ToString();
    int quantity = int.Parse(args["quantity"]?.ToString());

    var resourceSO = _resourceCatalog.ResourcesSO.FirstOrDefault(r => r.DisplayName == itemName);

    // The AI directly triggers gameplay mechanics
    bool success = _playerInventory.TryRemoveItem(resourceSO, quantity);

    if (!success)
        Debug.LogWarning($"[NarrativeInterpreter] AI tried to remove {quantity} of '{itemName}', but the operation failed.");
}

Final Thoughts

The original Gothic of my childhood shaped my understanding of how game loops should engage the brain in a creative process. From hand-drawn paper prototypes many years ago to designing complex digital systems today, my focus has always been on creating deep, systemic gameplay.

The technological shift we are currently experiencing is a painful but necessary stage of market maturation. Tools change, and there is no need for panic here. The future of the industry belongs to companies that allocate resources toward deep R&D rather than generating assembly-line knockoffs. Creating mind-bending worlds can still only be done by engineers with a genuine passion for their craft and a fundamental understanding of architecture.

Thanks for reading!

  • Daria K

메타데이터
post_id
2b0ebca5abb0
slug
resurrecting-molyneuxs-dream-how-i-use-llms-to-build-reactive-rpg-worlds-2b0ebca5abb0
url
https://medium.com/@d.krivushkina/resurrecting-molyneuxs-dream-how-i-use-llms-to-build-reactive-rpg-worlds-2b0ebca5abb0
canonical_url
https://medium.com/@d.krivushkina/resurrecting-molyneuxs-dream-how-i-use-llms-to-build-reactive-rpg-worlds-2b0ebca5abb0
author_url
https://medium.com/@d.krivushkina
status
ok
fetched_at
2026-06-20 20:29:01