Advertisement

Chattering NPCs

Started by April 11, 2006 10:06 AM
19 comments, last by Kitt3n 18 years, 9 months ago
Something that I have been penning out is a system where all NPCs are stored as a memeber of a subclass of a faction, most of which would be generated as filler against what is put in by the programer.

So, you have a group of characters that belong to one group that takes up a city block, say, 10 buildings. One of these might be an important character, the head of one of the houses maybe. The rest are generated as one of a few Types of characters. Short roamers, roam just around their building, long roamers would roam the whole city, making upto 10 connections with other factions (maybe more, maybe less) and then returning at some point during their day to 'home' points. Gathers can be like long roamers, they move around and get food and supplies from other NPCs (this is only needed if you want an ecomony that is partly self balancing)

Now, a faction will have a 'topic history' from which they can draw things to talk about to the player, or to each other. These can be partly from a sort of scripting system "Did you hear about X?" "no, what did X do?" "well, X was arrested for sleeping with Y" "why is sleeping with Y something you can get arrested for?" "Y is the king's daughter you fool, you should know that" Or something even more complex than that.

Where this Topic History would be taken from, is from their own event and topic history of what the roamers find. Their event history would be partly random "I broke my comb today", or "Someone robed me last night!". All events would have a status level. The more 'important' something is, the higher the level it gets. The higher the level something is, the more likely it is to be passed on. The factions can have different levels themselves, and will gather info for their Topic History from levels at or above their own. The king being killed would be a very high level event, from a high level faction. That means EVERYONE is going to be talking about it. Begger killed in a back ally, not many people would be talking about it as while the event is a high level, the faction isn't. But it could be coded to have similar events, or events caused by a similar faction to slowly raise in level. The pirate gang might be a fairly low level group, but them doing lots of things could bump it up higher.


Sorry this isn't explained better, as usual I'm doing too many things at once and typing this like half a sentence at a time. If anyone is wondering this is the basic stuff for a design I was working on for a better NPC. I'm tired of a 'great city' with like 200 people living in it, so the goal was to get a system where stuff can be generated on the fly as needed by the player, and only updated when called for, but have cities with 'thousands' of people that seem to act like they would in real life.
Old Username: Talroth
If your signature on a web forum takes up more space than your average post, then you are doing things wrong.
Quote:
Original post by Jon Alma
However, doesn't Oblivion include sound for every single line of dialogue, important or not (and from this directional sound suggesting who is saying what)?
It has like a mini cinimatic style thing where it pauses the game world and focuses on the face of who's talking. However, they reuse spoken bits, so for instance with a begger, when he speaks, he could sound like a somewhat young or middle aged person then when you give them a coin, they all sound like old men with somewhat of a raspy voice.
Advertisement
The game only focuses on their face if you're talking to them; they still talk to each other in a modeless fashion.

But you're right when you say they reuse speech, I find it quite annoying. It's especially bad with characters that have distinctive voices, really ruins the immersion of the whole thing. Though having said that, it's better than just not having voice clips for unimportant characters, as Jon said.

I recommend having speech appear in a bubble above the characters' heads; if it's just idle chit-chat for immersion, it doesn't matter if the player misses out on what's happening behind them. Sims-like babble could help out there though, if you really want players to hear everything :)
Quoting everyone a bit at random ...

Quote:
Hey Jon, seems like we're working on similar things :D

In my game I have my NPCs tagged (like rich, poor, etc) then I have conversation nodes invisible on the game map. Now and again the nodes check which NPCs are in a certain radius and try to load a conversation script that allows the NPCs to speak.

I intend to put the nodes in places like taverns and the like but I'm still working on the maps at the moment.

Very similar things ;) ... I also have node network, primarily to help with navigation around built up areas, but each node will also have an activity attached to it. For example one node might be linked to buying things so the NPC switches into the talk animation and starts complaining about prices. Another node might be for guards to stop and look round before moving on to the next leg of their patrol routes. For the moment at least each NPC ends up with its own node network, but ideally I should improve this so each node will 'offer' a variety of different tasks which NPCs can choose from depending on what they are allowed to do.
Quote:
Also do you have development blog or similar I wouldn't mind keeping track of your progress.

Not really - there is the website (see my sig), but this is a hobby project that I work on when I have some spare time between the day job and the family ... progress is too slow for blogging!
Quote:
Something that I have been penning out is a system where all NPCs are stored as a memeber of a subclass of a faction, most of which would be generated as filler against what is put in by the programer.

So, you have a group of characters that belong to one group that takes up a city block, say, 10 buildings. One of these might be an important character, the head of one of the houses maybe. The rest are generated as one of a few Types of characters. Short roamers, roam just around their building, long roamers would roam the whole city, making upto 10 connections with other factions (maybe more, maybe less) and then returning at some point during their day to 'home' points. Gathers can be like long roamers, they move around and get food and supplies from other NPCs (this is only needed if you want an ecomony that is partly self balancing)

...

Sorry this isn't explained better, as usual I'm doing too many things at once and typing this like half a sentence at a time. If anyone is wondering this is the basic stuff for a design I was working on for a better NPC. I'm tired of a 'great city' with like 200 people living in it, so the goal was to get a system where stuff can be generated on the fly as needed by the player, and only updated when called for, but have cities with 'thousands' of people that seem to act like they would in real life.

Reminds me of a sociology modelling book I read a while back ('Building artificial societies' or something like that) where rules were set for different types of agent (soldiers, hunter gatherers, etc) and then off they went and created their own civilisation in a simulation. Groups would go on raids to capture or guard scarce resources and so on and really quite sophisticated behaviours could be modelled very quickly. I thought it might be the basis for more realistic AI in a RPG or RTS, but never got round to doing anything in this direction ... good luck and I'd be interested to see how this works out.

Personally I've taken the approach that each NPC will be individually defined and as such there has to be a relatively small number of them (also because each NPC is pretty 'expensive' in terms of system resources) and as such I'm creating a 'world' around these low population constraints so the numbers feel right ... at least that's the plan!
Quote:
The game only focuses on their face if you're talking to them; they still talk to each other in a modeless fashion.

But you're right when you say they reuse speech, I find it quite annoying. It's especially bad with characters that have distinctive voices, really ruins the immersion of the whole thing. Though having said that, it's better than just not having voice clips for unimportant characters, as Jon said.

I find it a bit strange that the reuse of speech is so obvious. In Morrowind there were generic snippets of speech that any character from the same group (race, gender and even group) could use and there it was less obvious that every character in a group had the same voice (except when in crowded areas of the same type of NPCs where they would start a chorus repeating the same phrase again and again). Perhaps it was because the NPCs were more similar (same ages, etc) or because I played the French version and there was less effort put into having distinct voices and characters.
Quote:
I recommend having speech appear in a bubble above the characters' heads; if it's just idle chit-chat for immersion, it doesn't matter if the player misses out on what's happening behind them. Sims-like babble could help out there though, if you really want players to hear everything :)

Speech above the characters' heads seems to be the way to go. Bubbles and Sims-like babble I'm not so sure about, but worth a bit of prototyping.

Jon.
_______________________________________
Legends from the Lost Realms
Quote:
Original post by Jon Alma
I'm working on a talking animation for the NPCs (gesturing arms, etc), but this is not always going to be appropriate (switching from an attacking animation to the polite talk animation to say "I'm going to kill you!" and then switching back?) and for the moment the best general solution I can think of is to include the name of the NPC in the subtitle (as in the example above). Any better ideas?


I liked how Stan gestured while talking in the Monkey Island series.

"a deal's a deal, right? Right. Catch ya later. Good luck. Enjoy. I'm outta here."


After all the useful advice everyone gave me I thought I would give a little update. I did some prototyping, particularly with the concept of floating the subtitles above the character speaking, but found this didn't really sit confortably with the 'feel' of the rest of the game (and also that a lot more coding would be needed to get the prototype up to release standard). I then feel back to having the subtitles grouped together and preceded by the NPCs' names and this, while not perfect seemed to work quite nicely. From there I tidied up the existing info window code (that informs the player of where a door leads, what town they are entering, etc) and now have a combined information and NPC chatter window as shown here. Still needs a bit of refining, but so far I'm quite pleased with how things have worked out.
Jon.
_______________________________________
Legends from the Lost Realms
Advertisement
That screenshot looks nice, but when reading the dialog it kinda felt like I was reading a book -- same thing as with long item descriptions and such things in RPGs.
Since the conversation is in real-time, I think it feels a bit artificial and out-of-place. Actually I think floating balloons above the characters' heads would be much better.

Another thing I'd like to point out is that repeating text is SO easy to fix! Code a simple parser for your text that chooses one of different variations of the same expression.
So in the middle of a sentence you can include something like (a|b|c) and it will replace that with a, b or c. Trivial to implement and unless you're vocabulary-impaired, it really spices up any piece of dialogue :) I had some fun results with a description of an orc attack to a peaceful town :P

Quote:
Original post by Jotaf
Since the conversation is in real-time, I think it feels a bit artificial and out-of-place. Actually I think floating balloons above the characters' heads would be much better.

To be honest I agree that having the dialogue appearing in an info window is not ideal, but having spent some time playing about with the frequency with which NPCs start to chatter and the rate that each line of dialogue then appears it feels ... okay. I had high hopes for, if not floating ballons, at least floating text above the NPCs' heads, but in prototyping this I was disappointed with the result ... it didn't really feel right, tended to clutter up the display and in general didn't work that well. A lot of this had to do with the first person view ... I got the impression that with an isometric / eye in the sky view this would actually work well, but in first person the field of vision is quite restricted (at least in my implementation) and already quite busy. One big question that the prototype raised was how to handle situations where one or both of the NPCs were off or nearly off screen (but still within hearing range) - here it was no longer possible to have floating speech above the NPC's head so it looked as if I would have to use subtitles at least some of the time. I'm sure that problems of this type could be sorted out with more elaborate coding than I had in the prototype, but given that the info window solution was giving good results I decided to go down this route ... and if ever real speech makes it into the game these optional subtitles are probably less intrusive.
Quote:
Another thing I'd like to point out is that repeating text is SO easy to fix! Code a simple parser for your text that chooses one of different variations of the same expression.

In the end this is actually not a problem ... I've very simply set up a timer on each dialogue script so that it cannot be repeated too quickly. Then with a bit of the game balancing to ensure that there isn't constant NPC chatter and a nice range of different dialogue scripts I seem to have avoided this pitfall.
Quote:
So in the middle of a sentence you can include something like (a|b|c) and it will replace that with a, b or c. Trivial to implement and unless you're vocabulary-impaired, it really spices up any piece of dialogue :) I had some fun results with a description of an orc attack to a peaceful town :P

I did briefly think about doing this but in the end I've stuck with fixed scripts mainly because it only takes a few seconds (okay a minute or two) to create a new script by hand. And as many of them are story driven (even if often to a very limited degree) there aren't a huge number of opportunities to include this type of flexibility. Either that or I'm still recovering from having to do something similar in Prolog in an AI class at uni many years ago. Or I'm just vocabulary-impaired ;)

Jon.
_______________________________________
Legends from the Lost Realms
Quote:
So in the middle of a sentence you can include something like (a|b|c) and it will replace that with a, b or c. Trivial to implement and unless you're vocabulary-impaired, it really spices up any piece of dialogue :) I had some fun results with a description of an orc attack to a peaceful town :P


If you do something like that, don't forget to consider lokalization - some
languages have other word-order and that will come back to bite you (unless
you are only considering 1 language)


visit my website at www.kalmiya.com

This topic is closed to new replies.

Advertisement