Intelligent NPC design (Bear?)

4 views
Skip to first unread message

Felix Lee

unread,
Oct 13, 1994, 5:07:19 PM10/13/94
to
a full-fledged bear may be a little much to tackle. How about limit
it to just sight/scent modelling and food-gathering behavior? Hmm,
you probably need some simple danger/difficulty assessment in order to
produce interesting cost/benefit analysis. (I think I just exceeded
my quota of slash/ified terms in this paragraph. :)

anytime I think about sight or scent I start wandering off into
spatial models other than the traditional rooms-with-exits.

simple sight problem: in Enhanced, there's a straight hallway split
into three locations. Bob the guard occasionally wanders in the hall,
but you don't see him unless you're actually in the same "location".

Fixing this is doable, but awkward, and I start wishing for a spatial
model that's more physically based, like nethack or Doom, instead of
the conceptually-based spatial model of text adventures.

Perhaps this is an argument against following this particular line of
development.

So, say the bear only interacts with objects in the current location.
Smell and sound might leak to adjacent locations, but that's it.
Moving around is based mostly on knowledge and memory rather than
perception.

Objects in the bear's world include
things known to be food
things known to be non-food
things whose food-status is unknown
obstacles to food, like containers

Maybe include animate food? Well, this introduces a whole slew of
other problems. Maybe it would be easier to start by building a
herbivore like a rabbit or a horse, instead of a bear.

anyone interested in this type of development should probably look at
what's going on in simulating artificial life. _Artificial Life_ /
Steven Levy, 1992. Plus random conferences and journals on the topic.

well, that's my ramble for today.
--

The Grim Reaper

unread,
Oct 14, 1994, 12:31:52 AM10/14/94
to
Okay, so this seems to be a good list of starting stuff. We'll have to
figure out a list of priorities for the bear next, I guess. The easiest way
to do this is to rate the bear on how hungry/thirsty/tired it is, and increment
or decrement those ratings depending on the bear's actions, plus a slow change
over time. These will be used to determine what the bear is doing, or trying
to do. To start out with rough estimates, let's say the bear's hunger is
rated from 0 to 10. 0 is not hungry at all, 10 is starving (dangerous for
the player! :P). If the bear's hunger is 3 or more, it will eat food if it
comes across it, but not actually look for it. If the bear's hunger is 6
or more, it will start looking for food, going around to places/people it
knows have food. If the bear's hunger is 9 or more, it will start doing
serious searching for food, scanning each room before moving on, harassing
people (if it knows people = food sources), etc. Also, food is going to need
to be rated on a desirability scale, let's say from 0 to 10. To make things
simple, let's say the bear handles desirability as follows: If it comes across
any food, or smells food, with a desirability of 5+, it will make an effort to
get the food, and will be need to be rebuffed if the player has the food. If
the food has desirability of 8+, the bear will make a serious effort to get
the food, even if unsuccessful at the first try to get it. Otherwise, the bear
will choose which food to eat based on desirability of the food. Food needs
actually to have two desirability rankings, a "taste value" and an "ease of
aquirement value". Fresh fish is very nice, but if the bear has to stand in
a cold stream for several hours to get it, it might just choose to eat these
nearby berries instead. So okay, that's the actual decision to eat. Now,
the food finding part. Really, the bear should know these woods, after all,
it probably lives around here. But I'll assume it doesn't, for whatever
reason, just to make things more interesting. It would be trivial to make
the bear start out with a list of known food spots, of course. The bear
arrives in a room, looking for food. It examines the room, and classes
obvious things as food, not-food, or unknown. Probably it would be easiest
just to have two arrays that objects get added to (let's assume the bear has
perfect memory... it would be a serious pain otherwise. Let's also assume the
bear can always distinguish between objects... it would be fairly difficult
to program in the fact that the bear should think all pink pots have honey in
them if it finds one that does). So the bear classes all the objects in the
room. It probably adds them to its "i know what this is" array as well.
If an object is interesting, it might take a closer look at it, even if
it doesn't smell like food (easiest just to handle being interesting with a
flag, I guess). Now, what about a fish on the ground, with a pot over it?
Well, the bear should probably investigate the pot, since it's out of place
here (ugh... that's a pain to code in), and most likely smells like fish. So
the bear should be able to smell (not worrying about smells passing between
rooms for the moment...) and objects pass the fact that they're smelly outwards
to the room they're in, unless they're in a sealed package (a ziploc bag or
something :P). If the bear isn't hungry enough to eat the food, it adds
the food to its "food is here" list, along with a note where to find the
food (which room, I guess... or a person who has food). It seems reasonable
that if a bear sees you eating fish, and later gets hungry, it would go to
you to see if you have any more fish. Right? Well... that's an awful lot
right there, and that's just for food stuff. The "food is here" list is going
to be important. It's used when the bear gets hungry, but there's no food in
sight. It should store two types of food spots... places where it knows it
can find lots of food (rivers, berry bushes), or specific food items and where
they were last seen. Let's assume that if hunger is 6+, the bear figures out
which is the most desirable food source on the "food is here" list plus the
contents of the current room. Desirability in this case will depend on
actual taste, ease of aquirement (honey, but in a bees nest), and probably
distance to travel, too. So it weighs all those factors somehow, and decides
on the most desirable food source. Then it starts to go there. This will
mean adding "figuring out how to get there" code as well, if we assume the
bear only knows the rooms it's been in, which means it won't take the fastest
route unless it's been on it before? Another painful bit of coding, I suppose.
Anyway, so the bear travels to where the food source is. Each time it passes
through a room, it should update its list of things it knows, and food sources
it's located. If it updates the list of "food", then it should probably
recalculate the most desirable food source. ie, if it's walking along and
comes across a river, perhaps it will decide it would rather have fish than
walk to the campsite across the forest. Finally, getting the food. It's
found the food, it knows what it wants to get, now how to get it. I guess
this depends on the food, and how hungry the bear is. It probably will
know how to get most basic forest foods, ie climbing trees or shaking them,
knowing how to fish for salmon, etc. If the food is carried by a person,
or behind an obstruction, the bear will have to figure out how to get the
food. We'll need some painful code for that too, I guess. If the person
rebuffs the bear, or it can't seem to get past the obstacle, it will probably
recalculate desirability, with a minus to this one's desirability. This may
tip the scales if there's another almost as good food nearby, or the bear
may decide to persevere. In the case of the person, the bear will probably
get more threatening if resisted. The obstacle, however, will just have
to be figured out (how to do this realistically? no idea).
Okay, so that's food, in a nutshell. Anyone have something to add to this?

+----------------------------------------------------------+
| One .sig to rule them all, one .sig to find them... |
| One .sig to bring them all and in the darkness bind them |
+----------------------------------------------------------+
| The Grim Reaper (Reaper of Souls, Stealer of .sigs) |
| scy...@u.washington.edu |
+----------------------------------------------------------+


Gerry Kevin Wilson

unread,
Oct 13, 1994, 2:22:39 PM10/13/94
to
In article <37jpjf$k...@nntp1.u.washington.edu>,
The Grim Reaper <scy...@u.washington.edu> wrote:
>Reading various messages on the simulation thread, I saw somebody's suggestion
>that someone create a really realistic animal... I think they said a brown
>bear. Well, how about if we do that as a group? If possible, keeping the
>discussion to generic ideas, not language-specific ones. Just to get started,

Yay, glad someone is taking up the idea. Since it was my suggestion, I'd
be glad to toss in my thoughts.

>let's say we're going to create the aforementioned bear. Well, the bear will
>wander around the game, trying to fulfill a couple personal goals. What
>should they be? I expect for a bear, eating and sleeping are going to be
>its main priorities. This means we'll have to keep track of how tired
>and how hungry the bear is. Perhaps its reaction to the player as well.

A fairly sensible set of goals. A bear basically has a few behavioral
patterns that I know of. (Recapping your thoughts and expanding them)

- Eat when hungry (berries, fish, honey, small, careless animals, garbage
can raiding, tearing open cars to get at food inside.

- A bear will smell food unless it is in a truly sealed container, like
potato chips in an unopened bag. A cooler is not a sealed container.

- A bear sleeps during the day, I guess. I'm not too sure whether they
are nocturnal or not. Any bears out there care to answer that one?

-Bears will sleep in a cave, if they know of one. They have also been
known to sleep in a 'nest' hollowed out of the ground in a
shaded/bushy/secluded area. (Again, I'm going off layman knowledge here,
someone correct me if I'm wrong.)

-A bear will make claw marks on trees in its territory to warn other
bears away.

-A bear fed by hand is likely to eat the hand that feeds it, unless
trained otherwise.

-A bear fed in one location will remember that location/person as a
source of food. This is the reason for the 'Do not feed the bears' rule
at parks. Bears return to the camping grounds looking for more food, and
their contact with idiot tourists often winds up with a mauled tourist.

-A bear is frightened, rather than annoyed, by loud noises.

-A frightened bear will retreat to a safe spot, his cave, or possibly up
a tree.

-A frightened bear will lash out at anything that approaches it.

-A bear will chase you if you run from it, thinking you a small, careless
animal.

-A bear that has treed a small, careless animal, will shake the tree to
try and dislodge 'lunch'.

-A bear will go after the first food source that presents itself,
ignoring others until finished with the first.

-A bear eating may see an approaching animal as a competitor for the food
source, and attack.

-An attacking bear will stand on its hind legs, to intimidate the
opponent, then charge on all fours. (Again, mere layman knowledge. I'm
no behavioral scientist.)

-A frightened bear will eventually stop being frightened, if the source
of that fear goes away.

-An angry bear will calm down if left alone, but will be quicker to anger
in the near future.

[deletia]

Well, even if that's not an entirely accurate or complete (nowhere near
complete) summary of bear behavior (keeping in mind there are different
kinds of bears with different behaviors and personalities.) it'll do for
now, until we 'program' some of it. Any other suggestions, coding
attempts (in pseudo code)?

--
<~~TREV ERA~~~~~~~~~~~~~SIGHT~UNSEEN~~~~~~~~NO~RELEASE~DATE~YET~~~~~~|~~~~~~~>
< I W In the jungle of the big city, a predator stalks one | ~~\ >
< GO SOFT he considers easy prey, a blind student. Feel the fear | /~\ | >
<_______________________...@uclink.berkeley.edu__|_\__/__>

The Grim Reaper

unread,
Oct 13, 1994, 1:09:03 PM10/13/94
to
Reading various messages on the simulation thread, I saw somebody's suggestion
that someone create a really realistic animal... I think they said a brown
bear. Well, how about if we do that as a group? If possible, keeping the
discussion to generic ideas, not language-specific ones. Just to get started,
let's say we're going to create the aforementioned bear. Well, the bear will
wander around the game, trying to fulfill a couple personal goals. What
should they be? I expect for a bear, eating and sleeping are going to be
its main priorities. This means we'll have to keep track of how tired
and how hungry the bear is. Perhaps its reaction to the player as well.
If the player feeds the bear, perhaps the bear will be friendlier to the
player. This could be mean following the player around, begging for food,
maybe even asking to get its tummy rubbed? :P Conversely, if the player
hits the bear, or takes food away, the bear will get more annoyed with the
player. This could be attacking the player, or just growling, or whatever
bears do. Now, making the hunger and sleep routines more realistic: Well,
let's assume the bear can smell the air to determine if there's food around,
unless the food is in a sealed container. Also, the bear will remember where
food was, and assume it's still there unless it gets moved. We'll want to
have different desirability levels for food as well. Honey will get rated
highest =), followed by fish and berries and stuff. If it has different food
sources available, or thinks it does, it will go for the more desirable ones
first. Sleeping will be simpler. When the bear gets tired, it will head for
a safe place to sleep, and sleep there. It will get annoyed if woken, or
loud noises are played in the area. It will stop sleeping in an area if
continually disturbed there. It may have some sensible food searching
routines as well (ie, look for bees nests, look for rivers to fish in, etc).
Okay... what am I forgetting? (Apologies for the rather stream-of-
conciousness writing....)

William S. Reilly

unread,
Oct 13, 1994, 6:38:37 PM10/13/94
to
I think this bear idea is excellent. That's partly because it's
similar to a demo the Oz project built a while back that we found very
useful and enlightening. We built a simple apartment world with a cat
as the only character. This allowed us to show off our agent
architecture in a reasonably complex character without having to
deal with the headache of language.

We started, similar to what you have done, by outlining the important
behaviors and emotional responses we wanted the cat (Lyotard) to display.

If you want to find out more about this project for ideas in building
a bear, you can check out a few of our papers on the subject via our
WWW site:

http://www.cs.cmu.edu:8001/afs/cs.cmu.edu/project/oz/web/papers.html

The two most relevant are probably:
"Integrating Reactivity, Goals, and Emotion in a Broad Agent"
and
"An Architecture for Action, Emotion, and Social Behavior"

In both, the emphasis is in our particular agent architecture, but
they also each talk about Lyotard and the process we went through
in building him.

Also, you can get a trace of Lyotard at:

http://www.cs.cmu.edu:8001/afs/cs.cmu.edu/project/oz/web/lyotard2.html

Hope this is of some use.

Scott

matteo vaccari

unread,
Oct 18, 1994, 12:37:33 PM10/18/94
to
si...@rheged.dircon.co.uk (Simon Brooke) writes:

: OK, chaps, here is Artoris. He's a bit quickly hacked together, but he
: works, and fulfills the spec. He works in the context of my own ADE,
: and so to understand the code you need to understand a bit about how
: that works. You'll see that it's LisP. If you have trouble with it, it
: started off in Cambridge LISP but is in the process of being ported to
: XLISP. Artoris works in the XLISP version, but uses a lot of Cambridge
: LISP idiom.

Cute. But, how can we run it? Can we ftp your system?

Perplexed,

Matteo

Message has been deleted
Message has been deleted

David Whitten

unread,
Oct 26, 1994, 11:07:01 PM10/26/94
to
Well now that A. the bear exists,

what do we need to consider to handle the 'smells for food' unless in
sealed containers?

What about the 'scratching trees to mark his territory?'

As I read A. the bear, he really doesn't have a home. (just the last
place he slept) is this necessary?

Spurring discussion
Dave (whi...@netcom.com)

Reply all
Reply to author
Forward
Message has been deleted
0 new messages