#### Archived

This topic is now archived and is closed to further replies.

# How to make NPC's "gossip"

This topic is 5454 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
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...

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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!

##### Share on other sites
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/

##### Share on other sites
This is the most interesting thread I''ve read on Gamedev and I thought of a few things to add. One was the truth value being stored as an int allowing any positive values to be true and negative to be false. 0 could be not entirely sure also anything say from 1 to 128 has a smaller chance of being true than 255. Sorry if I explained this wrong.

Another one is I thought of NPCs lieing to others to make them selves look better. For example some random guy could come into town and say that he killed 20 Orcs by himself blah. Some daft guy might beleive him and spread the tale and so people actually think this guy is hard as. Then u go and kill him and either people think your the hardest guy ever or that the guy was lyeing all this time.

##### Share on other sites
My question is how the heck did you dig the thread up? The search feature has been offline for ages and I''d really like to know of a way of search through past threads as I''m going to be needing this pretty soon!
Thanks

<Fish>{

##### Share on other sites
quote:
Original post by TonyFish
My question is how the heck did you dig the thread up? The search feature has been offline for ages and I''d really like to know of a way of search through past threads as I''m going to be needing this pretty soon!
Thanks
{

I am the ultimate necromancer! Muhahahaha!

No but seroiusly, I knew part of the name who started it, did a wildcarded search for the peices of their name I knew, and found the thread in their profile.

##### Share on other sites
Hi guys this is my first post, and i have to say i work with a 3d engine called 3dgamestudio. i am currently trying to make the same kind of game with these features, and if any of you can give me a hand with modeling, or textures, or c-script programming (The engines language) i would much apreciate it. its amazing how you guys do this stuff, and i am soon expecting to learn C++, and will start making some more advanced things like you guys.
cya

##### Share on other sites
A little idea: if you keep your world in form of nav-points graph, and when NPCs are far enough that player cannot see them, they moving only by nav-points, without using collision detection (memory-conuming physical representation not required to be stored in the memory for all world locations, only for location in which player is)...
But it is a great optimization too, because NPC "jumps" between nav-points, then frreezes (goes to the list of passive objects), according his speed and traveling distance between nav-points...

Let''s calculate: if average distance between nav-points is about 5 meters, and NPC speed is about one meter per second, and game makes 50 physical ticks per second... then NPC will be in active state (i.e. when he decides where to walk further, communicates with others, etc...) just one tick out of 250!.. Now imagine, how many NPCs could be in your game... I want to make RPG with about 100000 of them, if minimum system requirements (128Mb RAM) will allow. And only about 100 NPCs will think in each game tick (because smith or peasant most of the time resides at his workplace, and in such case his state is passive - I need only to calculate amount of goods produced, resources spent, and time of work - and then freeze the worker until time passes or player comes near enough to see him...

What do you think, people?..

##### Share on other sites
This is cool. I was just kind of randomly wandering through Gamedev, which I hadn''t done in forever, when I see one of MY old threads resurrected!

I still hafta say, even with the recent opinions, that I think a system like I described earlier would be great for a game. I''m in grad. school now, and wish I had the time to learn enough C++ to write it. Interestingly, I''m taking a class on data mining, so I''m learning about Bayesian networks, which is how real-world inference engines are built. Which gives me lots of other ideas. What I really need is some expert coders to implement my ideas as I have them (but that''s what we all need, right?).

I should say that I think there is a certain amount of "cheating" in all RPG games. In fact, it''s silly to call it "cheating," because a game simply cannot, nor should it, reproduce the real world. Where one stands on the issue is more based upon what you think is important. In other words, given a computer with X power (and the amount doesn''t matter that much, because computers are always getting faster), what percentage of your processing power (per frame, say) would you spend on graphics? On AI? On simulating world economics? Etc. etc.

Now, my beef with most games is that they:
1. Are too linear.
2. Are so unrealistic as to be irritating and absurd.
3. Don''t give me a sense that _I_ have an effect on the world, or at least any different from every other player who plays the game.

I''ve already described my ideal game, but let me give you an example. Pretty much every single game out there these days has tremendous graphics. I don''t need much more from a graphics engine than what exists now. But even with all of that power to spend on graphics, they don''t check for simple things. In most every RPG, I can walk into a person''s home, rob them blind, then go talk to them like we are old friends. I can walk around (toward the end of the game) as a world-famous all-powerful bada hero, armed to the hilt, and nobody treats me any differently than when I started out as a little unknown wimpy guy. Everywhere I go, the monsters are perfectly tuned, so that they always match my power, no matter what "level" I am, and so on. I know, there are some games that are better at stuff like this (Fallout, Gothic, and Morrowind come to mind), but by and large, these games have gaping holes in their believability, and I play RPG''s as an extension of my ego into a believable world. I don''t want to believe that I am following some predetermined loop of kill->level->equip->kill->level->equip, until I finish the game and start another that does the same thing.

The gossip thing is not the main point, just a means to an end. I like the idea because I imagine it could be done pretty faithfully with not that much processing involved. And of course, with a "living world," much of the work would be in fine tuning it so there is a balance. In some places, yes, you would "cheat". Maybe in the example of a great battle where no one survives, you propagate the knowledge of the battle without worrying about someone to report it. Those things would be worked out as testing goes on. But I am pretty sure that anything that starts out as random is going to look random, no matter how many ways you try to bandage it. And if much of the RPG genre is based on FOLLOWING quests and rumors around, doesn''t it make sense for those very same pieces of knowledge to be travelling? Otherwise, what are you following?

Anyway, I''m rambling. But it''s good to see people talking about this. Maybe one day a great coder will pick it up and I can play my dream game, eh?

- Gollum

##### Share on other sites
Yeah, this was a great thread, pity I couldn''t contribute more to it. I''m actually looking at postgrad research projects at the moment, and I''m thinking about putting together a proposal based on the type of system being discussed here. Not my usual area, but could be very interesting. The head honcho around here is big into cognitive modelling, neuro computation, that kind of thing, so I might be able to pitch something along those lines.

With that in mind, anyone have any suggestions for research based off the concepts tossed round in this thread? As in, how to actually turn this into a reasonably substantial research project? I have a few ideas myself, but I''d be very interested in hearing any suggestions.

##### Share on other sites
quote:
Original post by JinJo
This is the most interesting thread I''ve read on Gamedev and I thought of a few things to add. One was the truth value being stored as an int allowing any positive values to be true and negative to be false. 0 could be not entirely sure also anything say from 1 to 128 has a smaller chance of being true than 255. Sorry if I explained this wrong.

Think of it in terms of probability or approximations of the truth. It makes sense to go from 0 for zero probability/absolutely untrue to 1 for certain/absolutely true, and it makes determination of inference a fairly straightforward normalized product. With negative numbers then you have all sorts of artifacts springing up when attempting to infer "facts."

Say NPC A trusts NPC about 30%, while NPC B trust NPC C about 80%. If NPC B communicates a report received from C to A with appropriate stress, A assigns that "fact" 30% of 80% = 24%. If NPC A is unaware that the fact comes from C, who is largely but not completely trusted by B (ie, A believes the fact comes from B directly, the fact gets a rating of 30%). Try that with negative numbers (0 = 50%).

quote:
Another one is I thought of NPCs lieing to others to make them selves look better. For example some random guy could come into town and say that he killed 20 Orcs by himself blah. Some daft guy might beleive him and spread the tale and so people actually think this guy is hard as. Then u go and kill him and either people think your the hardest guy ever or that the guy was lyeing all this time.

Good idea. Check this out, ignoring the (mini-)flamewar *blush*. You might find it useful.