Inworld AI Mod - How Am I Creating Characters? (Patreon)
Content
Hey Patrons,
So, you probably all have seen and played around with the Inworld mod, which gives you the chance to interact with the AI NPC's in the game.
When mod first came out, I remember some of you asked how this interaction is happening and how I am creating the characters. In this post, I will touch down on some details on how I am creating the characters.
All animals are equal but some are more equal
Not all NPCs are same. This is same for AI-side as well. Currently, I'm separating the Heroes (NPCs that are lords and ladies) from the regular NPC's on the street. What does that mean? This means, every person you talk in tavern and street is actually getting generated moments before you initialize the chat. This is also the reason you are seeing "Not ready" type of messages in certain chats. The reason this is way faster than creating characters in the Town Keep is because how Inworld works. Instead of “generating” the character in Inworld's side, I'm actually updating and redeploying an existing villager/townsfolk character with new information. This gives near-instant type of character initialization. However, downside of this, if you spoke with character A in tavern, and later talked with character B, then character A is gone - forever. Even if you walk back to character A and talk with it, you won't be able to get same character. Name and entire backstory will be completely different. And this is the reason I don't follow the same formula with Lords and Ladies. Because unlike random NPCs, lords and ladies should have consistent and memorable characters, so that they can follow up their actual agenda.
But how do I generate townfolks? Well this is where story engine comes in. Story engine is, in essence, is just a big corpus of text, that includes several handcrafted background pieces. This background pieces differ from villager to townfolk or kid to elder. For certain categories, I pick background stories, add proper context (town name, war name etc) and stitch these together before passing it to Inworld. With this, we get many different combinations. Like, if we have 10 for childhood, 10 for early adulthood and 10 for adulthood - we already end up having 1000 unique characters. And now add some randomness to this, like 10 gossip information and such, you are multiplying the numbers more and more. It's basically the reason one character is unlike any other character. If you are curious, you can see it in here (Around ~1k lines)
What about Lords and Ladies?
Well they are similar to regular NPC's but not exactly. Firstly, they are persistent, as we previously mentioned. They don't get to regenerate over and over. What they do get is, they get “updated” when you enter a scene. This can be related to old memories, or situation around the town they are in or about very personal things like your bad behavior towards them (i.e. if you killed their family member etc.)
They also have a similar backstory building process to other NPCs too. Though, these are more specialized towards their characters. Meaning that, if a lord is very ambitious etc, they have a backstory that's more fitting to their current traits. This gives an excellent way to stand their actual characters out.
With updating their character facts, I'm creating some very noticeable way of how they behave when you do something they should have remembered. This might be you defeating them in battle, or killing their family member. These are not related to Inworld's memory system and AI will always remember these (whether they will mention this or not is up to AI though) and I'm also passing your relationship information to AI as well, this means if NPC lord hates you in Bannerlord, he will continue to hate so in chat too, because AI will have negative view on you.
That's basically all. I know it's quite long compared to my other posts, but believe me, I only touched the surface of it. Feel free to ask away your questions in Discord (Patrons only channel) or here.
Just to heads up as FAQ
- Is there a memory going on in the mod now?
= No. This is related to Inworld. In the mod system, I'm continuing the same conversation and Inworld should pass that conversation information to AI so that it can remember past conversation and answer accordingly. Unfortunately, there is nothing I can do to fix this and this should get fixed “magically” from Inworld's side without needing of any update from you or me.
- WE WANT TO TALK WITH OUR WIFES
= Yeah, it seems like very desired function for some reason (😀) I will surely look at this and try to enable having conversation with companions and wifes. But as you can understand from this post, it's not fitting in the Lord or random NPC description. So it requires quite a bit work. This is the reason why I'm holding off.