Creating a persuasion-based Detective story with AI elements in dialogue

I’m a complete newbie–more of a writer than a game designer–and I’ve been trying to create a Detective game where the fiction is mostly on rails; however, the dialogue is using AI in order to test the player’s persuasive skills. You have to figure out the best way to get the characters to spill what they know in order to progress. Mostly, I was inspired by Facade and Suck Up! Of course, I know people are reasonably wary of all things AI. All of the writing of the story is mine; it’s just the dialogue where I bring in the robots.

Anyway, I’m curious about whether other writers have used AI in this way or have any advice about how to create interactive fiction that focuses on persuasive skills.

2 Likes

The game I think I’ve played that is most similar to that is an older one from 2023 called The Fortuna:

That game is about a student who wins a trip on a cruise ship and has to talk to cruise members. (I’m actually surprised it’s still running; it’s been up for years and looks like it uses a paid service called Crisp).

More recently, someone made a mystery sci fi game that was just an AI prompt (where the prompt was also written by AI): Penny Nichols, Troubleshooter - Details
This game had the issue (in the AI service I tried it under) that it gave away the prompt really quickly, so you couldn’t have any mystery because the ai agent wanted to bring up all the
secrets in the prompt right away (for instance, a doctor was actually a hologram instead of a person. The AI immediately, right when you saw him, said ‘he flickers, like he’s not really there.’)

If you’re serious about this, there are a couple of obstacles.
1-Breadth/scope. When you write dialogue by hand, the only text is what you write, so you start small and build it up until it’s interesting. With AI, it starts really broad with tons of dialogue options that are irrelevant or even damaging to your game. It can hallucinate new clues or suspects or change genres. If you can chain it down with very strict guardrails, then it could be serviceable. I don’t have any examples of someone doing this well.
2-Preservation. AI is a resource-intensive project designed to make money, and isn’t focused on archival. While you may not worry about your game sticking around, the IF community still plays games from years past, and many times authors come back decades later and are glad to see people revisiting their work. If yours depends on an AI service, it may not last long depending on pricing and service changes.
3-A lot of people have ethical and/or quality objections to AI. And, frankly, most of the AI-related games in this community have been awful. Some have successfully snuck in some ai-expanded text into middlingly-well-received games, but it’s unlikely that you’ll receive praise or esteem from more than 1 or 2 people on here. If that’s not your goal, though, I wouldn’t worry about it.

1 Like

There are games that pretty much do what you’ve described on these forums with community feedback for your review…
Amara
DetectivesGame

My only advice is that it’s really hard to make the dialog not feel like a chat-bot AND keep the AI focused only on sharing information and not agreeing to things that the game doesn’t support. With the sycophantic nature of LLMs, that’s a tall order.

Herding cats is a phrase that comes to mind.

Persuasion mechanics are about 50% of the gameplay of my and @EJoyce’s Lady Thalia series, of which the first game can be found here. Specifically, each persuadable NPC will respond to a Friendly, Leading, or Direct approach, and figuring out what works on who is an exercise left to the player, which people generally seem to find fun!

(It’s worth noting that while we label which responses go with which approach, I don’t think it’s inherently necessary.)

I think it’s also worth mentioning that with Penny Nichols and similar works it’s hard to get them to not roll over for the player regardless of what they say or do, which is the opposite of providing a challenge for the player to test themselves against. (One reviewer beat that game by typing “do the macarena” over and over, for example.)

4 Likes

This is a good idea because you can accomplish this without having any actual AI generated text in the game. You are essentially using the bot as a classifier. The problem is a lot of bots will classify very slowly or unreliably. The Player2 system I think is the fastest for implementing api calls in your game. Theoretically they want to make money with this, but if you’re only using it for classification, no player is going to get anywhere close to using up the free points they get. https://player2.game/ In my experience, the model that works the best is DeepSeek with reasoning mode enabled.

Essentially you are giving the AI a prompt that includes the persuasion task and the player’s input and asking it to return the word “success” or “failure” depending on its judgement. You can include aspects of the NPC’s personality, like “this character is more susceptible to intimidation,” thing like that.

Does this work well? I don’t know. I have a project that does something similar. Message me if you’re interested in trying it out.

Yeah, my personal opinion is that if LLMs have any place in IF, it’s for text processing, not text generation.

The problem is, well…the “large” in “large language model”. But it’s not like one-sentence classification tasks need top-of-the-line cutting-edge models. I haven’t seen any experiments in this vein that have really wowed me yet, but I suspect it will happen sooner or later.

I don’t have any experience with using generative AI for this sort of thing. But I’ve spent a lot of effort on developing the old kind of AI: algorithmically picking from weighted probabilities for NPC decision-making in games.

I don’t know how many crunchy details you’re interested in. And if you’re just looking for genAI stuff this is not that. But one of my goals was specifically to model player-NPC interactions, and the likelihood that an NPC would assist the player in various kinds of tasks, without relying on a simple, deterministic “collect hearts to maximize NPC affection” system like a lot of games use.

So without going into all the nuts and bolts (although let me know if you want the nuts and bolts), the idea is:

  • NPCs have a mental state defined in terms of scalar values on different mostly-emotional channels: fear, anxiety, isolation, and so on. There are also “physical” channels (hunger, fatigue), and so on. The value on a channel indicates how strongly the NPC responds to stimuli on that channel. That is, a high “fatigue” value doesn’t mean “the NPC is tired”, it means “the NPC is sensitive to being tired, and so being tired affects their decisions more”. There are actually two mental state vectors (one for the baseline values and one for current values, with the latter naturally decaying toward the former, but I don’t think the details are needed here).
  • NPCs also have a drive state expressed in the same terms. A high fatigue here does mean “the NPC is currently tired”. The combination of the drive vector and the mental state vector determines the general shape of the NPC’s current desires in terms of the mental space.
  • There’s also a set of channels describing “rewards”. The term I’ll use is “affordances”, which is just a bit of jargon meaning “what something provides”. This is stuff like a sense of security, a sense of social connection, and so on. Each NPC has a matrix with the mental channels as the rows and the affordance channels as the columns. So the value of each cell in the matrix is “how much does this mental channel affect how much the NPC wants this affordance”.
  • Decisions are queries in which each option is an affordance-space vector indicating how much of each affordance the option would provide (additional complication: this is actually what the NPC expects, not necessarily what the option actually provides, but again I don’t think you have to have all the details of this to understand the general design)

So when an NPC needs to make a decision, they get a set of options, each of which provides various “stuff”. They have a set of physical or external drives and an internal mental state. The projection through the matrix (this is just matrix-vector multiplication) gives the base desire. There’s actually additional behavioral stuff here that tweaks the desire vector in various ways (learned information about past rewards, biases, if the option involves another character, the NPC’s relationship with that character, and so on). But in the end you end up with a desire vector.

The final desire vector is combined with each option in the query (just vector dot product: adding up the sum of the products of each channel). This gives a list of scalars…integers…that are treated as the relative likelihood of the NPC selecting the corresponding option.

So, in slightly simpler terms: Each NPC has a mental state as well as natural drives. These make certain kinds of things more or less desirable to them, in an NPC-specific way. Options are expressed in terms of the desires they satisfy, and a little linear algebra turns that into a set of weighted probabilities used to make a selection.

Not genAI, so it doesn’t give you e.g. sentiment analysis on arbitrary player inputs. But it does have the advantage of having an actual semantic reading for all the moving parts (that is, you can actually follow the process through end-to-end and identify why and how an NPC picked something, which LLMs can’t do (despite what an LLM might tell you when prompted).

3 Likes

I think this is a very interesting approach. I’d be happy to hear more.

This (persuasion-based NPC conversations) has been done numerous times without the need of AI. I asked around in the Neo-Interactives Discord server, so here are some more examples (along with the main example of Lady Thalia, mentioned above):