Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Inform] Thinking about NPC Movement

9 views
Skip to first unread message

Joel Finkle

unread,
Jan 28, 2002, 4:31:19 PM1/28/02
to
I've been looking through the various library add-ons for NPC movement
(Follower, npc_engine, ORNPC_movement), and haven't come up with a
single class that will do everything I want my NPCs to do, so I'm
trying to come up with the specs for an NPC movement behavior model.
Here's my thoughts so far:

I see four 'modes':
Lead -- moves ahead of the PC (optionally announcing the direction,
optionally leaving doors opened, etc.), and waits for the player to
catch up.

Follow -- stalks the PC's tracks. Following at a distance is probably
too troublesome at this point (heh -- you could probably get it going
in circles if you were stalked, like Bugs Bunny and the dog chasing
him -- step out of the loop, and the dog keeps going around...)

Go/Wander -- Just walks where instructed (or randomly)

Escort (what I need and nobody seems to do so far) -- Refuses to let
PC move any direction but the path, and moves with the PC. May permit
other actions (bribery, negotiations, interactions with surroundings,
picking handcuffs...) between movements.

Then, I see certain conditions I could put on the movement: Can use
doors, can open locks, can use concealed doors, will respect privacy
(such as not following a woman into the laidies' room, or into private
areas of the castle... this probably needs a routine/entry point
rather than a flag).

I'm thinking about what other properties or entry points I'd need: A
"GotThereNowWhat" routine -- one response might be to turn around and
retrace steps. A ShallILinger routine -- how long does the thief
stick around before wandering off on his own, An AttractAttention
routine: can I call them from an adjacent room (further gets really
hard) by, say, making noise?

Perhaps some of these don't need to be separate 'standard' entry
points, but just routines that initiate some other movement. The
AttractAttention in particular is giving me some headaches, in terms
of scope, spawned actions, etc.

Just thought I'd bounce some ideas, and see if they stick...
Joel

Jim Fisher

unread,
Jan 28, 2002, 10:59:14 PM1/28/02
to
"Joel Finkle" <joelf...@hotmail.com> wrote in message
news:1a5c1b3c.02012...@posting.google.com...

> I've been looking through the various library add-ons for NPC movement
> (Follower, npc_engine, ORNPC_movement), and haven't come up with a

> single class that will do everything I want my NPCs to do.

"...everything I want my NPCs to do..." No that would be hard to find. I'll
share my thought on that in a moment. For now, I'll talk about the
movement...

I can't speak for the other modules you listed, but of the four modes you
described, the ORNPC_movement class either A) already does these things, or
B) provides the pieces to build these behaviors with minimal effort:

> Lead -- moves ahead of the PC (optionally announcing the direction,
> optionally leaving doors opened, etc.), and waits for the player to
> catch up.

This could be done by simply defining the "can_move" property as a routine
which returns true only when the player is in the same room as the NPC.

> Follow -- stalks the PC's tracks. Following at a distance is probably
> too troublesome at this point (heh -- you could probably get it going
> in circles if you were stalked, like Bugs Bunny and the dog chasing
> him -- step out of the loop, and the dog keeps going around...)

This is already done by the ORNPC_movement class. Likewise a "Follow NPC"
command has also been implemented for the player.

> Go/Wander -- Just walks where instructed (or randomly)

This is also handled by the ORNPC classes. By default, the NPC can wander
around randomly, but with the ORNPC_doverb class you can also boss an NPC
around with commands like "BOB, GO NORTH". Orders such as "BOB, GO TO HALL"
are not handled automatically, but I think that this could be accomplished
with a specialized path algorithm without a great deal of effort.

> Escort (what I need and nobody seems to do so far) -- Refuses to let
> PC move any direction but the path, and moves with the PC.

I do something like this in my latest WIP using the ORNPC_movement class.
It is essentially just an NPC set to follow the player, but with a
"react_before" routine that keeps the player from traveling in unwanted
directions.


An additional mode that you may not have considered is the "FOLLOW PATH"
mode, as would be followed by soldiers marching a path around the perimeter
of something they were guarding.

> ... can use concealed doors, will respect privacy

[snip other specialized stuff]

Now my thoughts on the "...everything I want my NPCs to do..." portion of
your post. There are numerous possibilities when developing NPCs, but many
of these seem to be specific to a given game. It is for this reason that I
broke my original NPC class up into component behaviors.

I have to confess, my original ORNPC class did everything I could think of,
but it was just too bloated. An NPC that walked, talked, learned, taught,
fought, kissed, became angry, fell in love, had mood swings, held grudges,
and interacted with other NPCs was just too big and complex a character to
be useful. This is why I took a more granular approach in my revision.

I need to mention that I'm answering this post primarily because you seem to
be more interested in investigating the options rather than using an
existing code base. ORNPC and its component classes are in their infancy
and have yet to be officially announced (I'm flattered that you looked over
them). They continue to acquire bug fixes at a regular interval, but they
*do* work. A review of the EXTREAMLY ROUGH first draft documentation may
help to shed some light into the full potential of their use.

The following two URLs point to the sections on NPCs, although most of the
example code also references modules discussed prior to this in the
documentation:

http://www.onyxring.com/variousarticles.asp?article=56

http://www.onyxring.com/variousarticles.asp?article=57

Actually, out of embarrassment, let's not call it "documentation" as such.
Perhaps we could refer to it as "a meandering of unclear and confusing words
thrown together in a way that some gifted adventure might possibly make
sense of it."

With a little work, I should have viewable in the next year or so.

--
J...@OnyxRing.com
Visit "An Inform Developer's Guide" or browse the
"ORLibrary" extensions to the standard library at
www.OnyxRing.com
----------------------
Some days you eat the code; some days the code eats you

Mr. J

unread,
Jan 29, 2002, 1:57:42 AM1/29/02
to
Hmmm inspires me to an idea.

I never liked the way NPC's would follow you nor the way you'd follow
them. Seems like someone heading somewhere should be easier to leave
behind and "catch up" with later.

What about an object in each room called "tracks"

If the NPC leaves to the west it sends a message to the object to
change it's description to "The tracks seem to lead... " and then
print the direction the NPC left in. If an NPC doubled back only the
latest direction would be left.. or maybe "a mess of tracks, you can't
tell which way they go".

Has anyone ever done this? I mean it's kinda hunt the wumpus and
all, but done right you could have "freshly trodden footsteps"...

ooo.. this might be fun.


Mr. J.

"Jim Fisher" <Jim(At)OnyxRing.com> wrote in message news:<u5c7gp...@corp.supernews.com>...

Adam Thornton

unread,
Jan 29, 2002, 9:40:24 AM1/29/02
to
In article <9b8bec18.02012...@posting.google.com>,

Mr. J <john...@earthlink.net> wrote:
>Has anyone ever done this? I mean it's kinda hunt the wumpus and
>all, but done right you could have "freshly trodden footsteps"...

Yeah. Graham Cluely, I think? In "<something> and the Golden Wombat of
Destiny" maybe? Late '80s, early '90s.

That was the maze; you couldn't drop stuff, I think, because it sank in
the mud, but you left tracks in each room.

Adam

Ben A L Jemmett

unread,
Jan 29, 2002, 1:39:11 PM1/29/02
to
"Adam Thornton" <ad...@fsf.net> wrote in message
news:a36c8o$3n7$1...@news.fsf.net...
> Graham Cluely, I think?

Whoa. That's a name I'd forgotten about; I remember playing _Jacaranda Jim_
and _Humbug_ on my old Amstrad... *thinks* Doesn't he work for Sophos now?
Time to go a-Googling, I guess...

--
Regards,
Ben A L Jemmett.
(http://web.ukonline.co.uk/ben.jemmett/, http://www.deltasoft.com/)


Joel Finkle

unread,
Jan 29, 2002, 9:57:06 PM1/29/02
to
"Jim Fisher" <Jim(At)OnyxRing.com> wrote in message news:<u5c7gp...@corp.supernews.com>...
>
> "...everything I want my NPCs to do..." No that would be hard to find. I'll
> share my thought on that in a moment. For now, I'll talk about the
> movement...
> I can't speak for the other modules you listed, but of the four modes you
> described, the ORNPC_movement class either A) already does these things, or
> B) provides the pieces to build these behaviors with minimal effort:

Jim,
Thanks for the additional detail. I by no means meant to slight your
work --
I was planning on starting from your ORNPC classes. I certainly wasn't
expecting a class that would handle *all* my NPC's behavior :^)

But the movement behavior I wanted didn't (on first glance) seem to be
covered by what I'd read. Your Knowledge classes are quite spiffy --
they've made me rethink a bit about how some of my conversations will
take place.

I'll have to take another look at your movement classes. Not having
the same level of description and docs as the Knowledge classes, I was
a little unsure of where I could go from there.

Initially my NPCs were little more than mannikins (sp?), but they're
taking on a stronger role in telling the story and getting in the way
in ways other than just blocking the hallway.

But you're right that I was interested in discussion. User interfaces
and program interfaces are somewhat of my specialty -- IF is a recent
hobby. I sometimes get more caught up in the data structures and
messages, and realize that 99% of what I've written has no use at all
in the game. F'rinstance, I wrote several pages of code (probably too
much) to handle doors like you'd find in a public place: they open
when you push on the handle, and close benhind you, and probably lock
behind you, but you could put something in the way.... but it proved
to be silly detail that wasn't important to the story.

Thanks for the pointers,
Joel

Robin Rawson-Tetley

unread,
Jan 30, 2002, 1:05:27 PM1/30/02
to
This sounds very interesting - I have currently stopped working on
anything on the IF scene as of last November (work commitments have
been bad lately and I'm already looking at screens 12 hours a day),
but when I stopped I had a 90% complete independent language that
could generate Inform code for "intelligent" NPC conversation that
could understand, remember and ask pertinent questions, along with a
whole article about how the damn thing worked as a proposal for
improved NPC conversation.

This thread has got me thinking that maybe I should release it -
combine that with a more intelligent movement system and we may just
take NPCs somewhere that they haven't already been (pun intended) :)

Rob

Mark J. Tilford

unread,
Jan 30, 2002, 3:11:29 PM1/30/02
to

I'm pretty sure it's by Huw Collingborn (don't know spelling).

And you can't drop items because its right at the beginning and you
haven't gotten any items yet.

--
------------------------
Mark Jeffrey Tilford
til...@ugcs.caltech.edu

Jim Fisher

unread,
Feb 1, 2002, 2:34:08 PM2/1/02
to
> Thanks for the additional detail. I by no means meant to slight your
> work --

I didn't take your post that way. If I came across as though I felt
"slighted," it was unintentional. :)

I appreciate your input.

--
Jim (AT) OnyxRing (DOT) com


Visit "An Inform Developer's Guide" or browse the
"ORLibrary" extensions to the standard library at
www.OnyxRing.com
----------------------
Some days you eat the code; some days the code eats you

"Joel Finkle" <joelf...@hotmail.com> wrote in message
news:1a5c1b3c.0201...@posting.google.com...

0 new messages