Jump to content

  • Log In with Google      Sign In   
  • Create Account


NPC AI in RPGs (2)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
41 replies to this topic

#1 Nazrix   Members   -  Reputation: 307

Like
Likes
Like

Posted 01 July 2000 - 08:42 AM

I started another thread cause that was getting cut off for some reason...at least for me it was dwarfsoft, finally someone is thinking upon the same lines as I do I couldn't agree w/ you more about the fact that NPCs should move around, and have an agenda. In the RPG I'm currently making, I have it so that each NPC has a schedule of where they're supposed to be at different hours of the day. Plus, that schedule can be changed dynamically as the game progresses. So, instead of quests and encounters happening at fixed points (like in Baulder's Gate) they happen more by coincidence as in real life. You may be just walking along and an NPC happens to walk by, and some sort of quest could arise. I like the idea of NPCs sharing information. That would add a lot of realism. Edited by - Nazrix on 7/1/00 2:44:05 PM

Sponsor:

#2 dwarfsoft   Moderators   -  Reputation: 1214

Like
Likes
Like

Posted 02 July 2000 - 05:10 PM

I think your post went through into NPC AI in RPGs the first time... Pity you cant read it tho... I would like to see your implementation of this, my RPG is going to be fully based around the NPC''s if I can actually do what I want that is


-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
and our eGroup:
http://www.egroups.com/group/dwarfsoft

#3 Ingenu   Members   -  Reputation: 851

Like
Likes
Like

Posted 02 July 2000 - 08:40 PM

Happy to see that I''m not the only one having designed such NPCs.
Implementation not done yet for me

Maybe we could write this NPC engine/calendar all together and use it in our respective projects ?

Tell me if you agree.

You can mail me (check the icon on the top of my post)

(oh... Forget to mention I use C/C++, so I would write this ''module'' in c++. I hope you''re using C++ too.)


-* So many things to do, so few time to spend *-

#4 Altmann   Members   -  Reputation: 122

Like
Likes
Like

Posted 02 July 2000 - 08:54 PM

What exactly do you mean by calendar : goal-driven ? If it is the case, it all goes back to deduction, my friend

Anyway, of course there is a need for passing messages. Since I''m basically a Unix programmer, could anyone summarize me what windows-style message passing means ?

Be reading you,
David

#5 Nazrix   Members   -  Reputation: 307

Like
Likes
Like

Posted 03 July 2000 - 03:56 AM

Yeah, I don''t know why I can''t see the rest of that post. I''m at work and I tried 2 different computers to no avail...

Ingenu, that''s a pretty good idea. I use C++, yes. The system I''m using now is pretty crude, but it works.

Every NPC has an x and y value that tells them where to be at each hour. So, once the hour changes it scans through every NPC and compares their current x & y to the x & y they''re supposed to be and moves them there. It holds everything in arrays. If I want to change where they go, I just change the values of those arrays.

Crude, but effective.



"The road of excess leads to the palace of wisdom." --William Blake

#6 Ingenu   Members   -  Reputation: 851

Like
Likes
Like

Posted 03 July 2000 - 05:12 AM

Altmann : I mean that a NPC is following a schedule(r?).
Like anyone in the real world, he got things to do.
I don't know what's the meaning of 'windows-style message passing'.


The basic system will provide wandering NPC.
(Unlike in FF where the same people are always at the exact same location doing nothing and repeating the same sentences over and over.)

You define a one week long schedule for each NPC, and it'll follow it, with possible change.

As a second step, I would like to enhance the NPC AI by 'giving' the NPC needs and solutions to 'not need' anymore.

This will lead to a dynamic coherent world.
Need : Food.
Solution : Go to a food shop. Buy some food.
(Pathfinding...)

[Using a need/asnwer system may create a really nice world]

We'll need a bit more thinking and planning about that before working on it
Design is essential.
Happy to see that we'll work together Nazrix.




Edited by - Ingenu on July 3, 2000 12:23:17 PM

#7 Nazrix   Members   -  Reputation: 307

Like
Likes
Like

Posted 03 July 2000 - 05:48 AM

Ingenu,
That's an interesting idea to include a need-based schedule as well.

So far, I was mostly thinking about each day the NPC goes to work for a while then goes to the tavern for lunch...that sort of thing. And of course story-based schedules where the schedules changed because of the story

I'm suprised more RPGs don't incorporate this sort of thing as it doesn't seem too hard to do...

It would be nice to work together, Ingenu, and share some ideas

"The road of excess leads to the palace of wisdom." --William Blake

Edited by - Nazrix on July 3, 2000 1:42:47 PM

#8 Altmann   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 July 2000 - 06:29 AM

Ok, got it.
(Windows-style was something written by dwarfsoft on the previous thread)

My goal-driven approach is basically your "need"/"not need" idea.

How do I "not need" eating ?
Either :
* go buy some bread
* go buy some meat
* ...

How do I "go buy" xxx ?
Either :
* if xxx is bread, go to the nearest bread shop
* go to the nearest supermarket

How do I "go to" the nearest yyy ?
Invoke path planner
...

Basically, this is a fuzzy expert system.

P.S. : If anybody is interested, I am mixing C++ and Java.

#9 Ingenu   Members   -  Reputation: 851

Like
Likes
Like

Posted 03 July 2000 - 09:42 AM

Altmann, I think that you're welcome if you want to work on the subject with us.

We mustn't be too many cause it become hard to manage many people but a little commity often generate great ideas.

Mixing JAVA and C++ ?
What exactly do you want to do ?
Scripting with JAVA in a C++ program ?

Nazrix : We'll have to design for a while before writting a single line of code.
(Well it's how I work, I hope it's ok)

Conceptual design, problems/solutions, code design (objects...), code programming.




Edited by - Ingenu on July 3, 2000 4:44:52 PM

#10 dwarfsoft   Moderators   -  Reputation: 1214

Like
Likes
Like

Posted 03 July 2000 - 11:35 AM

I use C++, so that would cover that. I am basing my whole game around the NPC''s interaction with each other, and deduction (in my opinion) is not going to be the be-all and end-all of it. Message based (like I said before) is probably going to be enough to cover it. But you may also have to assume that a message could be a visual message like being seen with someone. I am sure that I can get great functionality out of a message based system, provided that I design it right



-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
and our eGroup:
http://www.egroups.com/group/dwarfsoft

#11 MikeD   Members   -  Reputation: 158

Like
Likes
Like

Posted 03 July 2000 - 11:09 PM

Dwarfsoft, I think the key idea for that is having nice simple methods that become complex through massive emergent behaviour. I don''t think it''s necessary to have any high level functionality just a small number of interacting rules that give the impression of complex relationships.

I''ve always loved the idea that a new NPC could be born with certain set concepts because of their background so that each time they meet any other agent in the game (player or NPC) they start up a new node in a relational database based on their preconceptions. i.e. a dwarf might be initially wary of elves but absolutely hate goblins, so that as soon as the dwarf met a goblin they would try to kill it or at least stay away from it. Every time the dwarf interacts with another agent their relationship would be updated based on events that occur (I think an events handler is a more accurate name than a message handler), obviously in the case of a goblin it would take less for the dwarf to be pushed over the edge and kill the goblin than it would for them to become lifelong friends. However, if the dwarf liked one goblin it would probably make them less hateful of other goblins (though not by much) and, maybe, in turn, having another dwarf see them being friends might affect their general concept of goblins. Either that or make them hate that dwarf for being a traitor.

If this sounds complex then try breaking it down into simple rules that make sense in your social context. People really aren''t that complicated you know ;-)

(Not that I''m suggesting you weren''t doing all of this anyway, I just thought I''d put my ideas down here for imminent flaming)

Mike

#12 Geta   Members   -  Reputation: 136

Like
Likes
Like

Posted 04 July 2000 - 04:51 AM

quote:
Original post by MikeD

I think the key idea for that is having nice simple methods that become complex through massive emergent behaviour.



I really agree with this point, and I think its important for all of us trying to build complex NPC or agent behavior to keep this point at the forefront of our design considerations.

Look at nature, and one can see numerous examples of complex behavior that emerges from simple (yet unrelated) rules. Craig Reynolds'' work with flocking aptly demostrates how such behavior can be codified.

In a FPS, I was able to get NPCs to flank their opponents in a firefight, simply by seeking a non-LOS path (ie. a path where a node was given a bonus if it was not in the LOS of the opponent) to the opponent. From an observation point of view, it looked like the NPCs were actively flanking, but they really were not.

I think this key point that MikeD raises, means that one should focus on identifying the simple rules, and not the complex behavior.

Eric


#13 Kylotan   Moderators   -  Reputation: 3338

Like
Likes
Like

Posted 04 July 2000 - 05:00 AM

quote:
Original post by Geta

In a FPS, I was able to get NPCs to flank their opponents in a firefight, simply by seeking a non-LOS path (ie. a path where a node was given a bonus if it was not in the LOS of the opponent) to the opponent. From an observation point of view, it looked like the NPCs were actively flanking, but they really were not.



Yes! Lots of people forget that the lovely part in a path-finding routine that calculates the ''cost'' is not restricted to physical obstacles! As you stated, enemy line-of-sight is a good one for certain units. Territory ownership might be another, to avoid violating treaties, or you could generate an influence map and use that to keep non-combat units in ''safe'' areas, etc etc.



#14 Kylotan   Moderators   -  Reputation: 3338

Like
Likes
Like

Posted 04 July 2000 - 05:22 AM

quote:
Original post by Nazrix

Every NPC has an x and y value that tells them where to be at each hour. So, once the hour changes it scans through every NPC and compares their current x & y to the x & y they''re supposed to be and moves them there. It holds everything in arrays. If I want to change where they go, I just change the values of those arrays.

Crude, but effective.


Ultima VII does this. Although I think it is in 3hr slots, not hourly slots.

http://www.udic.org/ftpud/unsorted/schedule.txt



#15 MikeD   Members   -  Reputation: 158

Like
Likes
Like

Posted 04 July 2000 - 05:57 AM

For my next job I''m going to wait until I find a company that''s writing a real time strategy game. As Kylotan says there''s so much that can be done with simple pathfinding it''s unbelievable.

Just giving the path finding function for a harvester a set of heuristics that demote nodes on a partial path if they are near a firefight would be fantastic. Giving different troops specific commands as to where they should or should not go on the map by dragging a no-go box over certain areas or setting a level of agressiveness is a simple improvement that would take away so much of the frustration of current RTS games.

Btw Geta, I like what you said about flanking troops in an FPS but I partially disagree. If the plan was to flank then the actions to carry out that plan for real people in a real situation would be, move to a specific point while keeping out of their LOS. Perhaps you didn''t have the planning layer but that doesn''t mean they weren''t actually flanking :-)

Mike

#16 Ingenu   Members   -  Reputation: 851

Like
Likes
Like

Posted 04 July 2000 - 09:46 AM

Here''s my quick thoughts on the subjects.
Might be a long post, but will try to avoid that.

AI Schedule/engine:

Concept:
Giving the world dynamic and living pattern by using actives NPC using a Schedule and/or a need based system.

Methods:
-Weekly based Schedule (Updated every hour).
(Weekly to avoid seeing to much repetition in the NPC activities)
-Optionaly using a need based system.
-Setting up a NPC MAnager to avoid consuming to much CPU cycles managinf off screen NPC.
-Creating a sector updater, to update the NPC status when entering a sector.
(the engine will compute what the NPC have to do, and compute the result of the need based system)
-Schedule modification following the result of the need based system.

OR
-A weekly schedule with a need system.
(In this one, the Schedule is only used as a general behaviour thing)

OR
-Need based only system.
(But giving the NPC a way to solve his problem, a job, and various other stuff)

TODO list:
-Basic need based system with simple needs (food, drink...)
-Not to forget special behaviour (in case of fire what to do..)
-Basic Schedukle system
(I think Nazrix already have done such a thing )

Discussion on the concept, methods is welcome
(It''s time to sleep here in FRANCE, so see you tomorrow)






-* So many things to do, so few time to spend *-

#17 Geta   Members   -  Reputation: 136

Like
Likes
Like

Posted 04 July 2000 - 03:32 PM

quote:
Original post by MikeD

Btw Geta, I like what you said about flanking troops in an FPS but I partially disagree. If the plan was to flank then the actions to carry out that plan for real people in a real situation would be, move to a specific point while keeping out of their LOS. Perhaps you didn''t have the planning layer but that doesn''t mean they weren''t actually flanking :-)

Mike


A "planning layer" is a whole different issue, than generating complex behavior from simple rules (ie. emergent behavior), which was my point by including this example.

In the case of the FPS mentioned, there was no plan for the NPCs to flank their opponents. There was only a plan to survive any firefight, neutralize/kill their opponents, and move on with the mission, and accomplish its goals. The "enabling" of the non-LOS effect to pathfinding was the extent of the "flanking" plan in that particular game.

Eric


#18 Nazrix   Members   -  Reputation: 307

Like
Likes
Like

Posted 04 July 2000 - 06:52 PM

quote:
Original post by Kylotan

Ultima VII does this. Although I think it is in 3hr slots, not hourly slots.




Cool...I'm glad to hear other games have used that method. It gives the idea some validity for me. I really need to play the recent Ultima games sometime soon


"The road of excess leads to the palace of wisdom." --William Blake

Edited by - Nazrix on July 5, 2000 1:55:41 AM

#19 Ingenu   Members   -  Reputation: 851

Like
Likes
Like

Posted 04 July 2000 - 09:23 PM

My need based system is based on my economics lessons at university

There was a needs/satisfaction explanation.
The system was basic but efficient, so very good for a computer game.

I think this system is/will be used in Black & White.

Nazrix and dwarfsoft, what about my previous post ?
Which system do you prefer ?


-* So many things to do, so few time to spend *-

#20 dwarfsoft   Moderators   -  Reputation: 1214

Like
Likes
Like

Posted 04 July 2000 - 10:01 PM

I have not really considered the economics side, but if you are trying to simulate communtication, then the easiest way I can think of is messaging. There are probably other ways that this could be handled, but I still think that if you are going to have communication simulation then you need to have some kind of messaging. Deduction should not cover it.

I have heard a lot of good ideas from this group, I hope that you guys can give me a few more to try and stick in my game . I still have to get the UI up and running, but it is looking good .



-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
and our eGroup:
http://www.egroups.com/group/dwarfsoft




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS