View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# RPG NPC AI, Scheduling and Needs...

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.

56 replies to this topic

### #1Ingenu  Members

Posted 07 July 2000 - 04:24 AM

Here''s a new threads following the idea of the NPC AI in RPG (2. The topic begin to be too long to me Here''s a summary of the system: Base Schedule for any NPC. Schedule overriden by the need based system. Need system can be extended to reflect a little more than needs. (Or solutions to suppress them) AI Module written in C++. (So OO) Module since it might be used to create a DLL, or to be integrated in a game code. I''ll do the list of the basic needs. (I know I must do it since some days now ) -* So many things to do, so little time to spend. *-

### #2MikeD  Members

Posted 07 July 2000 - 05:38 AM

As a slight augmentation to a simple schedule, which would generally be fairly restrictive. How about a list of tasks and an associated heuristic as to when they should be carried out. Each task in a standard schedule has a list of actions which are necessary for it''s completion. For a baker a list of tasks might be something like, obtain wood, obtain ingredients, bake bread, go to pub, buy personal groceries from market etc. Each of these tasks being split up into ordered actions i.e. bake bread consists of, light wood in oven, mix dough, place dough in oven, let cook for 20 minutes.
The tasks could be ordered by a heuristic that places a value on carrying out each task, the lower the number the loaves in the shop the higher the heuristic for baking more loaves, the less food in the bakers larder the more likely they are to go to the market.
Some tasks can be more definately ordered by overriding areas of the heuristic. If it''s 5 am bake bread, if it''s past 3pm don''t.

As long as you keep it simple you can''t go wrong.
(HA)

Mike

### #3Altmann  Members

Posted 07 July 2000 - 11:48 PM

I repeat what I just posted on the previous thread : try not to lock yourself into DLLs.

Another thing is that you might not want to do everything in C++ in the first place. You might prefer prototyping in Java first. And I would definitely prefer using a garbage collector.

Anyway, there is a need for an Agent and a Message construct. In my opinion, it could look a bit like :

Message is

• A priority
• A "too late" delay, possibly infinite, for forgettable messages
• A "thinking thread" id, for grouping messages
• An id
• An emitter
• A range of receivers (a base class in a semantic network ?)
• Some kind of type information
• A message-dependent content of variable type (void* ?)

Agent can

• Post messages (invoked by itself)
• Think (invoked by itself, or by some kind of time-sharing facility)

What else ?

### #4dwarfsoft  Members

Posted 08 July 2000 - 04:56 PM

After reading Mikes post I was thinking about how you would go about constructing a task based approach. With pre-requisites for other tasks, you could create a threaded list that requires a lower thread to have been completed before it can be started. This way the NPC could be able to switch between different threads (and different tasks) making it appear like they are multitasking.

The NPC might have a thread like so:
Buy grain -> make flour -> "flour" flag is set
Get urn -> Get Water [in urn] -> get bowl -> pour water in bowl -> "water" flag is set

flour\____> pour flour in bowl -> Make bread
water/

This kind of is threaded both ways (I realised this after starting the example). The flour and the water tasks are BOTH required to make the bread. I am not sure how this could be programmed, but Linked Lists do come to mind . Basically, the NPC might "decide" to go and get an urn, then go and get some water, then take a detour and buy some grain and then go and make some flour, go get a bowl, pour the water and the flour in the bowl. Make the bread.

Just some more food for though.

-Chris Bennett ("Insanity" of Dwarfsoft)

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

### #5Altmann  Members

Posted 09 July 2000 - 05:15 AM

Not to criticize but ... seems to me like an awfully complicated way to describe Petri Nets.

Ok, I wanted to criticize

### #6Ingenu  Members

Posted 09 July 2000 - 06:46 AM

I do think there must be an easier way to do the trick.
Don''t forget we''ll need to manage dozens to thousands of NPC with that system, so that must be fast and efficient.

And easy to programm and debug

-* So many things to do, so little time to spend. *-

### #7dwarfsoft  Members

Posted 09 July 2000 - 11:36 PM

I am not a bitter man, and criticism does tend to offer better results in the long run, provided it is constructive .

Personally, I have not touched Neural Networks or Genetic Algorithms. I have heard of some very interesting stuff about them. Do you know of any good sites on the net that could be useful?

Anyways, I am sure there has to be an easier way. But we don''t really need to be considering thousands of NPC''s just yet. One NPC would be an achievement. Diablo II keeps chunking up too much with NPC''s running around the screen (and getting killed ) so I rather not use them . I guess I am a hard man to please when it comes to NPC''s.

I am thinking of posting up a summary of our Posts on my site. Just a thought at the moment, but I need some material on my site. What do you think?

-Chris Bennett ("Insanity" of Dwarfsoft)

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

Posted 09 July 2000 - 11:41 PM

http://www.gameai.com

( How concise can i get )

Give me one more medicated peaceful moment.
~ (V)^|) |<é!t|-| ~
ERROR: Your beta-version of Life1.0 has expired. Please upgrade to the full version. All important social functions will be disabled from now on.

### #9Alexander Nareyek  Members

Posted 11 July 2000 - 04:34 AM

Here are some pointers to academic sites that might be of interest:

Autonomous Agents:

Planning:

Scheduling:

A game AI research project that covers it all:
http://www.ai-center.com/projects/excalibur/

Best,
Alex

Edited by - Alexander Nareyek on July 11, 2000 11:39:41 AM

### #10CodyVa  Members

Posted 12 July 2000 - 09:21 AM

are you people actually programming this stuff yet? or just theorizing? i''d love to play anything you guys have!

anyways
dos: stay forever!

scheduling. I never played the sims or anything but i guess this is sorta like it
what about npc emotion? And dialogue? I mean depending ont he type of game and setting, what if I(the player) wants to keep an npc?(join party, whatever) how are npc''s gonna remember stuff?

I remember the goblin and dwarves thing somebody mentioned.

I was playing with a sims type game but never made it(no skills)
where all the npc''s had ratings of everybody and thought good or bad of somebody in specific area, like trust, love, and some others and dialogue would be by events, npc''s remembered events
and passed (told,gossiped) them along to others

heard, seen, experienced.
who what where when idea. and that also affected ratings and their todo list. they had priority as in they wouldn''t go do something for the player unless his rating met the requirments...

I wish i could but now that i see these posts it makes me think my idea wasn''t as dumb.

just offering ideas that''s all

### #11CodyVa  Members

Posted 12 July 2000 - 09:25 AM

again.

About the elves and goblins not liking each other, maybe that''s just a stereotype(int he game) and once they get to know each other that will change?

About npc''s and food. (I''m basing my thoughts on final fantasy type games) Maybe it''s not that person that has the food, but the house that has the food, so people living in the same house can split chores, such as wife gets this, husband gets that, while the kids just play all day, who they play with and where they shop (if multiple shops) is determined by the rating of the shop?

Well i''m not gonna post till i see good or bad replys...bye

### #12Thp  Members

Posted 12 July 2000 - 12:50 PM

I love the idea (expressed earlier) of NPCs being scheduled, and if anyone cares to hear my opinion, I have another interesting idea regarding messaging between NPCs. I''d say one would just want to represent speech as a universal communication that is recieved by all nearby NPCs and the player: An NPC who wanted to buy bread or whatever, would walk into a bread shop, and approach the counter and say, "I''d like to buy some raisin bread." Which would be broadcast to nearby players and NPCs.

The baker would respond via speech, such as, "That''ll be 4 gil," or "Sorry, I sold the last raisin bread a little while ago," or whatever, and the hungry NPC would get the idea and give money to him, upon which the baker would give him the bread. With messages and transactions being broadcast that way, NPCs could react to things happening around them. If another NPC is just outside and the door is open, she may hear the man buying bread and think, "Hmm, now that you mention it, I could really go for a loaf of bread right about now." Essentially my thought is that we need to make NPCs react more *visibly* to one another than just passing silent messages and objects from one NPC to another with little more than perhaps a "hungryman buys a loaf of bread."

Think of it this way: you don''t just walk into a bakery, hand some money to the guy behind the counter, and take a loaf of bread. (at least, I don''t.) More often, you walk in and if there''s not many people there, he says, "Hi, how can I help you?" Or if the room is packed, he might not even notice until you come to the end of the line. It''s always a dialogue rather than a plain old exchange, and if you tell the baker "gee, my dog died and I''m really depressed," someone else may overhear you and comment on it or be affected by it.

I doubt this makes any sense really, because I''m not sure what I''m saying myself, but owell. O;.

+------------------------------------------------
| Thp :: Threep2742@worldnet.att.net
| "Nature uses only the longest threads to
| weave her patterns, so each small piece
| of her fabric reveals the organization of
| the entire tapestry." -- Richard P. Feynman

### #13CodyVa  Members

Posted 12 July 2000 - 08:00 PM

I don''t think i want to play a bakery sim.

### #14Ingenu  Members

Posted 12 July 2000 - 09:15 PM

If anyone wants to subscribe to the mailing list then NPCAI-subscribe@egroups.com is the address to send to. The main page for the group is http://www.egroups.com/group/NPCAI/ and to post you send to NPCAI@egroups.com.

second : gosh ! I forgot the children...
That''s not really a problem but this make me think we''ll need to have modular/configurable NPCs.

I think the idea of writing dialogs on screen are optionnal, so the system will propose some kind of dialogs but it''ll be up to the programmer to choose if he wants the dialogs to be visible on screen.

About the idea of the house containing food...
Good idea.
I''ll note that somewhere

Rating the shop and keeping everyone status to each other is something interesting.
And yes something like that is included in the porject.
see : http://www.multimania.com/ingenu/IAModule.txt this text file for more informations on what is or isn''t included

NPC have 5 senses like us real humans.
So they are able to hear any message send near them.
Maybe this message can change his task...
I''ll talk about that in the mailing list.

Please remember the NPC are for a RPG, not a sim''s like game

-* So many things to do, so little time to spend. *-

### #15dwarfsoft  Members

Posted 12 July 2000 - 10:27 PM

You could have NPC''s in sims... That would be memory innefficient, take ages to update etc. You may, however, put AI on the other player (ie, NPC) so that a computer could play. But I think that is way out of our grasp for a while

-Chris Bennett ("Insanity" of Dwarfsoft)

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

### #16shamen  Members

Posted 14 July 2000 - 04:20 AM

My thoughts on basic AI for an RPG are as follows:

Firstly shouldnt everything by based upon Stimuli and associated Responses? Stimuli can be external (man sees a bear), or internal (man becomes hungry).
Each response (corresponding to a stimulus based upon choices) is then broken up into goals. Hunger could be broken up into 3 high level goals. Find Food. Prepare Food. Eat Food.
Find food could then be broken down into sub-goals and so on. Goals would have relationships assigned to them (could be simple AND/OR/XOR operations).
Using this method, goals can be reused for different stimuli.
Plus new associations between Stimuli and responses can be made (based on viewing stimuli and responses from other entities) which creates learning.
And this all lends itself nicely to OOP.

Just a thought.

### #17Ingenu  Members

Posted 14 July 2000 - 10:31 AM

That''s the knid of system we are talking about and trying to programm

-* So many things to do, so little time to spend. *-

### #18Nazrix  Members

Posted 15 July 2000 - 06:58 AM

yeah, I like that...

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

"The road of excess also just ends making me tired because I'm too lazy" --Nazrix

### #19Ingenu  Members

Posted 15 July 2000 - 11:26 PM

If you don''t already joined us, I hope you will :o)

-* So many things to do, so little time to spend. *-

### #20Nazrix  Members

Posted 16 July 2000 - 08:53 AM

Yes, I have

I haven''t had enough time to read all of them though. I should do that.

One idea I had last night for a more non-linear game:

What if we had a need-based system combined w/ a schedule, and the non-linear plots would only happen when NPCs actually come near each other in the world.

So, say one NPC is scripted to murder another NPC at some point of the game. And, the player is then told to avenge the death of the murdered NPC.

....(lame, but simple)....

Instead of this happening at a set point in the plot, it could only happen when the 1st NPC comes in contact w/ the 2nd NPC. And, since we''re using a need-based w/ a schedule, the NPCs would meet at different times each time you play because they''d probably have different needs each time you play. So, they''d find each other at different times.

This could also work with the NPCs exchanging information like dwarfsoft was speaking of. If the 2nd NPC is scripted to tell a confidential secret to another NPC, (and that''s why he gets killed) then he won''t get killed until he finds the NPC to tell the secret. And THAT would happen at different times in the game too. So, it may be a bit chaotic, but it would seem like the NPCs were more alive.

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

"The road of excess also just ends making me tired because I'm too lazy" --Nazrix

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.