Advertisement

Annotated objects which drive behavior

Started by January 18, 2002 10:25 PM
85 comments, last by bishop_pass 21 years, 1 month ago
quote: Original post by bishop_pass
As for organization, I see the object data organized by action. For each object, there are a number of actions. Each action gets its own frame of data with fields defining the action, the goal that can be achieved, who might ''afford'' to use it, notice it, etc. The goals of each action chain together so the NPC can effectively plan a sequence of actions and place this plan on its agenda.


I would NOT organise by action, but rather by goal. The Active Objects querying objects around it will do so to achieve a certain goal, not to perform a certain action. In fact, often it will be so that the action was previously entirely unknown to the Active Object. Take for instance the old Sims example of the ball. The action of ball is "to play football". However, the NPC doesn''t know what football is. It''s asking around "is there anything fun I can do around here", and the ball answers "Yeah, you can play -football- with me, and that''s -fun-". What football entails is secondary (and encoded within the ball). To the NPC, what matters is that it is fun.


All the "goals" have to be defined beforehand though - at least the "low-level" goals. I''m a big fan of layering though, so you could add "rules" to goals later, such as "Relaxation = fun + energy". And then when you''re low on energy and bored, you could try to search for "relaxing" things first, before trying to satisfy the goals separately. Of course, that doesn''t change anything about the engine, it just makes it seem more "intelligent" when communicating. It''s much better when the engine tells you "you''re relaxing in front of the telly" than "you are having fun and resting in front of the telly".


The deadlock situation with "keys locked in car" is easily solved - because there is no path that leads you closer to your goal. You simply classify it as an impossible goal (note to self: obviously, it has become important to mark certain goals as "impossible" due to certain conditions).
A worse kind of deadlock is a bounce-back-and-forth deadlock. I''m trying to think of an example, but I can''t find one off the top of my head, but it would be something like:
-Try to achieve goal A, ending up in situation 1.
-Situation 1 makes goal B more important than goal A, so try to achieve goal B, ending up in situation 2.
-Situation 2 makes goal A more important than goal B, etc...

However, with my vague understanding of the agenda idea, and how much it looks like a graph ( ) you can use graph theory, avoiding getting into a loop.
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
yeah I agree Keith.

I think it should be:

A goal has the attributes contained inside it to tell the NPC what it will do for the NPC (i.e. the goal will gain money for the NPC, or whatever). The goal will also contain "side-effects" telling the NPC that for instance it is a morally corrupt goal (like stealing for example).

The NPC has attributes (personality, strengths/weaknesses, morality, social standing, etc) that affects the NPCs decision of what goal to choose.

The items have other info that would tell the NPC how they could help him in doing something (which is probably going to be some higher-level goal)

A CRPG in development...

Need help? Well, go FAQ yourself.

"Feel free to utilize Pouya''s cliff." - Fel
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Advertisement
OK, I''m officially an idiot. Re-reading the entire thread, I realize the main thrust is storing object functionality within the objects themselves. I thought this idea was a tangent and that the main point was something else.

Gaiden, I found your original post to be a a good example and it clearly demonstrated your point (and the point of the entire thread). To be honest, I thought this already was how things were mostly done. I guess that''s why I sought elsewhere for the point of the thread.


Sean

"we need common-sense judges who understand that our rights were derived from God. And those are the kind of judges I intend to put on the bench." - GW Bush"no religious Test shall ever be required as a Qualification to any Office or public Trust under the United States." - Article VI of the US Constitution.
I''ve had some excellent ideas on "secondary goals" (i.e. goals that do not directly relate to the satisfaction of an NPC need), and the use of container objects (yes, Infinisearch, you were right, they have an enormous importance!).

Unfortunately, I have to leave here in about 20 seconds, but I''ll try to post the ideas later. It has to do with uncertainty of containment and transitivity of value (how valuable is a safe with lots of gold in it? And how valuable is it when you don''t KNOW that it has lots of gold in it?).
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
quote: Original post by MadKeithV
I would NOT organise by action, but rather by goal.


I see your point and agree. I was just assuming (perhaps wrongly) that each action would have a goal and the Active Objects would query that field in the data structure. However, some actions might satisfy several goals.

I was thinking of organizing by action because that seems easiest for the author/designer. He takes an object, and then thinks of all the actions it can do. Then he codes the structures using some language designed for that by each action. The program which breaks this down into the proper data could then take the goal/s from each action and make them accessible to the Active Objects.



___________________________________

_______________________________
"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.
There are a few problems. There always are a few problems. You just need to solve them as you find them.

Let's look at the first part of the turn cycle. The items below happen in parallel, meaning each item in the list is independent of the other:

  • All potentially visible objects suggest their goals/actions to the NPC. Those which can meet the NPC's goals get put on his suggested action list. (this is not the agenda)
  • All goals which the NPC currently wishes to satisfy which are not planned for on his agenda are matched to objects which the NPC is aware of or has memorized. If the NPC decides a plan to retrieve that object is worthwhile, a new goal can go on the agenda which is to retrieve that object, which might require travel to another location.
  • This is the last one, but important. An NPC may wish to accomplish a goal, but because the knowledge is encoded in the objects, he doesn't know what object to use to accomplish that goal, and will never know unless he stumbles across the object. So, I propose that such goals which the NPC has are matched to 'generic' object data structures, where the NPC can build a plan with generic objects to accomplish what he wants to do, and then his goal becomes one of seeking out such a generic object, by applying knwoledge of where such objects are typically found.


It gets complex, doesn't it? AI always gets complex. However, things are staying managable and structured within a common paradigm, and that is important. By treating locations as objects, an NPC can plan travel also, and remember locations so he can plan travel to places he cannot directly access.

___________________________________



Edited by - bishop_pass on January 24, 2002 11:56:39 AM
_______________________________
"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.
Advertisement
quote: Original post by MadKeithV
A worse kind of deadlock is a bounce-back-and-forth deadlock. I''m trying to think of an example, but I can''t find one off the top of my head, but it would be something like:
-Try to achieve goal A, ending up in situation 1.
-Situation 1 makes goal B more important than goal A, so try to achieve goal B, ending up in situation 2.
-Situation 2 makes goal A more important than goal B, etc...

However, with my vague understanding of the agenda idea, and how much it looks like a graph ( ) you can use graph theory, avoiding getting into a loop.


I mentioned travel in my last post, and the situation you describe above is a classic example of it. You don''t want an NPC planning to exit the house and walk down the street to walk from the kitchen to the living room to the dining room and back into the kitchen and into the living room and into the dining room, and so on.

By using graph theory to ensure the agenda stays acyclic, this problem can be solved. However, you don''t want this to foil genuine plans. Think of this one: The NPC needs to walk from the dining room to the kitchen to get a flashlight (the power went off) and then back into the dining room (he can see now) to get an object which he then wants to take into the kitchen. This plan involves walking from the dining room to the kitchen twice, but it is a genuine plan. At the microscopic level, it appears the NPC is motivated to walk into the kitchen for the same reason on both counts: to get from the dining room to the kitchen.

___________________________________

_______________________________
"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 bishop_pass

  • This is the last one, but important. An NPC may wish to accomplish a goal, but because the knowledge is encoded in the objects, he doesn''t know what object to use to accomplish that goal, and will never know unless he stumbles across the object. So, I propose that such goals which the NPC has are matched to ''generic'' object data structures, where the NPC can build a plan with generic objects to accomplish what he wants to do, and then his goal becomes one of seeking out such a generic object, by applying knwoledge of where such objects are typically found.



This may actually be less of a problem than it seems. At the very lowest level, an NPC''s motivation and goals are simple: get food, get shelter, get wealth, ... Achieving these goals is a matter of finding objects that supply the resource required to satisfy the need, and using them in the correct way. This is direct - if there''s an object visible to the NPC that fulfills the need, the NPC will get it, and be satisfied (or not, in which case the NPC goes on). Difficulty arises when there is no object that fulfills the need directly in sight. The NPC is hungry, but nothing that is food is directly visible. There are two possibilities:
1. The NPC will have to travel to see more objects, potentially some that will fulfill its need. You can do this in a semi-random direction, hoping that something will cue the NPC into finding food.
2. There is an object nearby that fulfills the need, but it''s not available due to being blocked, such as a banana inside a fridge. What should happen, is that a "fridge" is coded as being a "container", which has an affordance that amounts to "if you open me, you may find some things that satisfy your needs". The "fridge" itself could be a specialisation of a container that says "Not only do I possibly contain stuff that satisfies needs, it''s usually food!". So the fridge tells the NPC to look for potential food inside it, without actually having to know about food being inside it.


People might not remember what you said, or what you did, but they will always remember how you made them feel.
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.

originally posted by bishop_pass
This is the last one, but important. An NPC may wish to accomplish a goal, but because the knowledge is encoded in the objects, he doesn''t know what object to use to accomplish that goal, and will never know unless he stumbles across the object. So, I propose that such goals which the NPC has are matched to ''generic'' object data structures, where the NPC can build a plan with generic objects to accomplish what he wants to do, and then his goal becomes one of seeking out such a generic object, by applying knwoledge of where such objects are typically found.

Nice, really smooth way to deal with agendas of that type. What about objects that there are only one of in the whole world? Like the ''Sword of Thundera'' or any object that has a history behind it. Will unique objects be included as a part of the generic object list or use a different agenda structure? Maybe you should also add a generic state class for agendas that must be done with certain ''world'' state conditions, like something that has to be done at night.

-potential energy is easily made kinetic-

-potential energy is easily made kinetic-

More on the Agenda

The dictionary defines agenda as: A series of things to be done. Items to be considered. Things to be done.

One of the benefits of the agenda data structure which I proposed is the contextual knowledge it provides, not only for the planning and analysis stage, but also for the exectution stage. If any subgoal fails, it is easy to determine why one was doing that subgoal in the first place, and examine the agenda to see if there were alternative plans to acheive the higher up goals.

It also provides knowledge for an agent to ''explain'' his actions. This is useful for debugging and NPCs being able to explain their behavior to the player or another. An NPC has within its Agenda data structure the knowledge to explain why it is doing something: "I am doing this so I can then do that so that I can then do such and such." Or how an NPC did something: "I did this by doing that by first doing such and such."


___________________________________

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

This topic is closed to new replies.

Advertisement