Advertisement

NPC AI in RPGs (2)

Started by July 01, 2000 02:42 PM
40 comments, last by Nazrix 24 years, 4 months ago
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. *-
-* So many things to do, so little time to spend. *-
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
Advertisement
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
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
-* So many things to do, so little time to spend. *-
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


Be reading you,
David
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
Advertisement

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


Be reading you,
David
Altamann :

I like your layers system.
It''s pretty easy to figure out and to understanf.
I''ll think about it.

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. *-
-* So many things to do, so little time to spend. *-
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
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

This topic is closed to new replies.

Advertisement