🎉 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!

NPC AI in RPG's

Started by
58 comments, last by dwarfsoft 22 years, 12 months ago
Speaking of NPC AI whey dont they get mad whaen you barge in their houses like in games like Lunar 2 and Final Fantasy. And they only walk back and forth. Weird stuff man....lol
Geek
Advertisement
quote: Original post by mad_goldfish

Sounds to me like Q-Learning and W-learning, [snip]



Not quite. The Principle of Maximum Expected Utility (MEU) assumes you have a utility function defined over domain states. The MEU then provides a means for choosing actions in light of this utility function.

Q-learning (and other forms of reinforcement learning) presume that the utility function is implicit in the reinforcement values returned by the evaluation portion of the algorithm (which takes states/actions as input). That is, considering these ''rewards'' over all states constitutes a utility function.

Tim

quote: Original post by Anonymous Poster

So far, we''ve got a pretty good simulation of a bunch of drunks in a bar. Still need to work on relevance...



Sounds interesting. Perhaps you could consider including a ''context'' variable that has the same scope as the ''distribution'' variable. There would be one context value per conversation going on. The challenge for the player is to deduce the context of a discussion between NPCs and conversely, the challenge for an NPC talking to a player is to determine the context of their discussion (this is an active research area).

Once a context is defined, then relevance should be fairly trivial to deduce.

Tim
hmm... i think i should say something because i was in charge of coding AI for moonpath (Dream Dust Oy:s RPG) an the thing is that i coded for 8 months and didn''t get anything else but 200 000 lines of MATRIX (my script lanquage that i had made for AI coding0) and that is over 1 000 000 lines of C++ and still i didn''t get them to be intelligent. so after 8 months of 20hour days i got burnout. and that was the end on moonpath. AI was only 10-20% finished so it had got to big. think about it. 10million lines of C. not even newest computers can handle that. so the starting point should be to make good AI not perfect ai that simulates everything.
quote: Original post by Anonymous Poster

[snip] ...so the starting point should be to make good AI not perfect ai that simulates everything.



Okay, I'm sure I'll cop a flame or two for this one... but...

Scripting your AI is definitely NOT the way to go when you want to imbue your agents with behavioural traits or decision processes that appear intelligent. Scripts are useful for small domains where you can meaningfully right down rules of actions... if condition then action .

Scripting of a storyline or high level actions (like take a trip to another town) would be reasonable if they are integral to the story line, but unfortunately most game producers think everything can be solved with a script. Oh, and a script is NOT AI, its PI (programmer intelligence!).

If you have a large, complex, dynamic domain a script just wont cut it.

This is why we aren't seeing an advancement in game AI that keeps apace with processor and memory advancement... people are using tools that were appropriate 10-20 years ago to make the games of the future.

My $0.02 worth.

Tim

Edited by - Timkin on June 6, 2001 4:57:52 AM
I have to agree scripting is not the way to go. A few monthes ago, I implemented an NPC AI design I have been working on for a while. I made a town of 100 people. Each of these AI''s was a large datastructure that housed mainly a reasonably complex NWeb I grew. World and loop inputs filtered through the web changing mood and need values as well as setting off motor functions that corosponded to certain need and mood combos. I.E. Once the food need hit a certain threshold, they ate. If no food was readily available, they searched for it, and more than likely boaght some at the store. I had to get a main group of 50 or so trained in order for the rest of the population to catch on and the process to thrive, but it worked. Thay had basic "emotion", I.E. certain things evoked responses that would be interpreted in our world as emotion. Love was reduced to the discovery of a "compatible" NWeb of the opposite gender(sorry, I was unwilling to put in an implementation of gay rights). Sex only occured if the "couple" was in the "mood", and reproduction was implemented using a chromosome algorythm, so data stagnation never occured. Yes, I put in chances for twins of all types, and pregnancies failed if the NWeb(s) the "mother" looked after was not cared for enough. The was a simple but stable supply and demand market. Services and jobs were taken and done on a form of growth and need basis. AI''s hired other AI''s to build houses and such. I had to set up "companies" because I am still experimenting with an algorythm of creation on such a level, but AI''s did work. Yes, I had to make a Thieves guild to have a level of crime, and a Police company too... There were disasters such as fires, and floods, partially driven off the very simple flow-weather system I used. I am actually fairly certain a dynamic storyline is in my grasp as well. I had one AI who succesfully, saved a "baby" (immobile NWeb) from a burning house. It involved moving inot the house, getting the baby, and moving out of the house, but graphics would have made it more dramatic I''m sure. I had to do a lot to get it started, but they did function as a community. I have since been playing with my NWebs to add more detail, and my old web is pretty messed up because I did a little god playing ( 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.
"Victims...aren't we all?" -Brandon Lee, the Crow
quote: posted by KaneBlackflame
I have to agree scripting is not the way to go. A few monthes ago, I implemented an NPC AI design I have been working on for a while.....*snip*


interesting....
how fast was this simulation?
and how did you display the results without graphics.
it would be interesting to see a demo of that, assuming thats possible of course

I would say that scripting shouldn't be dismissed so rapidly, even with good ai you still often need methods of triggering events, at least in games you do.

however, a few lines of good propagating self-contained ai can be worth 10's of thousands of lines of equivalent scripting code.

good scripting can give you, as the world creater, a good way of directly controlling a hundreds of bots.

"Bad Day... F**K it!" -Stephen Baldwin (Usual Suspects)

Edited by - Nutter2000 on June 7, 2001 7:25:12 AM
"Bad Day... F**K it!" -Stephen Baldwin (Usual Suspects)
I must reform what I said...pure scripting isn''t the way to go...to be honest, all of the motor functions were scripted actions. THe simulation ranthe whole toen a few times a second, but the toen was never bigger than 132 people...I throttled the "game" area so not enough food could be made for a population much more than that. If the next demo goes well, I''ll post a well grown demo if you want. I''m still a few weeks away, but I would be happy to show it after it get it running again. It''s not as interesting as I lead on...I had a log file printed of all actions taken...I let it run for 10 minutes my first run and stopped it to make sure the log file was working and found a huge! log file of sleep, eat, move...I ended up only logging certain events like going to certain places or doing certain things, and these went to separate files. When a distaster happened, I had everything be logged during the event, that''s how I saw my ''hero''...but most of the time, nothing but simple everyday stuff goes on...the trends and paterns that emerge though would surprise you...On some levels, humans are actually reasonable! I had never thought this until I saw my "families" doing what we do...someone goes to work, someone gets food for the house or cares for sub NWebs, sub NWebs do stuff that makes them happy. I don''t know, most of it was pretty un-entertaining, but it did show me a good path...a set of NWebs to decide which script to run may provide a viable solution to mobile NPC''s...of course, conversation is a little harder...
"Victims...aren't we all?" -Brandon Lee, the Crow
KaneBlackflame, what exactly is an NWeb? Something like Neural Nets?

The RPG I''m working on uses a form of event driven behavior. Right now, it''s just a real-time battle system, where you control your character''s movement and aiming. When you walk, depending on your stealth rating, you may make noise. Then all people within the range hear it and react. They all have a list of known things and have preferences (like A will attack enemy before he''ll heal himself, B will heal a fallen friend before attacking..). They forget after some time and move on after a while.

I also think that EVERY NPC doesn''t have to want to travel. I think it would make things easier if only a few NPC''s actually deviated a lot from their normal routine. I plan on doing something like Naz was talking about, the NPC''s have agendas (just as the soldiers earlier) and go about their business.


--I don''t judge, I just observe
Stuck in the Bush''s, Florida
--I don't judge, I just observeStuck in the Bush's, Florida
quote: Original post by KaneBlackflame
I must reform what I said...pure scripting isn''t the way to go...to be honest, all of the motor functions were scripted actions.


ahh yes, now it becomes a little clearer.
to be honest that was my point, I think that it''s very difficult to get good NN or none-scripted methods to do the basic functions, or at least with much success over a large spread of agents. Also I don''t beleave that we "randomily" learn to do stuff like that in real life, babies seem to have the instinct to walk and know how to walk, and I don''t think it''s just from watch adults. but still thats another issue.

I''m a big fan of using Networks, or fuzzy logic to facilitate state changes I think that is often a nice happy medium that gets the best from both worlds!

I for one would be interested in seeing a demo.

to get back on topic, a set of networks or other more flexible systems could be used for changing which set of mood scripts, e. angry, scared, etc. and influence the conversation that way.

for example, the player needs to get a key from a guard, now depending on how the guard is feeling, he may or may not give you the key. The player needs to influence the guard in certain ways, if he makes him happier as regards the player than he''s more likely to give him the key.

in terms of how to do that, you COULD have say a network which takes inputs on current mood, player actions, etc, this modifies which script set the guard uses at that time. Then only certain scripts could have the token-trigger to get the guard to give the player the key.





"Bad Day... F**K it!" -Stephen Baldwin (Usual Suspects)
"Bad Day... F**K it!" -Stephen Baldwin (Usual Suspects)

This topic is closed to new replies.

Advertisement