I wonder how far you could go with a combination of fine-tuning and a two-pass generate & audit process.
Step 1. Fine-tune a base LLM to the scenario. Feed it as much background material as possible. This would work best for a franchise with a huge extended universe or associated works: Dungeons & Dragons, Star Wars, Doctor Who, etc...
Step 2. Fine-tune / RLHF with negative weights against anything out-of-context. Basically, stop the AI ever referencing anything that can't exist in the fictional universe. Penalise references to real-world events, places, or people, modern technology, etc...
Step 3. Fork the AI model, once for each character. Fine-tune for conversations in that character's "tone" or mannerisms, backstory, etc... These can be via RLHF generated with a powerful model such as GPT 4. Again, reward/penalise the AI if it references anything it should or shouldn't know from that character's perspective.
When players play the game and converse with characters:
1. They'd always be talking to an LLM fine-tuned to death for that specific character in that fictional universe.
2. Then have both the input and output run past a general-purpose "nanny" AI that is prompted to look for exploits, out-of-context shenanigans, or unexpected output. Respond to the user with "I don't understand the strange things you're talking about" or some similar general push-back against jailbreaks.
Alternatively, have the generic security filter AI rewrite inappropriate terms in user inputs with unintelligible garbage. E.g.: if the user asks
"Are you a computer?"
Rewrite that to:
"Are you a gizwallop?"
Then the in-game character would rightly be confused by the nonsense term and answer something like:
"I have no idea what you mean, what is a gizwallop?"
Which could be translated back to:
"I have no idea what you mean, what is a computer?"
This would be absurdly expensive and slow
right now, but in 5 years? 10?
I can imagine the cost of tuning the above for a GPT5-equivalent model dropping down to the budget of even a tiny indie game, let alone big-budget AAA game studios.