A quick thought on prioritized, needs-based AI
While working on the AI for my game, I thought of a little twist to make it a little more realistic. This is for a game where the NPCs have their own needs and desires, which are ranked according to the importance the NPC attaches to each desire.
The way I currently do it, the NPCs plan their next course of action based strictly on which desire currently is the most demanding (minus the cost of satisfaction). In my game, the fulfillment of a desire almost always involves the movement of an NPC from point A to point B. The alternative I came up with is to have the NPCs evaluate how many desires he can satisfy by traveling to point B, then how many can be satisfied by traveling to point C, etc. The current demand state of each desire will be totaled for each point which is a possible destination so that the decision-making is still weighted towards the character''s most pressing concerns. The point with the highest total is where the NPC plans to travel to next.
I''m sure this isn''t a revolutionary idea, but I haven''t seen it discussed before, so I figure there''s a chance somebody else might get some use from this.
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.
That''s a pretty good idea; I can''t say its never been used before, but its still a good idea
The only problem I really see with it is, if you have a complex NPC, he may have to evaluate his satisfaction in doing all kinds of different things. This might involve doing calculations for, say, 200 possible locations in his little world. Now multiply this by 50 NPCs or so (being unrealistically simple here) and you have over 10,000 locations that must be processed. That takes time, and time is money... or something like that.
Anyway, you can probably solve this issue fairly easily. The next minor thing I don''t like about it is realism. I may have a really strong desire to get more Mountain Dew, and simultaneously have a really strong desire to beat the living tar out of my coworkers. If my coworkers are near the refigerator, will that increase my desire to go there? Not usually.
In reality, most people are either too lazy, too real, or, frankly, too absent to weigh things like that when making decisions. If they are in a burning condo, they may have desires to watch TV, eat pizza, and play Quake. They can satisfy all those desires by going to their neighbor''s flat; but this should not outweigh the fact that they want to save their butt from being roasted in the building.
My suggestion would be to base a NPC''s decisions on their personalities. If they are dumb or impulsive, make them go wherever they want to go most. If they are wishy-washy, make them spend time trying to decide. If they are highly rational, like, say, a Vulcan, make them use the best-location system to decide.
This has a few advantages. First and most practically, it cuts down on the time spent having NPCs make choices. Secondly and most importantly to the gameplay, it makes characters more REAL by making them act the same all the time.
Personally, in an RPG, I like to see characters be individual. I don''t like prescripted behavior; I don''t like everyone being the same; and I don''t like characters who are overly thoughtful and logical. If you want to make your NPCs seem more real, personally I would give them each their own unique logic. Not just for deciding things, but their own little section of the game that controls EVERYTHING about them, from their pet peeves to their grand plans to control the PTA elections.
Apoch
Lead Developer
The Freon Project
The only problem I really see with it is, if you have a complex NPC, he may have to evaluate his satisfaction in doing all kinds of different things. This might involve doing calculations for, say, 200 possible locations in his little world. Now multiply this by 50 NPCs or so (being unrealistically simple here) and you have over 10,000 locations that must be processed. That takes time, and time is money... or something like that.
Anyway, you can probably solve this issue fairly easily. The next minor thing I don''t like about it is realism. I may have a really strong desire to get more Mountain Dew, and simultaneously have a really strong desire to beat the living tar out of my coworkers. If my coworkers are near the refigerator, will that increase my desire to go there? Not usually.
In reality, most people are either too lazy, too real, or, frankly, too absent to weigh things like that when making decisions. If they are in a burning condo, they may have desires to watch TV, eat pizza, and play Quake. They can satisfy all those desires by going to their neighbor''s flat; but this should not outweigh the fact that they want to save their butt from being roasted in the building.
My suggestion would be to base a NPC''s decisions on their personalities. If they are dumb or impulsive, make them go wherever they want to go most. If they are wishy-washy, make them spend time trying to decide. If they are highly rational, like, say, a Vulcan, make them use the best-location system to decide.
This has a few advantages. First and most practically, it cuts down on the time spent having NPCs make choices. Secondly and most importantly to the gameplay, it makes characters more REAL by making them act the same all the time.
Personally, in an RPG, I like to see characters be individual. I don''t like prescripted behavior; I don''t like everyone being the same; and I don''t like characters who are overly thoughtful and logical. If you want to make your NPCs seem more real, personally I would give them each their own unique logic. Not just for deciding things, but their own little section of the game that controls EVERYTHING about them, from their pet peeves to their grand plans to control the PTA elections.
Apoch
Lead Developer
The Freon Project
ApochLead DeveloperThe Freon Project
quote: The only problem I really see with it is, if you have a complex NPC, he may have to evaluate his satisfaction in doing all kinds of different things. This might involve doing calculations for, say, 200 possible locations in his little worldI don''t see my NPCs having much more than a dozen needs/desires each. This wasn''t clear in my post, but I''m not having them process the desirability of every location on the map. As they run through their list of needs in the prioritization process, they keep track of possible destinations and only accumulate the needs-satisfaction potential of those locations.
quote: My suggestion would be to base a NPC''s decisions on their personalities. If they are dumb or impulsive, make them go wherever they want to go most. If they are wishy-washy, make them spend time trying to decide. If they are highly rational, like, say, a Vulcan, make them use the best-location system to decide.I''m still allowing for individual personality to affect the decision process. The urgency of each type of need varies over time, and the personality of the NPC determines how quickly or slowly different types of needs rise in priority for the character. For example, every character has a need named Home, which describes the character''s desire to be in familar surroundings. An adventurous NPC would have a small or zero value for his Home''s rate of increase. The urgency of the Home need for a timid NPC will rise rapidly when s/he is away from home.
quote: Personally, in an RPG, I like to see characters be individual. I don''t like prescripted behavior; I don''t like everyone being the same; and I don''t like characters who are overly thoughtful and logicalI agree. I think my suggestion adds a bit more complexity without really making everybody more logical. An NPC can realize that rather than satisying one high-priority irrational need at location A, he could instead satisfy three medium-priority irrational needs at location B. And one huge-priority need can still outweigh the combined priorities of several other needs.
Thanks for the feedback,
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.
quote: Original post by Apoch
The only problem I really see with it is, if you have a complex NPC, he may have to evaluate his satisfaction in doing all kinds of different things. This might involve doing calculations for, say, 200 possible locations in his little world. Now multiply this by 50 NPCs or so (being unrealistically simple here) and you have over 10,000 locations that must be processed. That takes time, and time is money... or something like that.
Planning. When there''s time to evaluate things ahead of time, preprocess a fair amount of decisions based on fixed discriminants. When time is short, use shortest distance per need satisfied.
The other thing you want to do is minimize the number of NPCs for which you perform calculations by only performing relatively detailed evaluations for NPCs close to the player/viewport, and periodic ("step evolutionary") updates for all others.
I like the idea; I think it has a lot of potential.
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
Great ideas, I would ask what is the purpose of the NPC''s moving? How does it effect games play? Is that effect positive? Is it worth the cpu cycles vs the added effect.
I''m sure you have good reasons, I would love to hear them =)
Joshua Morris
Game Designer/Producer
I''m sure you have good reasons, I would love to hear them =)
Joshua Morris
Game Designer/Producer
Game Designer/Producer -(unannounced project)Former Designer and Producer of Starfleet Command II and Orion Pirates
quote: I would ask what is the purpose of the NPC''s moving? How does it effect games play?I have mobile NPCs because a major aim of my game is to have a dynamic world where NPCs go about their own business whether or not the player becomes involved in their lives. The NPCs will have the same capabilities as the player, and the idea is that the player will come into conflict with other characters who will be after the same things he is after. A side affect of NPC movement is information distribution. When a character spends time in a different populated area, the character aquires some of the common knowledge of the populace, and depending on the openess of the character, he transfers some of his knowledge to the populace''s knowledge base.
quote: Is it worth the cpu cycles vs the added effect.If you mean NPC movement in general, well then definitely, since that''s a major point of the game. If you''re talking about my prioritize-by-location idea, the answer is I''m not sure. Ideally, the answer is yes. I would like to see the player being able to plan his actions along this route: "I know NPC Fred is also interested in stealing item A from NPC Gary (who lives in a town 100 miles west), but I also know that Fred has pressing concerns in his hometown (100 miles south)which are growing quite urgent. If I know Fred (and hopefully the game will let the player get to know Fred), the combined concerns in his hometown are a bigger draw than stealing item A from Gary, so I have an extra week or so to rest up or plan or whatever before I make my move on item A".
For me, the stumbling block is breathing enough life into the characters so that the player does take the time to notice thier different personalities, but I think I''m starting to drift off topic here.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement