• Create Account

# How to make NPC's "gossip"

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

67 replies to this topic

### #41DrMol  Members   -  Reputation: 122

Like
Likes
Like

Posted 27 February 2002 - 08:35 AM

Sorry if Im dredging up this topic, but what AP had, the Interest variable is a good idea. Ive been messing around with a general experiene scheme where a character is better to do things sorta like what he knows well.
Example:
A Blacksmith can make a sword.
Two disciplies that are close to it are say, tinsmith and silversmith. Granted that they are a bit different, but after maybe a day or two the blacksmith can learn to do some stuff with the other metals, but maybe a carpenter would take a week, a cobbler 2 weeks, a weaver, a month, etc.

It would be arranged in catergories,

Workers
Raw
Metal
Wood
Textiles
Weaver
Cobbler
Food
Baker
brewer
Consumers
Soldier
Nobles
Priests

And so on. Something that fell under raw would be better done by a worker who uses raw materials, less good with textiles, and even less good with food....
What you should add into that struct is a varialbe like

short Disicpline

Say Orcs Raid Happytown, that would stick it under, well maybe that would be all.

Something like
The Elven Nation has cut off wood supplies to HappyTown!!!

Protaganist: Elven Nation
Location: HappyTown
Verb: Embargo
Noun: Wood
Disicpline: Worker-Raw-Wood

it will be a hot topic for carpenters
less so for ore workers,
bakers wouldnt care
and soldiers would tell them to STFU.

That protaganist was stuck in on the fly, BTW, but I think it works better than just location, which is bad for something like that.

### #42sjm  Members   -  Reputation: 122

Like
Likes
Like

Posted 28 February 2002 - 08:26 AM

Just thought I ought to remind you that in a game your NPC''s dont have to REALLY converse with each other...
you see, it all boils down to perspective - if the player is playing the game then obviously the player has to be able to converse. but npc A and npc B need not really converse in order to know something.
It might not be quite what you are looking for, but I would suggest that you economise your npcs and try to approximate this exchange of knowledge, rather than really exchanging it. Rather than have an npc who knows some information, simply specify what information there is (ie happytown is raided), and how dispersed the information is, as well as time stamps etc.
Now when the player is in Happytown, obviously everyone ought to know (local news, important). If the player is in Gundringsville or wherever an npc MAY know about this information. If its important and Happytown is down the road, then let a load of the npcs have the info. If not then either only a few (as you say you can classify info) or none have this info.
Rather than exchanging info, you only need vectors between locations - which can indicate how much exchange takes place between the two, and how long the minimum exchange type is. Now whenever the player talks to an npc, you can determine what the npc knows. As you are mainly interested in gossip (ie not SUPER IMPORTANT QUEST INFORMATION) this doesnt really matter. Ok to keep things consistent whilst in a location the npcs shouldnt be forgetting and then remembering info randomly, so you might have to store some more info, but once again - only that of those npcs that the player has talked to. The rest are totally irrelevant from the players point of view. Basically its a computerised Schroedingers Cat ie until we actually examine the NPC we have absolutely no idea what state he is in, but by examining him, we automatically have assigned him a state (ie the cat is now dead).
You can expand this to the events themselves if they are random - no need to have events taking place that the player can have no knowledge of, so only when interacting do you need to determine whether there is any gossip.
Basically you dont need to simulate the entire world to get a working approximation of one, and generally its these sort of things that get in the way of good gameplay imho.

### #43Puzzler183  Members   -  Reputation: 540

Like
Likes
Like

Posted 28 February 2002 - 01:38 PM

That eliminates the whole purpose of an NPC having a knowledge base, and gossipping.

### #44DrMol  Members   -  Reputation: 122

Like
Likes
Like

Posted 28 February 2002 - 08:07 PM

I think it would be cool to be able to "overhear" (ie, see text over the character head) gossip in a tavern (maybe make it a range factor, but that really doesnt fit in with the whole isometric concept), nothing inegral to the game, but I would be sitting in the tavern (That is another thing, you guy NEVER sits down). No one does in a lot of games. People stand around all day, in an age before pediatry), see the gossip, and then the next table over, the kid says "I heard theres gnna be a war with those elves." And you look up and either take note or you go over and try to nose your way into the conversation. I guess the danger is information overflow.

Maybe the entire knowledge base would be composed of structs, but dynamic.

### #45Gollum  Members   -  Reputation: 122

Like
Likes
Like

Posted 01 March 2002 - 02:07 AM

To sjm:
Though I think you are certainly right about avoiding needless complexity, and while most games get away with far less than even what you suggest, I have to disagree with you.
Having NPC''s with knowledge that is random and non-persistent has several disadvantages compared to an NPC that stores addresses to the universal knowledge db. Here are some reasons your proposed system would be unsatisfactory (to me):

1. When you meet the same person on two (or more) occasions, their knowledge may be different every time.

2. Who has what knowledge is random.

3. You never know whom to ask about certain kinds of knowledge.

4. There is no incentive to talk to any one kind of person versus any other kind of person. With the type of system we''ve been talking about, it would actually make sense to go to taverns looking for info, because that''s where the travellers are, and they know the most info. Up until know, going to the inn for information has been an artificial construct in games. We go there because we know that''s the way games are written, not because the game world "works" that way.

Anyway, you may think to yourself (and clearly many game programmers have) that these aren''t reason enough to take on the processing overhead of gossiping NPC''s. I think there is an optimal level of complexity in how they do it, but I think the added realism definitely makes it worth doing.

IMHO,
gollum

### #46sjm  Members   -  Reputation: 122

Like
Likes
Like

Posted 01 March 2002 - 02:13 AM

true it eliminates the purpose of npcs gossiping.. but the question is.. do you want your npc''s really gossiping or a fun game... remember, as a programmer it might be interesting as a player its probably fairly irrelevant as long as it appears that they are gossiping.. the game mechanics ought to be transparent to the user!
if you''ve got a masssive game with loads of npc''s I cant see it being really feasible having them all really interacting (I''m thinking of something big where you may well have a few 1000+ npcs in your world). they''re are surely more important uses for your cpu time... obviously its a lot more feasible with a small amount of npcs, but at some point you are going to have to generalise and approximate imho.

### #47sjm  Members   -  Reputation: 122

Like
Likes
Like

Posted 01 March 2002 - 02:33 AM

on the topic of randomly dissapearing info, of who to ask for what, well you simply have to generalise here again - as you mentioned previously. If you can determine what sort of knowledge what sort of person has (ie treacherous in a thieves guild or whatever) you can simply check to see if this npc has access to such info (ie he is a thief or whatever) As long as you have a communication path to the npc I guess its up to the prgramming mechanics to determine when/how often an npc has info and is willing to share. This way you can eliminate the random appearance of knowledge without getting to bogged down with the implementation. I don't see how having npc's gossiping will allow a player to know who has what info, as its the npc's gossiping not the player . You simply move the random element of npcs gossiping to the random element of "whether an npc may have gossiped". Other info that might determine what knowledge an npc has is his/her hometown etc. As long as you have a simple economic model you can easily determine where an npc can come from. If an event causes a mass exodus, well you simply have one of the directional flows stronger than the other (ie all vectors out of happytown are weighted heavier because of the orcs than those entering happytown)
If you really want the information an npc has to be consistent over a period of time you will still have to store it, but the overhead of storing what npc's the player has talked to know vs what all npcs know is drastic.
I'm not saying its a bad idea to gossip - it would definately make the game more dynamic, especially if the mechanics of the world are as you say not deterministic. (ie each game is different and the orcs may not always attack happytown).

Edited by - sjm on March 1, 2002 9:33:51 AM

### #48Gollum  Members   -  Reputation: 122

Like
Likes
Like

Posted 01 March 2002 - 04:30 AM

Well, let me explain a bit more.

I brought up this idea because it is one part of my ideal role-playing game. To me, the ideal role-playing world would be one that could be randoly generated (and therfore basically infinite) and still make sense. Since the quests (for the most part) wouldn''t be written by humans, you''d have to have them naturally occur from a living, breathing world. Then your goal as a player would become much more involved. Instead of trying to figure out what the designers wanted you to do, or following the arbitrary rumor path from one town to another, things would just happen in the world, and you''d have the opportunity to react to them. Or not.

So, what would be necessary for such a game? While I don''t even pretend to know how to build it, I have a lot of ideas, and I''ll build them into my program as I can figure them out. But I imagine we''d want at least the following:

1. Lots of NPC''s.

2. A working economic model (supply and demand, which allows for shortages, starvation, etc.).

3. Some form of political simulation (i.e., different groups can decide to go to war or make peace with each other).

4. NPC''s will be divided into two main groups. "Basic" NPC''s will do little more than keep the economic model going, be able to fight, and pass along information (i.e., participate in the gossip system). Then there will be specialty NPC''s, who parrticpate in politics, are tradesmen, theives, etc. Some of them would probably be adventurers like your player.

5. A way for information to travel, so you can know what''s going on in the world, and NPC''s can know what you''re up to.

There are probably others. Does that sound like a lot? Maybe so. But I think when you break it down into smaller chunks, it''s very do-able. I have noticed some recent games, like Gothic, implementing pieces of this.

Basically, I don''t want to feel the limits of the game world. I want to feel like my actions have real effects. And I want a world that I could essentially play in forever, if I so chose.

So, in that context, I think the gossip system is pretty important.

As for storage, I think that my version of this (which is a lot simpler than what some others would propose) is pretty simple. have a universal table or database of all events worth noting. Individual NPC''s don''t store all of the info about an event, only the "address" of the info. When an event occurs, just propagate the event info address to all the relevent NPC''s. So, you would be storing one record of each event, and each NPC would have a list of event addresses. I don''t think that would be too bad.

Now, I would try to scale it so that NPC''s who aren''t on your screen (or within some distance) have a scaled-down way of deciding when/how to trade info. Two NPC''s travelling through the wilderness half a world away from your player will not have to do collision detection (to see if they meet), for instance. It''ll just be some random chance of meeting.

Hope that clears up what I''m thinking,
gollum

### #49sjm  Members   -  Reputation: 122

Like
Likes
Like

Posted 01 March 2002 - 04:43 AM

hehe, I had a similar idea too - you know how it is, things occur like war breaks out, or the king dies or whatever and the game goes on and on - much like a "real" rpg where the gamemaster takes over this role.
As long as you aren''t really simulating each npc''s life (which is the impression I got at first) it should work, although as you say you will have to simplify, so that npc''s two worlds away aren''t really doing anything. Obviously gossip can work well as you describe in a small area (say a town or province). Perhaps you need a sort of hybrid system - npc''s really gossiping within a given location, and information flow from one location to another (as opposed to actually moving npc''s around).

### #50Extrarius  Members   -  Reputation: 1416

Like
Likes
Like

Posted 17 January 2003 - 04:58 AM

I think you could fake the gossip travling like sjm said, AND have it be persistant AND have npcs that know more about their specialty than anybody else. The way I would do this would be to have a list of all the information with various data about each piece of info (like where it originated, how generally interesting it is, what type of specialty it applies to, when it happened/was found out/etc) and then have NPCs have some kind of varous knowledge 'skills' (with higher values for the NPCs specialties). To see if an NPC knows something, you would take into account where the info originated, how long ago, where the NPC has been, how generally interesting it is, add in the NPCs skill in the specialty it applies to (if any), etc to get a % chance. Then, use the pointer to the NPCs struct or its ID or something else unique as a seed to a random number generator. Make a random number using that seed, and see if it falls insidde the %. If so, it knows it. If not, it doesn't. Over time, the % chance that something is known would go up and eventually everybody would know it.

The one thing prevented by using the above is that players wouldnt be able to teach NPCs direct info. You could make NPCs skills rise temporarily after talking to a PC to make it seem like the NPCs are learning, and hope that by the time the player comes back, the % will have risen enough that the NPC will know whatever it pretended to learn earlier.

Or, if you just HAVE to do it for real, use an array to store all the info and just store an array per PC of indexes to the info they know =-)
You could always just use the fake method to decide what data to add to NPCs that are off screen, so you don't have to keep track of every single 'conversation' that might take place off screen.

[edited by - Extrarius on January 17, 2003 12:03:27 PM]

### #51The Heretic  Members   -  Reputation: 146

Like
Likes
Like

Posted 17 January 2003 - 11:38 PM

WTF?!? This thread is ancient... I remember seeing it in my earlier days here (before registering this account). Anyway I''ll write a more detailed post as soon as I reread it all...

### #52The Heretic  Members   -  Reputation: 146

Like
Likes
Like

Posted 17 January 2003 - 11:57 PM

OK... I agree with Puzzler183''s approach, largely because I have already implemented that, and I am currently implemented save/load features for it. I also plan to make an inference engine with it: for example:

if x is y and y is z, then x is z
if x ix y and y (any link) z, then x (any link) z

Then when that link is put in place between the two, you calculate the new truth values as follows (psuedo code):

So that is one is thought to be 90% true, and the other is 100% true, then the new link will be 90% sure that it''s true. On the other hand, if computer is only 90% sure about the second link, it will only be 81% sure about the new one. If you want falseness, you can just have very low values for sureness of truth...

### #53Simage  Members   -  Reputation: 122

Like
Likes
Like

Posted 18 January 2003 - 11:26 AM

k... silly question... everyone seems to be using unsigned chars for the truth value... anyone thought of implementing it so that positive values are true and negative values are false?? I know its not really that big a deal, just seems to me that it would be a little more intuitive than 0 being false and 255 being absolutely true.

### #54The Heretic  Members   -  Reputation: 146

Like
Likes
Like

Posted 18 January 2003 - 01:43 PM

First, you can''t do what I said above... It just makes inference more difficult... Second, the idea is a good one until you get into special cases. For example, links shooting off of links, etc. If that doens''t apply then maybe this does: is it really worth it? My link struct is 6 bytes (without age), and it would be 4 for every pointer. I habve 768MB of RAM. Somehow I don''t think an extra couple K will matter.Good idea though for folk swith bulky structs.

### #55Simage  Members   -  Reputation: 122

Like
Likes
Like

Posted 18 January 2003 - 06:23 PM

I dunno... I think that using a signed char would make inference easier....

just for instance.. using negative values to represent false and positive for truth and your method posted above.

ball is round 127
round is square -127

infering that the "ball is square" we get

f1=1
f2=-1
multiply them... we get -1 or fully false which makes perfect sense... I dunno... maybe I''m missing something really obvious here. only problem I can see is infering from two false values when that should give a false.

cow is dog -127
dog is cat -127

cow is cat works out to 127 then, I guess... we don''t know that its not true. I''m gonna hafta think on this for a bit, the three way false might be a specail case you''d have to handle this way.

also, I''m curious, you mentioned links shooting off links, can you give me a particular instance?? I just can''t think of any off hand.

### #56Extrarius  Members   -  Reputation: 1416

Like
Likes
Like

Posted 18 January 2003 - 08:43 PM

You can''t really combine false conditions anyways. Knowing that A is not B and B is not C does not mean A is not C. In fact, it might actually be more likely that A is C because you''ve eliminated the same value for both of them.

Using numbers, you can easily see that. Say you are using an unsigned char A, B, C. if A = 1 and B = 2 and C = 1, A is not B, B is not C, but A is C. Without the two rules, there is a 1/256 chance that A and C are equal, but knowing that neither is equal to B makes the chance 1/255.

I think.

### #57The Heretic  Members   -  Reputation: 146

Like
Likes
Like

Posted 18 January 2003 - 11:31 PM

OK, let''s see if I can remember where I thought about doing this... I just remember doing it at one point... Hmm...

Let''s see, perhaps to answer the 5 W''s a link... Well anyway, it was basically to give each link three pointers to links... Eventually I left it because it was too memory hogging.

### #58bosscheese  Members   -  Reputation: 122

Like
Likes
Like

Posted 26 January 2003 - 07:26 PM

Just wanted to jump in here now. I wanted to add something to the whole decay/way info is passed between people. Everyone at one time or another is told something by someone that they really couldn''t care any less about. For example, let''s say someone steals a loaf of bread from Joe the baker. Joe goes on to tell a person traveling through the town about the incident. The traveler most likely wouldn''t care about something so insignificant, and probably wont be able to tell you what the Baker said an hour after he heard it, let alone go and repeat it to someone he meets at the local tavern. Or maybe he wasn''t really paying attention at all. Just kind of feining interest while preoccupied with finding an Inn to stay the night.
The point I''m trying to make is that not everything that is said between characters needs to be carried on any further than the initial conversation. This can help the whole knowledge equilibrium problem where everybody knows everything. Everyone wont know everything because even if they''ve been told everything they wont necessarily retain it all. Example:
Let''s say the local shop keeper tells something to the town drunk that you''d really like to know in order to finish some type of quest. But, the shopkeeper doesnt like you all that much, and refuses to tell you. But you find out that he shared the information with the town drunk. You find the drunk, and begin asking him. Because the drunk didn''t give a damn about what the shop keeper was saying in the first place, he''d have no idea as to what you were asking him about. Not because he forgot, but because the information wasn''t important enough to retain in the first place.
Now this would take a lot of extra variables for your NPCs and is obviously more work than most people are whilling to put in, but I thought I''d throw it in.

### #59SecondBest  Members   -  Reputation: 122

Like
Likes
Like

Posted 28 January 2003 - 09:42 AM

I''m on the side of the skeptics.
I believe the idea of NPC''s gossipping is great and probably essential for the development of RPG''s and MMORPG''s. However I disagree with the idea that an NPC has to wander about witnessing and exchanging information for it to work out smoothly. I''ll give my thoughts on the subject:

1- One of the major reasons gossip works in real life is because there are so MANY of us. even the most ambitious RPG wouldn''t (and probably shouldn''t) dream of activating so many bots all at once.

2- Consider how other problems of this sort were tackled. Economy for example: Games can create living economical systems by using networks and not by sending single NPC''s buying and selling stuff to activate the economy because it''s easier and cheaper and because bots would be too stupid to act in a way that will create this kind of dynamism. Your world will probably very slowly starve to death if you attempted that.

3- We''re talking RPG here. it''s all based on unrealistic approximations that work. I mean how many hit points do YOU have? What''s your AC with and without your baseball cap. Yet all these concepts are very useful and they tend to work out much better than some systems which try to become more realistic by actually imitating reality.

4- When Garod the Terrible falls upon a band of goblins, none is left to tell the tale. Does this mean he''s Garod the Meek? Simply because no one saw him massacring all these goblins. Or should we wait for a 1/1000000 chance that some NPC passes by and witnesses one of these incidents and live to tell about?

I believe you should allow this kind of information to take a life of its own. You cannot keep track of everything going on in your world but you can probably make a good estimation of how to work it.

Peace Out!

### #60Joel Martinez  Members   -  Reputation: 338

Like
Likes
Like

Posted 04 February 2003 - 07:58 AM

quote:
Original post by SecondBest
4- When Garod the Terrible falls upon a band of goblins, none is left to tell the tale. Does this mean he''s Garod the Meek? Simply because no one saw him massacring all these goblins. Or should we wait for a 1/1000000 chance that some NPC passes by and witnesses one of these incidents and live to tell about?

I think that would make it all the more interesting ... if no one noticed Garod doing terrible things, no one would know when he came into town that he was about to kill everyone. However, once he does do that, chances are someone will escape and tales of his ... terribleness will spread.

Not that I have anything else to add to this, just wanted to voice that small opinion :-)

Joel Martinez
http://www.codecube.net/

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS