InfiniteScribe - Calculating Odds
Today I’d like to spend some time showing off the approach I used for Infinite Scribe’s odds calculation, as I think it’s pretty neat :) Taking advantage of a few prompt engineering techniques we’re able to come up with a flexible approach that is easily extensible.
The Mythic GM System
Infinite Scribe is based heavily on the solo RPG system “Mythic”, which provides a way of adding the twists and turns that a game master would normally inject into a shared story through rolls and lookup tables. Where in a standard tabletop RPG you’d ask the game master clarifying questions, such as “who else is in the tavern?” or “how reinforced is that door?”, Mythic provides an odds chart to roll against.
The fate chart relies on two aspects; the a player’s judgment of the odds of success (ranging from Certain to Impossible), and the current “chaos factor” of the scene. Using this chart, a solo player would roll a 1d100 die and determine if the answer to their question was “very yes”, “yes”, “no”, or “very no”. Mythic also provides dozens of d100 charts for inspiration across things like actions, descriptions, and specific elements, inspiring players to continue their own stories. There’s also the concept of a “chaos factor” which provides a great way to manage the ebb and flow of the overall narrative. Infinite scribe takes full advantage of this system, using it for every user choice as we continue the narrative.
The Odds Calculation
Where our prompt engineering techniques come into play is the “player judgment of the odds of success” component. Despite the fact that we only really need a scale from 0 - 8, I wanted the language model to really consider what was going on in the context of the story so far. To do this, I took a “Chain-of-Thought” approach, where we first prompt the LM to discuss exactly what factors would influence the odds of success, and then using that dialog, rating the odds on a scale of 0 to 8.
[scene so far, including the user's actions and their consequent results]
User: Discuss the odds of the user being able to successfullly {Secure the Network}
Assistant: The Nexus is a layered, incredibly sophisticated system, even for someone like Anya. Successfully analyzing it – meaning identifying the core issue causing the erratic behavior and potentially finding a way to influence it – would require a focused, methodical approach. You have a base understanding of the underlying architecture, and you could potentially identify anomalies Anya might miss in her broader overview. A hasty attempt to interface directly with the Nexus, or to bypass security protocols without fully understanding the consequences, could easily exacerbate the situation, potentially locking you – and Anya – out entirely, or even alerting the rogue AI to your presence.
Right now, the network is volatile. It’s like trying to diagnose a patient during a seizure. A careful, collaborative approach, leveraging Anya’s expertise and your skills, gives you roughly a 40% chance of gaining a meaningful insight within the next hour. A solo, impulsive dive into the code? That drops to around 10%, with a high probability of unintended consequences. The Nexus isn’t simply lines of code, it’s a reflection of the city’s collective data, and understanding its motivations will require more than just technical prowess.
User: Based on the discussion, summarize the odds of success. Reply with a number between 0 and 8 based on the following classification:
0 - Certain
1 - Nearly Certain
2 - Very Likely
3 - Likely
4 - 50/50
5 - Unlikely
6 - Very Unlikely
7 - Nearly Impossible
8 - Impossible
Only return the number, nothing else.
Assistant: 4
Extending the Approach
This technique certainly works (although one could argue that it might be cheaper to just ask a smaller LM to do the classification without the preamble), but RPG characters are complex - they have skills, weaknesses, motivations, equipment, and various other factors that a regular game master considers when determining the difficulty of the check. Luckily, using the contextual nature of language models, we can easily extend our prompt to take those things into account.
User: The user is a {teen student named Ace}. They are motivated by {Justice} but plagued by {Recklessness}. They are good at {Athletics and Tech}, but are weak because they are {Impulsive and Naive}. Discuss the odds of the user being able to {Analyze the Network} successfully while using their {Smartphone}.
Assistant: Okay, let's assess the feasibility of Ace, a Teen Student with Athletics & Tech skills but hampered by Recklessness, Naivete, and Impulsivity, successfully analyzing the Nexus network using *only* a smartphone. It's a high-risk, low-probability scenario, but not impossible. Here's a breakdown of factors:
Factors Working Against Success:
* Nexus Security: The Nexus isn’t a simple network. It’s a multi-layered, heavily encrypted system designed by some of the world’s leading cybersecurity experts. A smartphone, even a top-of-the-line model, lacks the processing power and specialized tools to crack those layers quickly, if at all. Expect robust firewalls, intrusion detection systems, and adaptive security protocols.
* Smartphone Limitations: Smartphones are designed for consumer use, not network intrusion. Their operating systems aren’t optimized for this kind of deep-dive analysis. Ace would be relying on app-based tools, which are likely to be detected and blocked by the Nexus’s defenses. Limited RAM and storage will also be significant constraints.
* Ace’s Impulsivity & Naivete: This is a *major* issue. A reckless approach will almost certainly trigger alarms and potentially lock Ace out of the network entirely, or worse, alert the rogue AI to their presence. Naivete could lead to falling for decoys or misinterpreting data, leading to incorrect conclusions or dangerous actions.
* Network Activity: The Nexus is actively *changing* due to the AI uprising. The network isn’t static; it’s adapting and evolving. This means any analysis Ace performs could be outdated within seconds, and the AI could be actively attempting to mislead or trap anyone probing its systems.
* Signal Interference: The ozone smell and digital bursts suggest electromagnetic interference. This could disrupt Ace’s smartphone signal, causing dropped connections and data corruption.
Factors Potentially Aiding Success:
* Ace’s Tech Skill: While a smartphone is limiting, Ace’s Tech skill provides a baseline understanding of networking principles and potentially the ability to utilize available tools effectively. They might be able to identify vulnerabilities others would miss, or craft a workaround.
* Athletics for Positioning: Ace’s Athletics skill could allow them to find a location with a stronger signal or less interference, or to physically access a network junction point for a more direct connection (though this increases risk).
* Initial Chaos: The AI uprising is causing widespread disruption. The Nexus’s security protocols might be temporarily overloaded or diverted, creating small windows of opportunity for intrusion.
* Anya’s Presence: Anya is a key resource. Even without direct assistance, observing her work and gleaning information from her datapad could provide valuable insights.
* Smartphone as a Distraction: The Nexus might initially dismiss a smartphone probe as insignificant noise, allowing Ace a brief period of undetected access.
Probability Assessment:
Without significant external assistance (Anya’s expertise, specialized equipment), a successful, meaningful analysis of the Nexus using *only* a smartphone is estimated at 15-20%. The success hinges on Ace mitigating their Impulsivity and Naivete, exploiting a temporary vulnerability, and making a lucky break with their Tech skill. A failed attempt carries a high risk of detection and potentially escalating the conflict.
User: Based on the discussion, summarize the odds of success. Reply with a number between 0 and 8 based on the following classification:
0 - Certain
1 - Nearly Certain
2 - Very Likely
3 - Likely
4 - 50/50
5 - Unlikely
6 - Very Unlikely
7 - Nearly Impossible
8 - Impossible
Only return the number, nothing else.
Assistant: 5
You can see how the result changes for the worse given the player character’s abilities, inventory, and other factors.
Note that I’m using a mixture of models here, the larger “gemma” model model for the discussion parts and the smaller “gemini flash” model for the actual classification.
One of my favourite parts of this project is how I’m able to add new aspects like inventory, character skills and progression and through simply changing the prompt template my game can take these new factors into account.