[MUD-Dev] NPC AI and Learning.

Michael Hohensee michael at sparta.mainstream.net
Mon Sep 8 13:18:39 CEST 1997


Travis S. Casey wrote:
> > At first, this creates increadably stupid NPCs.  They'll go around
> > hitting themselves in combat, attacking walls, trees, and large
> > monsters, and basicly losing at every turn.  But as time goes on, they
> > lose less and less, as the negative behaviors are wiped from the
> > possible choices.
> 
> Of course, nothing says that the NPCs have to start out as "blank
> slates."  If you know some rules that will help them, you can program
> those in.  Also, you can pre-train the NPCs -- let them interact with
> each other for a while.

Yeah, that would be cool.  Training grounds where real training takes
place! :)

> 
> > So we end up with fiendishly efficient NPCs, while retaining a random
> > element for variety. :)
> >
> > The only problem with this is the tremendous overhead it would generate
> > if implemented per creature.  Perhaps a better way would be to have one
> > unified "action bank" which all NPCs draw from.  That would be something
> > special.  If Bubba the goblin slayer goes out and stomps lots of goblins
> > to dust, they'll eventually become more resistant (as possible) to his
> > attacks.  If Bubba then tries to seek greener (and wimpier) pastures,
> > he'll find that the neighboring orc tribe has heard about the new goblin
> > tactics, and have an interesting time of it. :)
> 
> With a neural net, you could make the creature's class and level part of
> the inputs.  If you wanted to, you could also add other inputs --
> presence of friendly creatures, etc.

This occured to me about an hour after I posted. :)  Perhaps an NPC has
a percentage chance to "screw up" and do something completely random. 
(this doesn't mean that what the NPC does is necessarily bad, of course
;)

> 
> > This effectively makes killing creatures very difficult.  The only safe
> > way I can see to kill NPCs under this system would be to either grossly
> > outclass them, or kill them instantly, before they can react. :)
> >
> > Any comments on this?
> 
> Well... it's all very nice -- in theory.  In practice, it may not work out
> so well.  Part of the problem lies in the definition of success:  for
> example, what constitutes a successful attack?  A naive answer might be,
> "an attack which hits."  A better answer would be "an attack which does
> damage -- and the more the better."  A still better answer might be,
> "an attack in which the attacker does more damage than it takes."  Even
> better, measure the damage as a fraction of the damage each combatant
> can take:  if I'm doing 20 points a round and only taking 10, I'm
> still going to lose if I can only take 30 points and my opponent can take
> 100.

Hmm, perhaps we need a "fault" function, which determines whether the
failure could have possibly been avoided.  (ie, the dragon attacks you. 
You, being a small goblin, have the chance of a snowball in a blast
furnace, and your actions shouldn't affect later ones. )
 
> Secondly, success in the short term doesn't always equal success in the
> long term.  For example, a monster might always succeed in combat by
> our last definition above, but still lose.  How?  Any number of ways:
> the opponent might periodically retreat and heal up while the monster
> doesn't do so, for example.  Thus, a number of variables might be
> involved in determining "success," which makes the problem harder...
> and makes it more time-consuming, since we may have to wait a considerable
> time before we know whether a tactic was successful.

Hmm, how about giving each NPC one of a set of "mindsets" which list
what is considered good, and bad.  For example, a guard NPC will
consider someone taking or rescuing what he is guarding as a failure,
and soon stop letting things get taken.  The only problem with this is
that it will require multiple "action banks" or "neural nets" to deal
with multiple mindsets...

It may be difficult to achive humanlike intelligence in NPCs, but even a
primitive mind is a lot better than most NPCs.


Michael Hohensee       michael at sparta.mainstream.net
http://www.geocities.com/SiliconValley/Heights/9025/
      Finger me for my PGP Public Key, or use: 
http://sparta.mainstream.net/michael/pgpkey.txt



More information about the mud-dev-archive mailing list