Imagining a simple but effective AI system for BG3
Lemernis
Member, Moderator Posts: 4,318
As we know BG3 is still a gleam in Trent Oster's eye (well, as far as we know). But I do have confidence that it will eventually become a reality. So I'm offering the following vision for the role of NPCs in the game, and encourage feedback and other ideas.
There is a premise behind this vision. I started a game last year that has truly been an eye-opener for me for what the BG experience can be. It is chronicled in a thread called Let the Fates Decide. In this game, for various situations what I have done is to combine chance through sometimes flipping a card or rolling a die with roleplaying of alls NPC in the game. Thus, in response to any given situation in the story, if I feel the NPC would do something that is in-character for them, that is what they do. But if I have some doubt about what the character might do, I flip a card for yes vs. no, or roll a die for a more complicated outcome. And sometimes just for fun value, I'll flip a card or roll a die to add a bit of unpredictability to the game.
In this way the NPCs make decisions in the game that are thoroughly independent of the player-character, and even independent of me the player. If I roleplay the character by imagining who that character is and what makes him or her tick--i.e., what the NPC's independent motivations are--that may not at all be what I the player wish to happen. This includes relationships that form between characters--friendship, mistrust, plans devised between NPCs, etc. There's a kind of story arc for each character within the greater story.
So... I'm now trying to envision how such a system could be implemented into a CRPG. And what I'm seeing is a kind of simple (? okay maybe not so simple, lol) AI, really. One way to go about it would be to have a bank of potential responses for each character in relationship to one another and to various story elements. What happens in a given situation is then determined to some extent by the past (e.g., when a strong bond of friendship has developed between two NPCs then the probability of continued friendly interaction for the most part is high, versus bickering). But it is to some extent determined also by a random chance variable, i.e., a die roll.
A major challenge is figuring out how complicated the factors that determine the personality for a character should be. The character should have unique motivations and exhibit a kind of independent life of their own. But the system has to be elegantly simple enough to be feasible.
It seems to me that the overall challenge would be finding the sweet spot between the AI's roleplaying of the character according to a unique personality, on the one hand, and infusing an element of random chance into that process, on the other.
Edit: As far as combat goes, the player would still control NPCs.
So that is the basic concept. Thoughts, ideas, opinions, alternative visions, are of course welcome.
There is a premise behind this vision. I started a game last year that has truly been an eye-opener for me for what the BG experience can be. It is chronicled in a thread called Let the Fates Decide. In this game, for various situations what I have done is to combine chance through sometimes flipping a card or rolling a die with roleplaying of alls NPC in the game. Thus, in response to any given situation in the story, if I feel the NPC would do something that is in-character for them, that is what they do. But if I have some doubt about what the character might do, I flip a card for yes vs. no, or roll a die for a more complicated outcome. And sometimes just for fun value, I'll flip a card or roll a die to add a bit of unpredictability to the game.
In this way the NPCs make decisions in the game that are thoroughly independent of the player-character, and even independent of me the player. If I roleplay the character by imagining who that character is and what makes him or her tick--i.e., what the NPC's independent motivations are--that may not at all be what I the player wish to happen. This includes relationships that form between characters--friendship, mistrust, plans devised between NPCs, etc. There's a kind of story arc for each character within the greater story.
So... I'm now trying to envision how such a system could be implemented into a CRPG. And what I'm seeing is a kind of simple (? okay maybe not so simple, lol) AI, really. One way to go about it would be to have a bank of potential responses for each character in relationship to one another and to various story elements. What happens in a given situation is then determined to some extent by the past (e.g., when a strong bond of friendship has developed between two NPCs then the probability of continued friendly interaction for the most part is high, versus bickering). But it is to some extent determined also by a random chance variable, i.e., a die roll.
A major challenge is figuring out how complicated the factors that determine the personality for a character should be. The character should have unique motivations and exhibit a kind of independent life of their own. But the system has to be elegantly simple enough to be feasible.
It seems to me that the overall challenge would be finding the sweet spot between the AI's roleplaying of the character according to a unique personality, on the one hand, and infusing an element of random chance into that process, on the other.
Edit: As far as combat goes, the player would still control NPCs.
So that is the basic concept. Thoughts, ideas, opinions, alternative visions, are of course welcome.
Post edited by Lemernis on
2
Comments
NPCs each have personalized ways of carrying out those scripts and some may even disregard those commands (as usual CHA, skills, relationship, morale time spent in party yadda yadda affect this)
So say a Archer NPC can be ordered to fire arrows and since he's an archer he'll follow that command and unlike Archer NPC 2 he might target certain enemies first because racial hatred or RP stuff while Archer 2 targets stuff he thinks would be most dangerous. But if he's ordered to fight with a melee weapon then he may not follow that.
But the option to fully command the NPCs should still be there because stupidity caused purely by ths limitations of how the AI is coded (instead of incharacter stupidity) is largely unavoidable.
Here's an example of how it could be implemented:
But sure enough, there could be some neat scripts that are optional that might have them behave independently in combat or in terms of basic class duties as well. I'm just not sure how it would mesh with the AI though. Might be tough to get those two things to work together...
For example, using BG1 as an example, let's say Keldath has a bank of potential reactions to the party and their deeds. There would be some variability to how he interacts. It has to be from within a finite set of possible responses in order to be feasible. But it could be based on a number of factors such as his reaction to the overall average of alignment axis quotients for the party (presumably he would cast Know Alignment), and the deeds that the party has performed. And what responses have already been chosen when talking to him in past interactions. Whether to add a random variable of unpredictability to that is tough to say... It could work, theoretically. But it would have to remain consistent with the AI's "roleplaying" of who Keldath is in his own right, first and foremost.
I think for minor townsfolk NPCs (the garden variety commoner or noble) there could be a very high level of (random) variability, though. That is, with respect to what information they might provide.
What you could do, though, is use charisma and reputation checks for most dialogue, even between NPCs. Low-charisma characters are going to most often get poor results when talking to other people, while high-charisma characters (or characters casting Friends on themselves) will generally get positive reactions.
The implementation wouldn't be difficult, but it would require a lot more dialogue to be written, and when you're only going to see maybe a third of that dialogue in a given playthrough it becomes difficult to justify.
Random outcomes also makes it harder to plan a complex story. I feel like you'd have to make the game itself about a third of the length, just to ensure that no branch of that ever-changing tree is left without a compelling story.
And then, too, as you noted, to do this in a way that doesn't have jarring out-of-the-blue things happen that just don't make sense. So there has to be a sort of algorithm that maintains a degree of consistency once a behavioral pattern is established.
Another thought is to have a slider for how much randomness, although that may push the system headlong into unwieldiness.