🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

An AI question.

Started by
22 comments, last by KingMolson 22 years, 5 months ago
quote: Original post by Vendayan
Ok, so the prince thinks that hiring an assasin is the easiest way OBVIOUSLY because he could be caught red handed right? What if he was trying to kill a hermit in the woods, which doesnt have that danger involved? Hiring an assasin might work but would the charater be capable of weighing the gain to the risk of having the assasin rat him out if he was caught by the king's 30 gaurds? And what if the guards were killed? wouldnt you then have to recalculate the danger value all over again for every possible choice an NPC could ever make?!



Well my plan is to have files that write out different goals (the actions involved, the pros/cons, what it will ultimately satisfy or do, etc)

Here's a little quote from one of my other recent posts



I am defining a "Goal" as a collection of simple actions such as
MOVE, ATTACK, BUY_ITEM, etc. Actions are hard-coded while goals are not and goals are just groups of those hard-coded actions. Also, a Goal has some kind of final thing that satisfies the goal and causes it to be finished.


Something that may satisfy a goal might be a certain person being killed, an item being taken, etc. I plan to have a big list of these.


GOAL murder
{

TARGET npc[random]
SATISFY dead[target]
NUMACTIONS 2
ACTION move
ACTION attack

}


These steps would be repeated til the satisfy attribute is fulfilled or until another goal takes higher priority.

I plan to make these more interesting later but this is the basic idea. Plus, goals can be put inside other goals as another step which should be pretty powerful.

This sort of thing combined with the items that you are talking about could be very interesting.


A CRPG in development...

Need help? Well, go FAQ yourself.

"Feel free to utilize Pouya's cliff." - Fel


Edited by - Nazrix on January 23, 2002 9:40:05 PM
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Advertisement
Kylotan is right, what I just said does have a script sound but ultimately from the player perspective I don''t think it would appear that way. And they game wouldn''t be 100% the same every time you play or at least it wouldn''t have to be because of the combination of NPCs and their interactions would be different every game kind of like a chess game.

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
Couldnt you basically make a script language that had as a base all the basic actions that an NPC could do. Then you make action classes, for example the Attack Nearest Monster class would have an action that would target the nearest monster, the actions too move too it and then the attack action. Then in some action classes you leave possibilities, like instead of writing every possibility you have a Rise in Rank class with subclasses like Kill superior, work hard, bribe someone. The subclass could be chosen through your attribute system. For the King and his brother scenario, the Prince wants power, so the Rise in Rank action (that is associated with his personality type) is activated and because of his attributes he choses too murder superior, the superior is the king, so he has chosen to murder the king. Then he has subclasses in murder superior, all forms of killing a superior, including assasination. Because of his personality type he again chooses assasination.

Basically, it would be like writing up a whole bunch of scripts and letting the NPC's choose which ones server them best based on their AI type and perhaps also previous events, not sure how that would work in though.

Edited by - KingMolson on January 23, 2002 11:05:11 PM
I find it VERY amusing that people love to re-invent the wheel many times over! Might I draw your attention to the AI field known as planning ??? In particular, if you want to implement a system of desires (which is really a preference scale for outcomes of goals) then consider decision-theoretic planning .

quote: Original post by Nazrix
Yes I went through that same dilema. Basically it's my understanding that an agent or NPC can only know something if:

A) we (the desingers/programmers) tell him
or
B) the NPC learns from some kind of memory/learning type of AI

So far with my AI I have been going with the idea of telling the NPC by giving him the info to make a decision. I know it's not as elegant as an AI mechanism where the NPC is really making a total decision, but I am not sure we can do better for real-time apps like games.


You can do better much than that. Implementing decision-theoretic planning in a game would be a fairly trivial matter since it's a "toy world" problem.

References: There's an excelent book by Thomas Dean called, "Planning and Control". It has much more than you need for a game AI, but you should find it useful. Alternatively, check out his article, "Decision-Theoretic Planning and Markov Decision Processes", which you can find on the web. There are plenty of other authors who work in the field. If you check out www.citeseer.com you should be able to find related work by seeing who has referenced Tom Dean's articles and who he has referenced.

If you have specific questions, I will be happy to answer them.

Good luck,

Timkin



Edited by - Timkin on January 24, 2002 9:50:35 PM
Thanks Tim...I''ll do some reading then

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
This team seems to be doing the same thing we are discussing.

A CRPG in development...

Need help? Well, go FAQ yourself.

"You shouldn''t drink to forget your problems. You should only drink to improve your social skills." - Barnie
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
quote: I find it VERY amusing that people love to re-invent the wheel many times over!
There are better wheels, and less costly wheels. In fact, I''m pretty sure new wheels are being invented even as we speak. Should we discourage the practice ?

What I mean to say is : planning in games is far from perfect so it doesn''t hurt to think it through every now and then.

Thanks Nazrix, that stuff was really good reading.
quote: Original post by KingMolson
Thanks Nazrix, that stuff was really good reading.


Yeah I agree. I just wish I had the time to give it a really detailed reading because there''s a lot there.



A CRPG in development...

Need help? Well, go FAQ yourself.

"You shouldn''t drink to forget your problems. You should only drink to improve your social skills." - Barnie
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
quote: Original post by Timkin
If you have specific questions, I will be happy to answer them.


I guess my major question is how could an agent might, for instance, know that "eating" would "satisfy hunger" or "increase energy" or whatever unless we make that a rule of the world? Hope I am making some sense.

If we make that a rule of the world:
When you're hungry, eat

then it starts looking like scripting...especially when you get into more complex things like if you want power, take over the throne

I know things could be more fuzzy and less exact when it comes to rules but there must be some fairly definite rules introduced by the designer...at least it seems that way to me


A CRPG in development...

Need help? Well, go FAQ yourself.

"You shouldn't drink to forget your problems. You should only drink to improve your social skills." - Barnie


Edited by - Nazrix on January 28, 2002 1:11:18 PM
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi

This topic is closed to new replies.

Advertisement