Jump to content

  • Log In with Google      Sign In   
  • 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.

  • You cannot reply to this topic
67 replies to this topic

#21 NeverSayDie   Members   -  Reputation: 122

Like
Likes
Like

Posted 18 February 2002 - 04:26 AM

Fascinating discussion - some very interesting ideas.

Here's another feature/complexity you could add (apologies if someone's already suggested it) - have a main event, and then a subset of "details" associated with it. NPCs might know of the event, but particular details might only be known to certain indivduals. This could be worked into the decay systems you've been suggesting - an NPC might remember an event, but forget specific details over time.
Eg, the NPC will always remember a battle took place in a nieghbouring village, but he might forget exactly when it took place, if a particular character was killed, or which direction the raiders fled.
This could be built into a hierarchy or tree structure - eg,
Battle took place
-A local was killed
----He was a farmer
-------It was Farmer Jim

Obviusly various weights could be applied to different details, etc.
Just my two cents


Edited by - NeverSayDie on February 18, 2002 11:28:13 AM

Sponsor:

#22 Timkin   Members   -  Reputation: 864

Like
Likes
Like

Posted 18 February 2002 - 10:02 AM

Nice idea NeverSayDie!

You could expand this further to include the ''Chinese Whispers'' effect when people communicate. Perhaps NPC1, while telling NPC2 of the story of the battle, mixes up some of the details. Perhaps instead of a farmer, she says that the baker was killed!? This might make it harder and more interesting for the PC to decipher what actually happened and whether it has relevance to his or her situation!

Timkin



#23 Puzzler183   Members   -  Reputation: 540

Like
Likes
Like

Posted 18 February 2002 - 10:41 AM

Wow! That is all I can say about this thread.

Some of these ideas are very interesting. But nobody (but me) has said anyhting about the use of a semantic network. I was really serious in my little onesentence post.

Take a bunch of nodes with phrases and words in them and link them by their relationships. for example: the node containing "red" would hopefully have an is-a link to the node containing "color". And "color" would have a one-is link to "red".

Edited by - Puzzler183 on February 18, 2002 5:42:11 PM

#24 Timkin   Members   -  Reputation: 864

Like
Likes
Like

Posted 18 February 2002 - 03:43 PM

quote:
Original post by Puzzler183
Wow! That is all I can say about this thread.

Some of these ideas are very interesting. But nobody (but me) has said anyhting about the use of a semantic network. I was really serious in my little onesentence post.




The problem you will find Puzzler183 is that while your idea has merit, most of our readers will never have encountered a semantic network and would therefore have no idea of the benefits of such, let alone how to apply it to the task.

Perhaps you could offer a concise overview of applying a semantic network to the problem of NPC communication? I''m sure everyone reading this thread would appreciate it and it would certainly contribute a lot to the discussion!

Thanks,

Timkin



#25 ShadowX   Members   -  Reputation: 122

Like
Likes
Like

Posted 18 February 2002 - 03:58 PM

You know, this sound A LOT like replication between servers in most enterprise software. Most of the issues brought up by other people have already been answered. It would probably do you good to take a look at some of that stuff. I don''t know much about it at all, but I know there are already proven algorithms to enchance performance. And since these server are already doing it in real-time with little work from the processor, it should be almost "free" to implement. Hope that help the thought process.

One day I''''ll stop pretending to know how to program

#26 Puzzler183   Members   -  Reputation: 540

Like
Likes
Like

Posted 18 February 2002 - 04:23 PM

A semantic network is an advanced form of knowledge representation that, like many things, has been around for quite awhile but has not been implemented in virtually any applications. It is basically a set of nodes linked together to form a network. I have implemented them in two ways using two different style, all of which will be discussed below. I will give you two basic structs in C++: the link and the node.


struct link {
bool active; //is the link on?
char truth; //the higher, the more true
char desc; //descriptor byte
short nptr; //offset of the node in the array
};

struct node {
char desc; //describes contents of the node
bool active; //is the node on?
char idea[30]; //knowledge string
char ltot; //number of links
link links[45]; //links
};


The two ways to implement them:
1. As an array of nodes
2. As cluster of nodes, created dynamically in memory

For an array of nodes, you may use the structs I gave you and just have to write functions to add nodes, remove them, and clean house (which will be discussed later). For a cluster of nodes, change the

short nptr;

is the link struct to:

struct node *nptr;


Then use new and delete to create the cluster. Now onto the two styles of networks:

1. General links
2. Specific links

the descriptor byte in the link struct tells the relationship between the two nodes being linked. This can be specific (lives in, eats) or general (is a, characteristic. While the latter is more suited to predicate calculus than the former, the former is (probably) better suited for this game.

Now as for how this applies to NPC communication:

When NPC 1 says to NPC 2, "red is a color", NPC 2 would look for red and color in their knowledge base. If he found both, he would create an "is a" link between them. If oe (or both) was missing, he would create the missing one(s) and then create an "is a" link between them.

I admit, this approach requires more parsing than normal but I find it very useful.

#27 Gollum   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 February 2002 - 02:35 AM

I love the idea of a semantic network, as it gives NPC''s (or agents, or whatever) actual understanding of the world around them, as opposed to faking it.

I guess the reason I haven''t responded is that, for my project, it would be overkill. I love talking theory, but a common malady of these forums is people talking about grand ideas, but never implementing beyond the basics. Sourceforge and the web in general are littered with projects that have incredible design docs, but never make it past version 0.0013. I know that I myself have started many such projects and never gotten even close to finishing them.

So, my approach is incremental. It''s probably less organized, and leads to constant rewrites, but it does give me the knowledge that I''m progressing. At the moment, I have a small map, which I can create with a basic map editor. I have some NPC''s, created randomly, which move to random points using vectors. I''m seriously embroiled in trying to figure out A* pathfinding. Once that''s done, I''ll move on to having multiple level maps (countryside map leads to city map, city map leads to house map, and so on). Each feature gets added as I need it or can figure it out.

I have my gossip system working on a basic level. NPC''s can gain and trade information. I know that I can add more complexity later. But at this point in the game (pardon the pun), having a semantic network in my game would be, unfortunately, absurd.

Having said that, I am learning a lot from you guys, and I may have to create a proof-of-concept program to play with the ideas, just because it sounds like so much fun. I''d also like to figure out what rules would be relevant to an RPG. MY NPC''s would not need to know that apple "is a" fruit, for example, but they would need to know that an orc "is aligned" evil. NPC''s should have a set of rules that helps them make decisions about their daily lives - when to change state, what to buy, where to travel, who is on what side in a battle, and so on. Maybe a good discussion would be what subset of semantic rules is most important in an RPG?

Please keep talking. I''m really enjoying it, and would like to contribute, but for the moment, the best I can do is listen and occasionally ask questions.

- Gollum, who is mired in pathfinding he11.

#28 Puzzler183   Members   -  Reputation: 540

Like
Likes
Like

Posted 19 February 2002 - 03:54 AM

Well I am working on some semantic net classes so if you want the code, feel free to leave your email, and mention it.

#29 smilydon   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 February 2002 - 12:07 PM

In the gossip context you can get away with using only one semantic net representing the relevant items in the map. Each NPC has a set of links and when they communicate they exchange these links. So if npc1 ask "where is the blue key", npc2 checks the semantic net to see if one of his links is related to the blue key and if so he will tell it npc1, who adds this link to his set. Just an idea....

#30 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 19 February 2002 - 12:25 PM

To me it sounds kind of silly to keep track of all these NPC''s and things they know and remember it would eat up memory like crazy. You could probably do it all semi-random and the users couldn''t tell the difference.

#31 Puzzler183   Members   -  Reputation: 540

Like
Likes
Like

Posted 19 February 2002 - 12:52 PM

Well Mr. Anomymous, computer today have TONS of RAM. Mine has 768MB. So memory isn''t really as much of an issue to me and many other people compared to realism. Don''t get me wrong: I see your point and understand your intent, but I think that idea eliminates NPC''s gossiping if they have random memory. Also, you could make it less memory cosuming by making a unchanging common snese network, and then give each NPC a small, maybe 1024 node network of his or her own.

#32 NeverSayDie   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 February 2002 - 12:15 AM

Anon, you make a good point - these kind of routines could be very expensive if not implemented and used carefully. Probably more CPU than memory intensive - this kind of cognitve modelling tech tends to use graph and network based structures, and we all know how well they scale up

It's a question of getting value for money (or bytes/cycles, whatever). I reckon this kind of gossip system could enhance an RPG nicely (to the extent it would be noticed, at least subconciously) if used properly. Here's a few possible benefits:

* Enhancing "whodunnit" scenarios and other investigations. Eg, a murder has been committed. Using the kind of knowledge distrbution system being discussed here, the player(s) will need to engage in a more focused investigation - eg if a baker was killed, the player would need to consider the kind of people he would be associating with, investigate contacts, etc. Basically, the networking of contacts would be improved - it wouldn't be enough to randomly question patrons of an inn, for example.
* Increase the need for subtlety. Eg, the player is investigating a crime. They start asking questions all over town. Using our knowledge distrbution system, word gets back to the thieves' guild that someone is prying. They take action... This kind of thing makes the PCs think twice before asking random punters for sensitive information. PCs on the run/outlawed would have to be careful who they share information with - you never know who's going to be chatting with the Captain of the Watch... Combined with a system of alignments/motivations, this could make PCs trust certain indivduals and not others, etc. In a reguar CRPG, players think nothing of wandering around a tavern, asking prying questions to random peasants - these techniques could be a nice twist to the gameplay dynamic.
* Dynamic plot systems. Some form of information sharing system could be useful in the implementation of such a system.

While most of the above could be hard-coded or scripted, the use of AI techniques such as the cognitive modelling being discussed here will allow for differing scenarios and dynamic gameplay on a larger scale than any designer could allow for. If knowledge is distributed in a (semi)realistic manner, the gameplay will most likely differ from one game to the next. This greatly increase replayability, non-linearity, etc. One of the best things to watch in game AI is when your creations do something competley unexpceted - take on a life of their own, as it were.

Anyone else have suggestions for gameplay enhancements and possibilities provided by this kind of gossip system?

Edited by - NeverSayDie on February 20, 2002 7:21:34 AM

#33 NeverSayDie   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 February 2002 - 12:30 AM

Another idea - a more realistic reputation system. Most RPGs simply give the player/party a reutation score that goes up/down with their actions. Things could become much more interesting if this system was based on the knowledge distrubtion network. Each NPC would have their own opinion of the PC - which would increase/decrease depending on actions witnessed - and the gossip they had heard about the PC. For example, if you murder a villager in the Far North, it could be a long while, if ever, before you gain a nasty reputation in the Southern Desert. But you never know, that peddler who was in town on the day of the murder might be spreading stories wherever he goes...
This could also allow the player to be framed/defamed - that noble you insulted might start spreading nasty rumours...

#34 Gollum   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 February 2002 - 02:39 AM

One of the first things that got me interested in designing more realistic games was playing Final Fantasy VII. I''ve never finished that game, even though I''m very near the end. Why? Because even when my party was tremendously powerful, we still had to fight the same crappy level 1 monsters every three paces. It took forever to get anywhere, the experience points were worth basically nothing, and why were these little wimpy monsters attacking me in the first place? All the people seemed to know I was bada$$. What, none of the monsters knew I had killed thousands of them?

If you built a real, dynamic reputation of alignment and power (which would travel theough the gossip system), everyone could react to it. Weaker creatures might leave you alone. Thieves could seek you out if you''re right for the job, or plot to assassinate you if you''re prying too much. You can become a "marked man" (or woman).

The biggest advantage of all of this is very simple. We''re talking about rolepaying games here. Changes like this will encourage you to play a role, rather than playing every game/character the same way. Plus, they will help get rid of a lot of stupid RPG problems, like the random encounters, or the fact that you have to ask every person you meet for every piece of info they have, or the fact that you can steal to your heart''s content in most games, and nobody seems to notice, much less care. In Daggerfall, you could kill someone in town, and the guards would come after you. If you ran outside the town limits and then came back, they''d forgotten!

Honestly, at this point I''m just enjoying making it work. But I think that it can help eliminate many of the obstacles to getting fully immersed in a world.

- Gollum

#35 Terr   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 February 2002 - 12:53 PM

This is really a great topic

I'm jumping back to the "decay time" posts. Some memories are more easily forgotten than others. For ex: an epic battle against a Dragon is remembered longer than Joe the Farmer dying (people forget him faster). You could implent this, but it would take even more variables/CPU power/etc because every person remembers something longer because of his/her interests, for ex: the family of Joe the Farmer would still remember him after 20 years, Jack the Baker who lives in another village and didn't know him very well won't remember him for long.

Good luck Gollum

"Control the media, control the mind"

Edited by - Terr on February 21, 2002 7:54:51 PM

#36 Timkin   Members   -  Reputation: 864

Like
Likes
Like

Posted 21 February 2002 - 01:06 PM

...so you could link the decay rate to the subject class. Statements about dragons might be remembered for a long time, so might folklore. The theft at the local bakery might get momentary gossip status but be forgotten about 3 weeks later by all but the baker.

Timkin

#37 Puzzler183   Members   -  Reputation: 540

Like
Likes
Like

Posted 21 February 2002 - 01:25 PM

Basically change the threshold and and decay rate. Now you need to decide which one to change. I'll get back to you on all of that...

Edited by - Puzzler183 on February 21, 2002 8:26:43 PM

#38 Timkin   Members   -  Reputation: 864

Like
Likes
Like

Posted 21 February 2002 - 06:21 PM

Ultimately I believe that much of our knowledge is forgotten when it is not used or shared. That''s simply because it hasn''t been transferred to long term memory. Using knowledge, or communicating it to others, reinforces it. Eventually this reinforcement is sufficient that we store the information in a seperate part of our brain (I''m not a neuro-physiologist so I don''t claim to know EXACTLY how it works... I''ve just read some articles).

We could mimic this in an our NPC gossip system by reversing the decay on the memory each time the NPC passes the information on, or performs an action that relies on the information. That way, while something is a ''hot topic'' of conversation, it gets reinforced and remains in memory. When other items of information compete with it for ''air time'', it will either win - staying a current topic - or lose, thereby drifting off into the ether to be forgotten by all but a few who have committed it to long term memory.

Perhaps if the decay is reversed sufficiently such that the strength of the memory increases past an upper threshold, then the memory is held indefinitely and is considered to be a long term memory.

Just a thought...

Timkin

#39 Puzzler183   Members   -  Reputation: 540

Like
Likes
Like

Posted 22 February 2002 - 03:41 AM

Here were my thoughts:

For reinforcement, just reduce decay rate (reduce a in your original formula). On the other hand, if somehting happens a second time, like a second war or something, decrease threshold (square it, half it, multiply it by the decay rate).

I also did some graphs on my calc and found that a should to be between one and zero but I think something like between .1 and 0 is better. The reason is that in 4 days with a at 1, the number drops extremely low (BTW I am assuming t is in game days). At .1, information was remembered for about 125 days (if I remember right), before it dropped below the same threshold. Unfortunately I can''t exactly remember my threshold value but you get the point.

#40 Puzzler183   Members   -  Reputation: 540

Like
Likes
Like

Posted 22 February 2002 - 01:38 PM

I''ve thought of a better way to do it. If youare using a semantic network, you can have a variable in the NPC''s personality called memory. It would be the size of their smeantic network in nodes. Hten you could have another variable in their skills called intellegence. This would be a or the decay rate coefficient.




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