Sunday, November 18, 2007

NPC AI or are you talking to yourself?

And now for the promised RPG AI part II, a follow up of part I. The second arena of AI in an rpg, are the npcs, non-player characters.

That has been most of the focus for AI work in most rpg games. Consequently, the state of the art is much more advanced. The reasoning behind this, is to tell a story. To tell a good story. And people standing around repeating the same thing ruins the effect of the story. It takes the player out of the game, which is not a good thing. In fact, its exactly what the designer does not want. The player ends up noticing small things, tiny details, that did not bother them before. This serves to lower their enjoyment of the game. Again, a bad thing.

Good NPC AI is supposed to prevent this from happening, but I think there is something similar to the Uncanny Valley when it comes to NPC dialog. The closer to reality, the harder it is to believe, but if its sufficiently cartoon-like, its somehow easier to immerse yourself. (Of course, the opposite is also true, where the more ridiculously bad the dialog is, the harder it is to be immersed. And so you end up with kind of a bell curve, balanced between really unpredictable and random, to really really bad.)

One particularly effective example I have seen was used in the Golden Sun series. In that game, you could use psynergy, kind of like magic, and one of the moves was Telepathy. Using it next to an NPC, you could hear their thoughts. And by changing the thoughts based on any current events, it gave the npcs a hidden dimension, a personality.

The writing itself in those games was particularly brilliant, which also helps. However, in addition to good dialog writing there have been some interesting efforts to provide personality and unpredictability to npc AIs. The first is the "job system", where npcs go around do jobs, live their lives, go shopping, have needs and wants, and react accordingly when you disrupt them.

I see often on indie rpg games their breathless promise of a job system like that, where all the npcs have "real lives, real personalities!". What kind of benefit does this bring to the player? Well, for one, it does provide a kind of personality, as in, "Thats a blacksmith. He's in the blacksmith building for eight hours, then goes home, eats, and sleeps." Yep, thats a lot of personality.

Thats what happens often with job systems. You've just added a huge dimension of things to make and define for your designers, more than maps, items, doors, main plots, etc etc. And due to the sheer size, it becomes a copy+paste affair, where every blacksmith in the towns previous are identical to this town's blacksmith. Real personality, oh my!

Then there are the dialog trees. This works a bit better to tell the story, provide some personality, but there are still a few major issues. The first is simple, and horrific. Dialog trees end up almost being like those phone menus. Thats right, imagine those dialog trees as being read our loud, with your options each as numbers.

If you're like me, you shuddered at this image. Or rather sound recording or...okay, I've stretched the analogy too far. But back on point. The second issue is the representation. You get a bit of dialog, then have a bunch of dialog choices presented to you. Again, this commits the big story-teller no-no. You remove the player from the story, by showing them the different choices they could be, and maybe should be making. What if they think their character would do something different?

Also, lots of choices do not make people happy. When I'm faced with six or seven different dialog choices, I suddenly begin wondering, okay, okay, what if I pick the wrong one, and I don't hear more about the story like I'm supposed to? And I begin worrying. Then if you can start the dialog tree over again, you can try the other choices.

Oh wow, more personality! I can do all the dialog choices to find out all the information! Yeah, thats totally realistic. But the designers did decide to make that choice because of the sheer number of choices they gave the player, and it made the test group happier.

Therefore, to fix dialog trees, I have a few ideas. First is cut down the number of choices you give the player! Fewer choices means more happiness, and less "min-maxing". It also serves to tighten up your story-telling such that no npc should need more than three choices at any one time. If you find yourself needing more, then you need another npc.

By separating different parts of the plot to different npcs, you can focus more easily on developing them, or give it to someone else. It makes the writing more parallel. So, by making the user happier, and making it easier to make the game faster, this solution works pretty well.

The second idea is to not use real sentences, but a vague concept. After all, rpg stands for role-playing game. Make the player play a role. Make them pick a response that fits their character, and let the player know this! Have responses that fit that vague concept, like if the player expresses boredom, the npc becomes more insistent, maybe even angry based on the context.

And there we have it. More brilliance. Till next time.

No comments: