NPC AI

Started by
46 comments, last by Nazrix 22 years, 4 months ago
quote:Original post by Ferretman
Yes, best of luck in this one. Will you post on how you''re proceeding?


This thread explains what progress I''ve made which isn''t much ''cause I haven''t been able to work on til Christmas break. But I think that the progress is going pretty well for what little time I''ve had for it. Tell me what you think
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Advertisement
on the matter of pre-computing series of actions towards achieving complex goals, you have to release that, constructing what you call a simple message system, where an agent activates processes in the object it is interacting with, the tree of potential actions towards achieving any goal can be exponential in size. the key to finding solid responses to goals or desires is to search the tree and find an adequate series of basic defined responses that result in the goal being achieved. the search time, however is huge. I was reading something very similar to this in gamasutra, the key is to build in limitations on your search of the tree (only a certain depth and no further will be searched) and to also pre-limit certain branches of the tree. However, the recursive nature of this method is a step in the right direction I believe.
consider this: your agent is in a small room with a single door, and a key on the floor. the actions you define are: unlock, pickup and open. the agents goal is to leave the room. The only successful series of actions is pickup, unlock and open. if the agent calls open or unlock without first getting the key, nothing will happen and the goal will not be achieved. even for this most basic case with only three actions, you wind up with 27 resulting series of actions.
sorry this is so drawn out, but this really justifies precalculating some of the plans and limitting what agents can calculate. also, this may give you some insight into methods of implementing planning into your agents. I really like the method blocked out where you have magnitudes of planning, get popular->buy big house->make money->rob bank->etc where by choosing from abstract decisions based on a few personality flags, you can have agents doing complex action series that are unique. the real complexity, intelligently choosing actions that maximize the achievement of multiple goals, I dont think even humans do so well yet. the method of searching for this would become more complex. Instead of having an accepting state for a certain result, you can apply weights based on the context of the agent searching, and have the agent want to use the method with the highest weight. still, the search for this can not be comprehensive at runtime unless you dont care about speed and storage space
I apologize, I see how incomprehensible this is.
I suggest you check www.gamasutra.com under features, programming and artificial intelligence. There are some articles that deal with exactly the problems you describe. You can construct a tree of possible actions in a series towards achieving any goal. The key is efficiently searching the tree for the series of branches that will lead to the desired result for the agent doing the searching. You often have to pre-define the plans, or limit what the search will cover (in depth down the tree and in the context of the task, where certain action paths are pointless) in order to have the agent efficiently find a good plan.
As I was trying to say in my previous post, you can then use the hierarchical planning method where agents just have a few simple personality variables that determine what path they prefer to choose.
I plan to build a little city and implement this with a series of simple interactions possible, a few primitive perceptions, and a medium sized collection of agents. I want to make sure there are a lot of possible plans to achieve stuff, and maybe I will build in the search weight function, designed to achieve a number of goals to varying degrees with a single path. It should be interesting.
BrianSchulman,
Thanks for the info. That was one thing that came to mind is that NPCs could search before the game began and through trial and error find what actions lead to certain results, thus learning on their own without the somewhat tedious aid of a programmer. I know that is not a new idea but it sounded like at least a possibility anyway.

Although pre-computing would not be a terrible thing either. Another thing (this comes from my thread in the game design forum) I''ve been thinking about is:

...each goal will have a list of attributes that it can potentially increase/decrease.

For instance a STEAL goal could potentially increase wealth but decrease reputation. A EAT goal could potentially increase the food attribute...

In essence an NPC would choose a particular goal based upon what he/she wants to increase (food, reputation, etc). I''m not sure of all the details yet though. This is the abstract version of the idea.

Although this is similar to the pre-computing concept.




A CRPG in development...

Need help? Well, go FAQ yourself.
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Let me just say this: If you create a perfect NPC, plan on getting the Nobel Peace Prize. remember that it''s just a computer, and giving a computer traits like how to bank money is very human-nature.

Hey Naz,

I totally dig your idea but as Zues said, you deserve the nobel peace prize if you can create the perfect NPC. Let me throw this idea out... the world of gaming has become vast with the advent of internet gameplay and we''re pretty hard pressed to create an AI as challenging OR fun as your buddy on the other side of town (or the world).

So, how ''bout we switch directions (and I say this cause your idea could fit well with this). Rather than acheiving a character that is tough to beat, how about a character that can be strategically used against other player characters... dynamic characters such as yours would be highly unpredictable and allow players to "set up" the other players in situations. Perhaps your idea would be better if concentrated on player interactions rather than item interactions. Just a thought, after all, I don''t know the inspiring force behind this idea. IMO, this is where I''d like to see all of my extra CPU cycles going towards in the future =)

As for implementation, I hate to see a great idea die and this is one of those projects that can hit you like a tidal wave 10,000 lines of code down the line. I don''t believe in the phrase "in over your head" as long as you plan like a madman!

Good luck, Naz!




Many of the truths we cling to depend greatly on our own point of view

Get Tranced!
Quit screwin' around! - Brock Samson
My intentions were not so much to create an unbeatable NPC. My intentions were to create NPCs that appear to react autonomously. This, I believe, will cause NPCs to create adventures and quests by themselves.

Instead of scripting things such as NPCs stealing something from another NPC or other such scripted events, the system would create adventures from the conflicting needs and goals of the NPCs. An NPC would do something not because it''s scripted but because it fulfills his disires/needs.

It''s not a simple thing to implement at all. It may not even be as fun as it sounds on paper, but I''m only implementing it in a testing program so I don''t waste a whole game on the idea.

A CRPG in development...

Need help? Well, go FAQ yourself.
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
How about you people stop saying it is close to impossible and help. That is what I did and I think his code has taken a few quantum leaps with my help. If even two mor people helped, it would make everything easier.

This topic is closed to new replies.

Advertisement