• 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.

41 replies to this topic

### #21dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 04 July 2000 - 10:16 PM

quote:
Original post by Ingenu

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

Personally I would go with a TODO list which points out the bare minimum that should be done by the NPC (therefore eliminating any slackers! [like me ]) and then I would put a schdule layer over it. That way the tasks are updated, but there is always a skeleton to fall back on. The TODO would also allow optimisations for NPC''s that aren''t likely to be seen much, they don''t require a high priority Schedule layer.

This is a fairly basic look at a complicated system, but I think the systems that you pointed out are all good, but for different reasons and different purposes.

Maybe we should work on creating a system that will work generically so that it can be of benefit to others. I believe we have the brains here in this forum so benefiting ourselves as well as others might be a way to go.

PS. It was my birthday on Mon, I am now legal! No more waiting for that booze or those clubs

-Chris Bennett ("Insanity" of Dwarfsoft)

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

### #22Ingenu  Members   -  Reputation: 1409

Like
Likes
Like

Posted 04 July 2000 - 10:33 PM

Messaging system is a requirement.

I think that the Schedule will be the basic behaviour guidelines and the need system will slightly modify the NPC activities.

NPC can be differentiated through modifying their ''reaction'' or needs level.
This may allow a NPC to finich is job before going to lunch, or to be often thirsty

I think that a ''module'' using the schedule/needs system will result in a very good dynamic fake world.

As I already said, I would like to work on that in C++.
This module would be available to anyone contributing to it, and maybe released under GNU licence

dwarfsoft : happy birthday ! (ok late but better late than never)

I''ll write a list of basic needs.

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

### #23dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 04 July 2000 - 10:45 PM

Thanx for the thanx there Ingenu.

I personally prefer C++ and am using VC++ at the moment (however I much prefered Borland.. Bloody M$is taking over even the most sacred areas ). But I would be very willing to contribute time and code to this module. I can''t possibly stay away from classes at the moment, they just keep becoming more and more useful . I think that a quite complex model could be achieved using a layering system similar to the protocols for Inet and the DirectX/GDI/Hardware layers that Win uses (or OpenGL/Software Emulation/Hardware for those who like to be compatable ). A simple model could indeed be achieved through the methods that you describe and I also agree that some quite respectable realism would result. Goddamn! It is getting late and sleep is affecting my thought, I have forgotten what I was going to say... I''ll post again if I remember . I have been recruiting other NPC activists from around the internet forums, including Gamasutra, Xgames3d and tdc (as soon as I can bloody well log onto the site!). They all have a link to this forum, so we may be getting some visitors here (hopefully because I like hearing the ideas that come through here!) Cheers all! -Chris Bennett ("Insanity" of Dwarfsoft) Check our site: http://www.crosswinds.net/~dwarfsoft/ and our eGroup: http://www.egroups.com/group/dwarfsoft ### #24Ingenu Members - Reputation: 1409 Like Likes Like Posted 04 July 2000 - 11:07 PM Here''s alink to a doc about the AIModule. I don''t have included basic needs now, but would do in two or three hours I use C++ and I love class. (In fact I love JAVA ) Layers might be interesting, don''t know how to implement this. -* So many things to do, so few time to spend *- ### #25dwarfsoft Members - Reputation: 1228 Like Likes Like Posted 04 July 2000 - 11:14 PM Layer system would hold many benefits (ie. you could switch them on or off to optimise certain NPC''s for certain tasks) but it would need to be thoroughly designed to be as efficient as possible (M$ Internet protocol layers were so screwed, that after an overhaul they yeilded 50% faster results ).

I am not truly sure as to how a layering system would work or how to properly implement one, but (based on multiple inheritance) you should be able to create sub-layers with one super-layer that handles them all. Use initialisations with pointers and descriptors of what that layer is, and the layer talks to the super-layer, which distributes appropriate instructions to either the other layers or to the NPC (because I am tired, I haven''t though much on this ).

I realise that this is a very high level and theoretical view of the idea, but it could yeild some benefits

-Chris Bennett ("Insanity" of Dwarfsoft)

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

### #26sprawl  Members   -  Reputation: 122

Like
Likes
Like

Posted 05 July 2000 - 03:55 AM

I''ve been building a little system that i call woh (weird objects handler)

This system lets objects intercommunicate with eachother.
there is .dll''s that are package so files
so inside every .dll there is objects.

I''m planning to implement network routines into woh so that objects can communicate and send messages over the network (great for scaleable server system).

I have designed the system so it''s easy to derive the base system down into subclasses so they match your individually needs.

This system will be the heart in my mmorpg.

//Andreas

### #27Nazrix  Members   -  Reputation: 307

Like
Likes
Like

Posted 05 July 2000 - 05:31 AM

Ingenu,
I think that there should be a basic schedule that is carried out for each week as you said combined with a need system.

Also, I think there should be a system that controls the direction of the NPCs according certain quests or stories. Like, if the NPC was supposed to meet the player at a certain spot at a certain time according to some sort of quest or story, that schedule would take care of that.

I think the need-based schedule should be the highest priority, then the story-based then the basic schedule would be the lowest priority.

Although, it's possible that the NPC could be thirsty while on the way to following the basic or story-based schedules, and perhaps be late for either of these shedules.

Perhaps, that would even make things more realistic? If the NPC is late for meeting the player somewhere it may be more realistic. It may also just be annoying.

As far as classes in programming go, I haven't really used them much. I haven't made the trasition quite yet.

I understand them, but just never use them. I know that I need to begin using them though.

Happy Birthday, dwarfsoft.
What's the age in Austrailia for drinking?

It's probably 18 in France, Ingenu, isn't it?

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

Edited by - Nazrix on July 5, 2000 12:35:19 PM

### #28Ingenu  Members   -  Reputation: 1409

Like
Likes
Like

Posted 05 July 2000 - 07:50 AM

dwarfsoft:
I understand the layer programming idea.
Interesting.

Nazrix:
I see that we perfectly agree about all that ''module''
We could implement a trick for a special kind of NPC having to be somewhere after some event.
But thinking that he can be late because he went out of food stock is somthing I found pretty cool

You''ll see OO porgramming isn''t hard.
(In fact I''d no difficulty going this way)

Have you checked the link ?
I have not had the time to write the basic needs, but I''ll do that soon.

Drinking in france: 18 you''re right.
In fact you can drink at 16 if you''re with a 18+ years old people who will take care of you.

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

### #29Ingenu  Members   -  Reputation: 1409

Like
Likes
Like

Posted 05 July 2000 - 08:00 AM

Systemia : I did notice your post before but I was thinking og various other stuff.
Yes I know what you're talking about, I've studied socio psuchology, psychology, economics and computer science (and various other things)

I think a basic system taking psychosociology into account can be written.

(edited two times, I think I'm more tired that what I feel)

Edited by - Ingenu on July 5, 2000 3:04:07 PM

### #30Nazrix  Members   -  Reputation: 307

Like
Likes
Like

Posted 05 July 2000 - 09:27 AM

Ingenu,

Yeah, I think having the possibility of the NPC being late is a good thing too...more interesting.

I checked the link. Those are all really good ideas.

That''s cool that the drinking age is so low. Europe is so much better about that sort of thing

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

### #31Ingenu  Members   -  Reputation: 1409

Like
Likes
Like

Posted 05 July 2000 - 09:50 PM

Basic needs:
Food
Drink
WC ;o)
*-----*

Depending on his job, the NPC will have an activity to follow to do reach the goal fill the need.
Hunter : Food : Go hunting.
Anyother : Get Money.
How to get Money : Use the money you own, then work to have money.

Somehting like that.
I think I''ll need help since my boss is realising I don''t work

The system need to be easy to model, so ot must be possible to simplify that, or to make the infos easily accessible.

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

### #32dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 07 July 2000 - 03:03 AM

Im BACK! After Much Diablo IIing

Well, I am back, after playing Diablo II constantly for the past 12 hours (what a game.. so inspirational). The reason? It got released in Australia yesterday, and I had some sleep (this morning sometime) . So 12 hours it is (today anyway).

Anywho... I was considering NPC''s, AI and AI in general (as I tend to do ) and I was noticing my technique for killing the Death Bug things. Every time you hit one of them, they shoot lightning out at you. What I was doing was sprinting along ahead of them, so I could take one at a time (because the others would stop) and I would wait until there was only one left chasing. Then I would stop him at the well, attack him (with very fast attack... cained right into him ) and then immediately start pressing on the well. This would get them down below half way, with the well only half used and me on full helth and full mana .

Anyway, getting to the point. Why the hell did the other monsters stop? To make it easier? Probably. But do we want hoards of stupid beasts that come like lambs to the slaughter? Or do we want finite/minute numbers of super-intelligent minions? That way we may need to think about how we are playing and what we are doing.

Before people start going crazy, all I am suggesting here is that if a beastie see''s you, then it makes an attack call. Any beastie in the vicinity hears it and follows it''s lead. Not too difficult and it would make the game a whole new experience for conservative fighters like me . (Although I have been charging into hoards of anything, just for the challenge -> and the screenshots ).

Back on topic now... I would just like to say that although the NPC''s in Diablo II actually all move around (kinda), they are still as stupid as ever. What''s more (I hope someone else noticed this) Warriv still talks about "going back west" once you go back west (from The Act II city.. name escapes me, I am lacking a lot of sleep). This was obviously a design fault (or a bug on my machine ) but I hope it gets fixed up .

Programming Side

The .dll idea sounds promising also, I have not had a chance to come near .dll''s yet (mostly because I am a nostalgic old DOS programmer ) but I have used the DirectX wrappers and OpenGL wrappers. I am still trying to figure the layering thing out. Too much gameplay and not enough sleep has left my senses all screwed .

To Schedule or not to schedule

Personally, I would prefer NPC''s not to have a schedule, or to have a strict one. As if a ship would end up waiting 2 days for a rogue mercenary! The ship should be off within the hour that it is scheduled to be off in, unless there are other delays. There is no way in hell that a ship will be waiting specifically to take a character (or a [small] party) to the other side of the continent (a little bitchy here at MM7 ).

A general schedule might be a good idea, but remember that there are certain times that a schedule may be bent (or broken) and when a schedule should be abided by.

Social Side

Legal age in Australia is 18, so that would mean that I am just 18 . But 18 with a lot of good ideas (or at least I would like to think so) as well as some good knowledge in my programming language of choice (another one I would also like to think so ).

Well, I think that was a post and a half (or maybe 2 and a half ).

May you code for many hours without a bug.

-Chris Bennett ("Insanity" of Dwarfsoft)

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

### #33dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 07 July 2000 - 03:44 AM

Followup,

Ingenu: I checked that link, seems cool, my mind isn''t with me enough to make any sense of it thought. I am writing up a general "prospectus" for NPC design which basically falls into three parts:
1. What the hell is wrong with what we got?
2. What the hell we should do about it?
3. How the hell do we go about doing it?

As you can see.. I was liking the word ''hell'' at the time . Probably due to the fact that it was 4:00am

Nazrix: I agree that OO is the way to go, classes can be so useful for so many things in the Games industry that it just isn''t funny. Most game programmers stay away from them though because of a believed "lack of performance" (going back to that M$protocol thing ) but given proper design, they can be just as fast and more useful . Sprawl: That is the exact kind of thing I was trying to think of when I was attempting to explain layering (sort of). But Objects that communicate with each other through generic function calls (ie Inheritance) to provide functionality. Yes! Just as a button communicates with the input (mouse, keyboard) and the form that it is placed on, so should an NPC object communicate with other NPC objects and the Game [that it is placed on] as well as the input (player, other NPC''s, environment/Game). I am going to have to take some time off game playing (or "research" as I like to term it ) to write up full documentation on such Hehe.. now I have windows on as many different AI discussions as I can possibly find (including our 2 pages). For Altman (a long time ago): OK, describing what I mean by Windows messaging is, a central procedure (for Pacal programmers, function to all us C/C++ Boyz ) that handles all messages and communications. Absolutely EVERYTHING goes though it. It decides what to do about the message that it recieved, does a bit of logic, fixes up co-ordinates/schedule/position/screen/stats/whatever, then it returns and windows handles the rest. For Games (which is why we are here right?) basically have a global function (gee.. I must be one of those C/C++ Boyz I mentioned earlier ) that can be accessed by all. This basically interprets what kind of AI needs to be done, what kind of NPC is it (Race or how many fingers or whatever ) and calls the appropriate functions in the NPC module. Properly designed and a race or character class should make no difference to this function, but would to the class itself. All the message handler needs to do is decide who sent the message (which NPC/which module) and who is supposed to recieve it (again NPC/module). I hope that straightened everything up (and I hope I am right in what I said, afterall, I haven''t slept in almost 40 hours ). Cheers all, hope you have a good night, coz I think I am going to actually sleep (for a loooooong time ) -Chris Bennett ("Insanity" of Dwarfsoft) Check our site: http://www.crosswinds.net/~dwarfsoft/ and our eGroup: http://www.egroups.com/group/dwarfsoft ### #34Ingenu Members - Reputation: 1409 Like Likes Like Posted 07 July 2000 - 04:20 AM I'll try to clear up the things a bit this Week end. No too much since my little brother is coming visiting me I'll try to share some ideas with him, and write a little paper on what to do, how to do it. Of course this will only be a list of suggestions. We'll have to discuss this and setup everything appropriately to what we wanted. NO DLL. I'm against M$ OS.
I'm won't do anything windows specific.

(gosh it takes me about 30 seconds before I found the new topic button!)

I'm creating a new topic : " RPG NPC AI, Scheduling and Needs..."

Edited by - Ingenu on July 7, 2000 11:24:08 AM

### #35Altmann  Members   -  Reputation: 122

Like
Likes
Like

Posted 07 July 2000 - 11:28 PM

Ok, I''m back after network problems.

1. Thanks for the explanations about Windows-style messages
2. No DLLs if possible. This would mean restraining everything to Windows (and DOS-protected) and I am a Un*x-based guy, plus I would hate to be cut from Mac OS X.
3. By "using inheritance" for messages, I suppose you mean "everything is a virtual method", don''t you ?
4. Long lives OOP
5. I guess there is enough space to put deduction/planification modules somewhere, after the message-passing interface has been designed

David

### #36dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 08 July 2000 - 04:29 PM

Personally I hate M$to the bone, but that wouldn''t explain why I have VC++ 6 now would it? . I actually prefered DOS, why did it have to die? Anyway... 1. My explanation wasn''t thorough, but I think that it gave kind of a theoretical look at what they are and how you use ''em. If you wanted a proper explanation then I suggest buying a Win Programming book (I got one for$12 ).
2. DLL''s are out, we don''t need em, but I still think that it is a nice implementation.
3. When I am thinking inheritance, I am thinking that there should be a top order inheritance which basically every method can call. I have limited experience with virtual methods, but I think that is what I was getting at .
4. OOP 4 eva! OOP is so elegant, provided that you do it right. Has anyone here used Eiffel?
5. Why not create a multitude of layers, then stick ''em in a LIB somewhere so that people can use them in their projects . The basic way that I am thinking of this layering is that you can switch them on or off, could make for some interesting NPC''s .

The message passing routine COULD be used for all of the different layers of AI, but why would we do that? We have room to move here, so we should create the different AI layering so that people who only want a certain type of AI can use that and not some superior AI that somebody else might want.

It appears that this forum is getting popular, I have been recieving a lot of emails about it . Keep up the good work peoplz!

-Chris Bennett ("Insanity" of Dwarfsoft)

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

### #37Altmann  Members   -  Reputation: 122

Like
Likes
Like

Posted 09 July 2000 - 02:14 AM

• Haven''t tried Eiffel yet. But I''ve heard enough good things about it to give it a try. All the more since it is garbage collected. Has anybody objections to Eiffel ? (Another OO gc-ed clean possibility would be Objective Caml, but I''m affraid it is not popular enough, and maybe a bit too functional for C++ die-hards)

• Layers : absolutely. In my opinion, the message-passing interface would be the second lowest level, just above some time-sharing facility (threads). Higher levels would be :

• path-planning
• reacting
• scheduling
• planning
• deducing
• whatever else

• e-mails : would you organize us a mailing list ? Sorengo.com gives them away for free.

David

### #38Ingenu  Members   -  Reputation: 1409

Like
Likes
Like

Posted 09 July 2000 - 06:45 AM

Altamann :

It''s pretty easy to figure out and to understanf.

The Mailing list idea is good to me, someone else agree about it ?

(not very long post since my brother just left and I have plenty of things to do, sorry)

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

### #39dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 09 July 2000 - 11:19 PM

First of all, I have to say that Eiffel is a good teaching language, but as a C++ Die-hard, I find that it is too constricting for my liking. You really do have far too many rules . But like I said, it is good for teaching people how to OOP.

Newsgroup can be done easily... I will set one up at eGroups.com (formerly OneList), and I will post the subscription address here .

-Chris Bennett ("Insanity" of Dwarfsoft)

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

### #40dwarfsoft  Members   -  Reputation: 1228

Like
Likes
Like

Posted 09 July 2000 - 11:30 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.

Out of general interest, the other group that I moderate is http://www.egroups.com/group/dwarfsoft/

Hope thats what people were looking for

-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