How to make NPC's "gossip"

Started by
66 comments, last by Gollum 21 years, 2 months ago
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.




Advertisement
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.
That eliminates the whole purpose of an NPC having a knowledge base, and gossipping.
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.

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
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.

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
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

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).
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]
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk

This topic is closed to new replies.

Advertisement