NPC AI in RPG's

Started by
58 comments, last by dwarfsoft 22 years, 9 months ago
From everything posted here, here's my take with both points from others as well as myself.

Most importantly, I'd have to say that such advanced AI would be too hard to make or not perceived by the players as it should have been by the designer (as always).

Firstly every message should be categorised and given properties.
Not just properties like their lifetime before being conveniently forgotten. And NPCs don't forget things that fast so let's not talk abuot limits of computers yet. Messages should have the follwing properties:

1) Sensitivity - Secret, Private and Public
2) Link (or thread) - some news are updates of others, therefore new information should overwrite their old ones and for this to happen, they'd have to have a thread.
3) Belief in information - how much the NPC supports this piece of information.

Secondly, each NPC must have a list of close friends, normal friends and the-guys-you-gossip-with. This determines the information that they exchange with each other. Being a close friends, they may exchange secrets with each other unless the game does not allow it so.

Thirdly, each NPC must have a list of favourite activities, or rather, regular activities. And a time frame shall be associated with each activity. The venue must also be included. Other things might affect it like the NPC does not have enough gold coins to order beer at the local pub.

Lastly, each piece of information must have a question. What I mean is that whatever the NPC knows, the player can ask. But the player may have other questions that the NPCs do not know of and thus they may have a default piece of information. It should say something like 'I do not know'. But when it learns more, it get overwrited and he might say something else.

Okay now that everything is said, I can then proceed to write how everything fits in together which none of you have been successful at. I will attempt nonetheless.

Since each NPC has regular activities like work, NPCs in their immediate area are public figures to them and all of them excahnge public information which they keep. They will compare their information and see how much belief they each have and thus it will determine whether new information overwrites the old and what information is passed around. Or it might transform it. Also, they take into consideration the honesty and charisma of the NPC giving them the information. Maybe, if everyone says so, then the NPC might submit to all and believe what they say. Again, this depends on their belief in their information.

Also the idea that each NPC draws their basic knowledge from a database is very good. But can the information in the database be altered? If it can then, how fast can the information be spread throughout the world.

And missing are other details. Information do not only be gathered from other people. They are gathered from events, posters and the internet (okay, maybe not in a fantasy world, but you get the idea). How do they get the information. The events themselve must store a "message" that is passed to the NPCs who witness it.

This is such an old post but it still is valid. But still, the limits of today's computer might still hinder such a game. There could be shortcuts and everything and simulating such a "interactive" would be costly to the CPU. Interactive indeed!

However, even if the game succeeds somewhat, there is still a chance that the player messes it all up and is obliviuos to the living and almost breathing world that his character is in. As mentioned earlier, the player almost always do not think like the designer and thus difficulty arises.

Also, this just came to me. No one has talked about how NPCs react to information passed to them. You might have talked about bread-wielding bakers attacking dragons but how does it work?

Edited by - Darkor on June 8, 2001 9:40:28 AM
Advertisement
quote:Original post by Darkor

Also the idea that each NPC draws their basic knowledge from a database is very good. But can the information in the database be altered? If it can then, how fast can the information be spread throughout the world.


The concept is that the database is how the world state vector is stored at any time. Think of any current game. At any time there is a list of objects currently in the world and information regarding their individual states. The game update cycle includes information about how to update the state of each object (or at least each dynamic object). All of this can be stored in the same database. It is just that a part of that database is actually a knowledge base that contains a set of logical propositions relating to the objects in the world, the relationships between them and the way things change. A part of the game update cycle is to compute the affect on the knowledge base of any changes in the world during the last update and then any changes in the world that the knowledge base infers.

For instance, NPC_Baker_3 is passed information that his daughter has been eaten by a dragon. The knowledge base may have a particularly obvious proposition saying that "If X knows that X's_daughter was eaten by a dragon then X gets extremely angry and upset". If we add the information "NPC_Baker_3 knows that his_daughter was eaten by a dragon" (because this information was given to NPC_Baker_3 during the update cycle) then the logical conclusion is that NPC_Baker_3 undergoes a state transition to "angry" and "upset".

Our database can have other rules that govern the world. For instance, you could include Newton's first law, "Every object will continue to move at it's current speed and in it's current direction unless a force is applied to it". This wouldn't be the most efficient way to update those objects that do, or do not, have forces applied to them... but you get the picture (I hope)!

quote:Original post by Darkor

Also, this just came to me. No one has talked about how NPCs react to information passed to them. You might have talked about bread-wielding bakers attacking dragons but how does it work?



See above. Basically motivations are hidden within logical propositions.

I hope this stimulates a few more ideas or comments.

Cheers,

Tim


Edited by - Timkin on June 12, 2001 10:50:38 PM
quote:Original post by Timkin

The concept is that the database is how the world state vector is stored at any time. Think of any current game. At any time there is a list of objects currently in the world and information regarding their individual states. The game update cycle includes information about how to update the state of each object (or at least each dynamic object). All of this can be stored in the same database. It is just that a part of that database is actually a knowledge base that contains a set of logical propositions relating to the objects in the world, the relationships between them and the way things change. A part of the game update cycle is to compute the affect on the knowledge base of any changes in the world during the last update and then any changes in the world that the knowledge base infers.

For instance, NPC_Baker_3 is passed information that his daughter has been eaten by a dragon. The knowledge base may have a particularly obvious proposition saying that "If X knows that X''s_daughter was eaten by a dragon then X gets extremely angry and upset". If we add the information "NPC_Baker_3 knows that his_daughter was eaten by a dragon" (because this information was given to NPC_Baker_3 during the update cycle) then the logical conclusion is that NPC_Baker_3 undergoes a state transition to "angry" and "upset".

Our database can have other rules that govern the world. For instance, you could include Newton''s first law, "Every object will continue to move at it''s current speed and in it''s current direction unless a force is applied to it". This wouldn''t be the most efficient way to update those objects that do, or do not, have forces applied to them... but you get the picture (I hope)!

See above. Basically motivations are hidden within logical propositions.

I hope this stimulates a few more ideas or comments.


Would Timkin, or anyone else here, for that matter, care to comment on this topic which is essentially an exploration of the mechanical details of such a logical system.

Despite some overly pessimistic individuals and uninitiated ones giving feedback on the topic, it is a pretty worthy discussion. And I believe I have devised a classification method to determine the nature of particular axioms (recursive, etc.) and construct optimized data structures for the axioms which enable the system to not fall into the trap of a recursive graph search.

The system being discussed is first order logic with functional unification, enabling event or situation calculus for planning, truth maintenance, logically consistent beliefs, and efficient inference.

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
For those of you who haven''t read my article on Badcontent, check it out.
Here''s the link Next Level 2. This article pretty much sums up my stance on conversation systems, and I believe that it is completely implementable (well, at least I''ll find out when I try to implement it). It''s similar to previous posts (global information, memory, etc.) The actually interface would be a search engine similar to a "inverse parser", combined with the graphical interface I discuss in the article.
quote:Original post by bishop_pass

Would Timkin, or anyone else here, for that matter, care to comment on this topic which is essentially an exploration of the mechanical details of such a logical system.



Okay, I will first be honest and admit that formal logics are not something I know an awful lot about. I was an applied mathematician before coming into AI. (I was also heavily into physics and philosophy as an undergrad!).

However, I think I understand what you are asking. You want to solve the equivalent problem of determing whether or not there exists a path between two nodes in a bidirectional tree structure, that is not fully connected (i.e., it is not the case that all nodes in one tree map to nodes in the other). Correct?

This is out of my field however I might be able to run your solution by a couple of people (we have a great lunch time discussion group that meets each week. I know that one of the group members has some expertise in this area.) Would you mind if I discussed it with them?

Cheers,

Tim
Timkin, yes, that is basically the problem: graph search. I believe this problem is considered NP complete, or whatever. NP stuff is NOT my field of expertise. Anyway, with heuristics, theoretically it can be fast *most* of the time.

Yeah, go ahead and ask your associates, that would be great. However, I am not looking for the type of answer which says: "Oh, that problem can''t be solved reasonably, give it up." I would prefer an answer worded more like: "Yeah, that is a tough problem, but some of the better results are being acheived by such and such methods..."



_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
quote:Original post by KaneBlackflame
Hey, I had to try it) but I hope to start a new community in a few weeks with some expanded morals I have been adding. Dynamic AI can be made. I hope the age of static NPC''s will be over soon.



I would love to see some more information on this, perhaps a demo or a web-page detailing what you did - keep us posted!


This sounds much like the necessary foundation for a "living" world

- However, what we probably need to do with todays technology is to "simplify" this into something that doesn''t acctually modell every small action/decision of every mobile (unless we are talking of a very small world) - Leaving us processor time to handle players, more important decissions, such as knowledge management, graphics (if single-player scenario) or connections (in multiplayer scenario)

- However, these "small" decissions usually impact the bigger events in the world in some way - so we probabbly don''t want to ignore them.

Any ideas on how to generalize these everyday things such as suppy and demand on food and other stuff and breeding etc?

cheers,

J
// Jens
Correct me if I''m wrong, but, didn''t Wizardry 4 have something similar ? If I remember correctly, the game allowed the player to type text into into a textbox while interacting with npcs and the program would then try to find ''meaning'' in what the player typed. This was of course, a very primitive form of what you are talking about. Also, I believe Wiz4''s npc interaction system was keyword based.
Ok, I kind of forgot those outside my circle do not know exactly what a Neural Web is. A Neural Web is my attempted improvment upon a NN. There are no "hidden" layers in webs, as I create them node by node by hand with a SDK I built. I can add trees of nodes and train them, but I never refer to them as hidden or outside my area of direct influence. All nodes or groups of nodes are named. i.e. "Sadness" or "Hunger" In many cases, end results are fired back at inputs to create a constant flow of life in a network. This ensures a kind of "for every action, there is A reaction" situation, keeping the entities active. Also, some nodes cause functions to be called, imitating a form of motor neuron. With many long nights of tedious node planting, weight calculating, and hours of testing, you can very successfully implement my design theories to create entities that will function and interact with each other in a strictly controled environment. As far as implementing this in a game or other application now that must function in real time, I think we are a ways off from that in computational power. The only thing I have come up with to semi solve this problem is a form of layer detail. Alow me to explain : A player is in a town. The player cannot see anything in the next town, so all movements and actions there can be approximated, i.e. assume that everyone successfully completes their daily routine. This way, we free up a lot of processor time when approximating the rest of the world, allowing more time to properly simulate the current area or town, as well as simulate any important events going on elsewhere, such a plot lines and feuds. I hope that came out as clearly as I had hoped.

I would love to post a site, but I don''t have the time, and the only content I can provide is thesis statements, technical notes, and LOT''s of logs. I would rather wait till I have my demo working again before I post a zip file of my stuff. I would love to hear your comments and thoughts for improvement.
"Victims...aren't we all?" -Brandon Lee, the Crow
Hail and well met! Sorry for posting after so many others but I had an idea This may have been answered or mentioned already but I don''t have time right now to read all the replies and I''ll forget by later. What if you used your idea, the inverse parser. Example then I''ll explain:
You: How do I kill a goblin quickly?
***I realize this isn''t a normal question but *shrugs* oh well
The guard may have a few responses, such as:
1-To kill a monster enter attack mode and double click the victim
2-If you kill a goblin you may get a bounty
3-A sword will kill quickly whereas a mace will kill slowly
-----------------------------------------------------------------
Now the guard would be "confused" so he can say that he isn''t sure what you mean and will list all 3. The user will select what he wanted to hear. The game will remember that response. That is the key, ''specially if its a MMORPG. It will save all the responses to that question and the guard will begin to respond with the most common answer. It would seem like our virtual friend is learning

Hope that helps, or sparks somebody''s interest

Pinch me... See if I''''m still asleep... *pinch* Owe! Mother f*****... Yep, you were still asleep.
Pinch me... See if I''m still asleep... *pinch* Owe! Mother f*****... Yep, you were still asleep.

This topic is closed to new replies.

Advertisement