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

The best language to code AI and handle NPC ?

27 views
Skip to first unread message

ume...@gmail.com

unread,
Feb 18, 2007, 9:04:27 PM2/18/07
to
I want to try coding an "evolving" AI that could learn (at least basic
stuff) from the player's words or actions.
I'd like also the player to be able to "create" NPC In Game, (at least
allow the player to chose a name and some basic characteristics for
the NPC).
Interacting with the NPC would result in the creation of rules and
"habits" that could be undone or replaced (I am not decided on whether
they would be previously hard coded and to the player to discover or
created dynamically depending on the player's action but this decision
depends on what I can accomplish with the code, so here is the point
of my question)

In which language is it the easiest to do? (or at least possible to
do?)
Which language would be the more powerful for this sort of coding?

Is I7 a possible option?

Jim Aikin

unread,
Feb 19, 2007, 1:04:25 AM2/19/07
to
> In which language is it the easiest to do? (or at least possible to
> do?)
> Which language would be the more powerful for this sort of coding?
>
> Is I7 a possible option?

I can't answer these questions, but I can suggest a way to approach figuring
it out. Can you work out a detailed list of what capabilities the language
would need to have? Starting with reading an input string and assigning it
to the name property of the newly created object, I suppose. And creating an
object of a given class dynamically (or at least pretending to create an
object, which is what Inform 6 does, IIRC).

You might want to write pseudocode for your algorithm, in fact, and then try
matching it against the features of the existing languages.

--JA


ume...@gmail.com

unread,
Feb 19, 2007, 2:12:12 AM2/19/07
to

Yes I intend to write that in pseudo code (draw some kind of map of
behaviour).

To precise a little more what I want to do :
I want to be able to create dynamic associations, as when you try to
dress an animal.
You say a word and perform an action, then this word would be related
to this action in a dynamic table.
A simplistic example : you have a NPC dog, you show an apple and say
"apple". Then trow the apple very far (in some other room). Then you
tell an order to the dog "fetch apple" and it would search all the
rooms he can until it finds the object called apple and bring it back.
I don't know yet how we could teach the word "fetch" but let's say
it's hard coded from the start.
The second thing I want to be able to do is create robots with parts,
then they become some NPC we can interact with.
It would be fun to be able to use a lot of strange parts, then
activate the "robot" and it would become an NPC (we should have to
give it a name at some point). Then I would like to be able to give it
orders etc... Or to enter things in its memory by showing/saying (here
comes the dynamic database stuff)...
If I create different robots I would also like them to react to
different things, so I'd like them to have distict databases/behaviors
etc...
It may be some huge puzzle in the end.
Am I clear enough?

Since I like the idea of what we can do woth inform7 I want to know
also if it's thinkable to use inform7 for such a puzzle-heavy project?
And if there is a better language to code this kind of stuff which one?

ume...@gmail.com

unread,
Feb 19, 2007, 2:14:49 AM2/19/07
to
Precision:
Of course if you haven't taught to the dog what is an apple it would
be incapable to do anything.

Jim Aikin

unread,
Feb 19, 2007, 11:31:18 AM2/19/07
to
> Since I like the idea of what we can do woth inform7 I want to know
> also if it's thinkable to use inform7 for such a puzzle-heavy project?
> And if there is a better language to code this kind of stuff which one?

For what you're contemplating, I would suggest that TADS 3 might be a better
fit. It's a very powerful language, and its syntax is somewhat more concise
than that of I7. I7 tends to be rather wordy. My suspicion is that to do
what you're talking about, you would need to develop your own classes. I7 is
not class-based, it's rules-based.

I mostly try to stay out of the T3 vs. I7 debate. I'm sure I7 is a good fit
for a lot of people who want to try writing their own IF, but I suspect that
it's oriented more toward producing games with standard, traditional
features rather than toward experimental software constructs such as you're
envisioning.

Good luck with your project!

--JA


Graham Nelson

unread,
Feb 19, 2007, 3:07:01 PM2/19/07
to
On Feb 19, 4:31 pm, "Jim Aikin" <edi...@musicwords.net> wrote:
> My suspicion is that to do
> what you're talking about, you would need to develop your own classes. I7 is
> not class-based, it's rules-based.

It sounded to me very much like a case for developing your own rules -
I think the moral of this is that we perhaps regard the problems we
confront with the preferences we had to begin with.

> I'm sure I7 is a good fit
> for a lot of people who want to try writing their own IF, but I suspect that
> it's oriented more toward producing games with standard, traditional
> features rather than toward experimental software constructs such as you're
> envisioning.

I'm hardly the best person to pronounce on I7's merits, but I note
that there are already games in the I7 canon which show exactly this
kind of adaptive behaviour. Anyway, I'm sure any competent IF design
system would be able to solve the problems we're talking about.

Not that "traditional" IF is without its quirks and surprises, of
course. The thief in Zork I exhibits quite a repertoire of behaviour,
for instance, and there are characters in IF with the Eliza-like
ability to seem independently motivated in several pre-1980 works of
IF, even before one reaches Infocom. This is often very basic, sure,
but it's a myth that traditional IF was nothing but doors, locks,
treasures, light puzzles and mazes...

Emily Short

unread,
Feb 19, 2007, 3:16:40 PM2/19/07
to
On Feb 18, 11:12 pm, ume...@gmail.com wrote:
> To precise a little more what I want to do :
> I want to be able to create dynamic associations, as when you try to
> dress an animal.
> You say a word and perform an action, then this word would be related
> to this action in a dynamic table.
> A simplistic example : you have a NPC dog, you show an apple and say
> "apple". Then trow the apple very far (in some other room). Then you
> tell an order to the dog "fetch apple" and it would search all the
> rooms he can until it finds the object called apple and bring it back.

This I think you would be able to do in I7 with the "String Buffers"
extension, which allows the player to name things so that the game
will understand them. (See http://www.inform-fiction.org/I7/Download%20-%20Extensions.html
).

I expect teaching *actions* to the character -- conveying what "fetch"
means, in your example -- would be very very much harder, for reasons
that have more to do with the way IF interfaces work than with the
code model beneath. Essentially, a player can't demonstrate any kind
of action he can't himself perform, and he can't perform any action
that isn't already built into the model. I suppose you might be able
to rig up something so that the machine learns a new name for an
existing action, or for a series of existing actions (>PROTEST -->
take off uniform, set uniform on fire). But this sounds to me like the
hardest of the things you've described.

> The second thing I want to be able to do is create robots with parts,
> then they become some NPC we can interact with.
> It would be fun to be able to use a lot of strange parts, then
> activate the "robot" and it would become an NPC (we should have to
> give it a name at some point). Then I would like to be able to give it
> orders etc... Or to enter things in its memory by showing/saying (here
> comes the dynamic database stuff)...
> If I create different robots I would also like them to react to
> different things, so I'd like them to have distict databases/behaviors
> etc...

This sounds in some respects similar to "When in Rome part 2" (
http://www.inform-fiction.org/I7/Worked%20Examples.html ) -- there is
a creature with randomly-generated characteristics for the player to
interact with, and the creature's abilities determine what its goals
are and how it tries to fulfill them. Different creatures have
different temperaments, strengths, and skills. I imagine it would not
be too hard to do something similar with your "robot" idea.

This is a less-than-perfect starting point because the WiR code was
written before some syntax changes and doesn't currently compile. It
could be updated; I just haven't gotten around to doing this yet, as
there are a host of more urgent things to do in I7 support. These days
it would be possible to write this same code more elegantly and
compactly because of improvements to the language, and I'd like to go
back and do that.

Fortunately, the basic principle is demonstrated more compactly in the
examples of character behavior in the I7 manual: for simple behavior
sets, one chooses an end goal for the character, then chains back with
a series of "before..." rules to account for what the character has to
do first. E.g.:

Before Fred trying opening the drawer when the drawer is locked:
try Fred unlocking the drawer with the silver key.

and of course it's possible to generalize this; in WiR there are a
number of generic rules about what a creature should do to open and
close things, get rid of objects it doesn't want, eat when hungry, and
so on. Individual creatures sometimes have specialized rules that
override these, but the core behavior is there.

This is not the most sophisticated kind of planning imaginable. It
allows you easily to write rules like

Before a violent person trying opening a fragile container:
try the person asked trying attacking the noun instead.

that account for ways in which different characters might differently
approach the same situation, but it doesn't do parallel planning of
different strategies. A more sophisticated engine would allow the NPC
to consider several plans of action to achieve his goal, and select
the most efficient one.

An implementation of this is provided for Inform 7 in the form of the
Reactive Agent Planner extension, but I have not tried using it much.
(Versions of RAP exist for Inform 6 and TADS 2 and 3 as well, so this
should not in itself be decisive; if you want to use it, the more
important question will be how easy you find it to write the code that
goes *with* RAP in your language of choice. I found it a mind-
numbingly huge amount of work to do anything with RAP in Inform 6, and
gave up all of the several projects I started in that direction. There
are a couple of very short TADS 2 RAP games on the archive, and some
demo work with TADS 3 and RAP -- you might be able to get the source
to this if you want to use the extension and are interested seeing how
it might work with other languages.)

Personally, though, I found it was easy to get the goal-seeking
behavior I wanted (at least for this particular project) without
relying on RAP, just the built-in behavior of Inform 7.

I also found I7 to be reasonably effective at handling what I call the
reporting problem. One of the biggest challenges in automating NPC
behavior is generating prose to describe their actions to the player.
The text often comes out sounding quite mechanical and unnuanced;
being able to write "Report someone taking..." rules of varying
specificity meant that it was easy to create special-case descriptions
of the most interesting actions without having to tinker with the
general code at all.

Finally, a couple of other references:

-- you might want to look at JDC's comp game Mobius, if you're not
already familiar with it: this does not do planning as such, but it
does incorporate a character who learns and follows specific behavior
patterns, and where that behavior is reported elegantly. To the best
of my knowledge the source is not available, but perhaps the author
would be willing to comment if you find you have questions about how
he did certain things.

-- I also wrote Mystery House Possessed in a (much much more
primitive) version of Inform 7; at the time there wasn't any built-in
pathfinding, which would have made the characters' automated movement
quite simple to include. But the game does have characters who move
around the house following their own agendas and observing and
learning facts; one of them is a murderer and behaves accordingly,
while the others are mostly trying to collect valuables and save their
own skins. That was not entirely easy to write, but it was mostly
challenging because the compiler was still in a very buggy unfinished
state -- I daresay it would be a lot easier to write now.

Jeff Nyman

unread,
Feb 19, 2007, 6:21:12 PM2/19/07
to
"Emily Short" <ems...@mindspring.com> wrote in message
news:1171916200.2...@a75g2000cwd.googlegroups.com...

> -- you might want to look at JDC's comp game Mobius, if you're not
> already familiar with it: this does not do planning as such, but it
> does incorporate a character who learns and follows specific behavior
> patterns, and where that behavior is reported elegantly. To the best
> of my knowledge the source is not available, but perhaps the author
> would be willing to comment if you find you have questions about how
> he did certain things.

Actually, this does sound very interesting and in line with a game I'm
currently trying to write up in Inform 7, where I have characters who I need
to follow certain patterns of action (behavior) based on what they learn in
the course of what the player does.

I'll follow up with the author as well because if "Mobius" does something
like this, it sounds like it contains some good tips on how to do these
things.

- Jeff


steve....@gmail.com

unread,
Feb 19, 2007, 9:01:34 PM2/19/07
to
Graham Nelson writes:

> It sounded to me very much like a case for developing your own rules -
> I think the moral of this is that we perhaps regard the problems we
> confront with the preferences we had to begin with.

I agree. But let's leave at least a little room for objective fact;
radical relativism is boring. Or maybe we can spice it up a bit with
an anatomy of types of preference: instinctive, learned, appropriated,
pretended....

> I'm hardly the best person to pronounce[.]

Nine fingers *and* a lisp? I'm impressed! (Wait, you'r ego ing to take
that the wrong way. -- Not impressed, but I do think it's silly how
you use the word 'pronounce'.)

JDC

unread,
Feb 19, 2007, 9:13:21 PM2/19/07
to
On Feb 19, 6:21 pm, "Jeff Nyman" <jeffny...@gmail.com> wrote:
> "Emily Short" <emsh...@mindspring.com> wrote in message

I should mention that Möbius doesn't learn so much as mimic, but some
of the code might be useful as a starting point to others. I haven't
released the code in part because it won't compile past 3V01, but I
think it should be fairly simple to pull out the action storing and
reporting sections and get them working. I'll try to work up a simple
example of this in the next few days. I should also mention that it's
really not all that sophisticated, so you may be disappointed :).

You might also want to take a look at Jesse McGrew's extension Action
Queuing, which I think has similar functionality (I haven't looked at
it closely, and I don't know if it works with the current compiler).
One thing which seems to me that might make this sort of learning more
work to code in I7 as opposed to TADS3 is the lack of dynamic data
structures.

-JDC

ume...@gmail.com

unread,
Feb 19, 2007, 9:33:35 PM2/19/07
to
On 2月20日, 午前5:16, "Emily Short" <emsh...@mindspring.com> wrote:
> On Feb 18, 11:12 pm, ume...@gmail.com wrote:
>
> > To precise a little more what I want to do :
> > I want to be able to create dynamic associations, as when you try to
> > dress an animal.
> > You say a word and perform an action, then this word would be related
> > to this action in a dynamic table.
> > A simplistic example : you have a NPC dog, you show an apple and say
> > "apple". Then trow the apple very far (in some other room). Then you
> > tell an order to the dog "fetch apple" and it would search all the
> > rooms he can until it finds the object called apple and bring it back.
>
> This I think you would be able to do in I7 with the "String Buffers"
> extension, which allows the player to name things so that the game
> will understand them. (Seehttp://www.inform-fiction.org/I7/Download%20-%20Extensions.html
> ).

Thank you very much!

> I expect teaching *actions* to the character -- conveying what "fetch"
> means, in your example -- would be very very much harder, for reasons
> that have more to do with the way IF interfaces work than with the
> code model beneath.

That is what I suspected unfortunately (>_<).

Essentially, a player can't demonstrate any kind
> of action he can't himself perform, and he can't perform any action
> that isn't already built into the model. I suppose you might be able
> to rig up something so that the machine learns a new name for an
> existing action, or for a series of existing actions (>PROTEST -->
> take off uniform, set uniform on fire). But this sounds to me like the
> hardest of the things you've described.

(fortunately) I don't think I want to go this far.
For example would it be possible at least to say to the dog "take",
not like an order but to teach it the action?
(maybe with a new command like "take the apple while saying take the
apple" that would create the relationship)
I don't know if it easier to just say "take the apple" and I to take
the apple as a way to show the action (looks that it would be a more
complicated code to write for the NPC's AI).
Then after have taught it (suppose I have to do the action a certain
number of times), I say "dog, take the apple" as an order and the dog
tries to take the apple.
For "fetch" I have absolutely no idea of how I could show it so I give
up I think.

> > The second thing I want to be able to do is create robots with parts,
> > then they become some NPC we can interact with.
> > It would be fun to be able to use a lot of strange parts, then
> > activate the "robot" and it would become an NPC (we should have to
> > give it a name at some point). Then I would like to be able to give it
> > orders etc... Or to enter things in its memory by showing/saying (here
> > comes the dynamic database stuff)...
> > If I create different robots I would also like them to react to
> > different things, so I'd like them to have distict databases/behaviors
> > etc...
>
> This sounds in some respects similar to "When in Rome part 2" (http://www.inform-fiction.org/I7/Worked%20Examples.html) --

Oh, okay I'll play the game right away ^^ (since it is short)

there is
> a creature with randomly-generated characteristics for the player to
> interact with, and the creature's abilities determine what its goals
> are and how it tries to fulfill them. Different creatures have
> different temperaments, strengths, and skills. I imagine it would not
> be too hard to do something similar with your "robot" idea.

The characteristics are randomly generated at start but it is
thinkable to make the characteristics change in the middle of a game,
as the NPC learns stuff (what I really intend to do)?
(yes, in fact my two examples : the robot and dog example are a single
project : being able for the player to create NPC with parts and teach
them stuff, then break them and built other NPC which characteristics
will change depending on the parts used)


> Fortunately, the basic principle is demonstrated more compactly in the
> examples of character behavior in the I7 manual: for simple behavior
> sets, one chooses an end goal for the character, then chains back with
> a series of "before..." rules to account for what the character has to
> do first. E.g.:
>
> Before Fred trying opening the drawer when the drawer is locked:
> try Fred unlocking the drawer with the silver key.
>
> and of course it's possible to generalize this; in WiR there are a
> number of generic rules about what a creature should do to open and
> close things, get rid of objects it doesn't want, eat when hungry, and
> so on. Individual creatures sometimes have specialized rules that
> override these, but the core behavior is there.

Okay I see, thank you.

> This is not the most sophisticated kind of planning imaginable. It
> allows you easily to write rules like
>
> Before a violent person trying opening a fragile container:
> try the person asked trying attacking the noun instead.
>
> that account for ways in which different characters might differently
> approach the same situation, but it doesn't do parallel planning of
> different strategies. A more sophisticated engine would allow the NPC
> to consider several plans of action to achieve his goal, and select
> the most efficient one.

I think I don't want to go this far so it seems okay :)
The only

> Personally, though, I found it was easy to get the goal-seeking
> behavior I wanted (at least for this particular project) without
> relying on RAP, just the built-in behavior of Inform 7.

Okay, I may look into RAP only if I really can't find a compromise
with the built-in behavior (I already have to familiarize with I7
so...)

> I also found I7 to be reasonably effective at handling what I call the
> reporting problem. One of the biggest challenges in automating NPC
> behavior is generating prose to describe their actions to the player.
> The text often comes out sounding quite mechanical and unnuanced;
> being able to write "Report someone taking..." rules of varying
> specificity meant that it was easy to create special-case descriptions
> of the most interesting actions without having to tinker with the
> general code at all.

Nice.

> Finally, a couple of other references:
>
> -- you might want to look at JDC's comp game Mobius, if you're not
> already familiar with it: this does not do planning as such, but it
> does incorporate a character who learns and follows specific behavior
> patterns, and where that behavior is reported elegantly. To the best
> of my knowledge the source is not available, but perhaps the author
> would be willing to comment if you find you have questions about how
> he did certain things.

Interesting, thank you.

> -- I also wrote Mystery House Possessed in a (much much more
> primitive) version of Inform 7; at the time there wasn't any built-in
> pathfinding, which would have made the characters' automated movement
> quite simple to include. But the game does have characters who move
> around the house following their own agendas and observing and
> learning facts; one of them is a murderer and behaves accordingly,
> while the others are mostly trying to collect valuables and save their
> own skins. That was not entirely easy to write, but it was mostly
> challenging because the compiler was still in a very buggy unfinished
> state -- I daresay it would be a lot easier to write now.

Thank you very much for your advices, very helpful!
I lurk onto T3 for some time but I find I I7 interestingly
challenging so I would be sure I could do it with I7.
Graham Nelson said that any competent IF system would be able to solve
these problems, well that seems reasonable enough to try to do it with
I7.
(I guess, the biggest problem I have with I7 is the strings buffers
thing maybe... and the stange way to form sentences also, seems
reversed)

Emily Short

unread,
Feb 19, 2007, 9:52:26 PM2/19/07
to
On Feb 19, 6:13 pm, "JDC" <j...@psu.edu> wrote:

> I should mention that Möbius doesn't learn so much as mimic, but some
> of the code might be useful as a starting point to others.

Yeah, that was vaguely-phrased on my part (partly because I didn't
want to spoil anything).

However, Mobius is a good example of actions being stored and referred
to again later; and the actions extension you mention does this too.
That's one of the abilities I think the original poster would need,
together with the goal-seeking ability (which I think we've proven is
possible), string-storage ability (also possible), and good NPC action-
reporting (which you demonstrate also).


Emily Short

unread,
Feb 19, 2007, 9:57:52 PM2/19/07
to
On Feb 19, 6:33 pm, ume...@gmail.com wrote:
> For example would it be possible at least to say to the dog "take",
> not like an order but to teach it the action?

> For "fetch" I have absolutely no idea of how I could show it so I give
> up I think.

I think it should be possible to get the dog to associate a string of
text with a specific action it was supposed to do, yeah. I suspect --
as your comments hint -- that the really challenging part of this
design is going to be figuring out how the player communicates these
ideas to the dog.

> > > The second thing I want to be able to do is create robots with parts,
> > > then they become some NPC we can interact with.
> > > It would be fun to be able to use a lot of strange parts, then
> > > activate the "robot" and it would become an NPC (we should have to
> > > give it a name at some point). Then I would like to be able to give it
> > > orders etc... Or to enter things in its memory by showing/saying (here
> > > comes the dynamic database stuff)...
> > > If I create different robots I would also like them to react to
> > > different things, so I'd like them to have distict databases/behaviors
> > > etc...
>
> > This sounds in some respects similar to "When in Rome part 2" (http://www.inform-fiction.org/I7/Worked%20Examples.html) --
>
> Oh, okay I'll play the game right away ^^ (since it is short)
>
> there is
>
> > a creature with randomly-generated characteristics for the player to
> > interact with, and the creature's abilities determine what its goals
> > are and how it tries to fulfill them. Different creatures have
> > different temperaments, strengths, and skills. I imagine it would not
> > be too hard to do something similar with your "robot" idea.
>
> The characteristics are randomly generated at start but it is
> thinkable to make the characteristics change in the middle of a game,
> as the NPC learns stuff (what I really intend to do)?

Sure. If you write a rule that says "a strong NPC does this" and
another that says "a weak NPC does this", there's nothing to stop you
changing the NPC from weak to strong in the middle of the game.

steve....@gmail.com

unread,
Feb 19, 2007, 10:27:49 PM2/19/07
to
On Feb 18, 9:04 pm, ume...@gmail.com wrote:
> I want to try coding an "evolving" AI that could learn (at least basic
> stuff) from the player's words or actions.
> I'd like also the player to be able to "create" NPC In Game, (at least
> allow the player to chose a name and some basic characteristics for
> the NPC).
> Interacting with the NPC would result in the creation of rules and
> "habits" that could be undone or replaced (I am not decided on whether
> they would be previously hard coded and to the player to discover or
> created dynamically depending on the player's action but this decision
> depends on what I can accomplish with the code, so here is the point
> of my question)

It's difficult to do this on a general level. You'll probably want to
stop at half-measures. I've been working on a project to do this sort
of thing on the general level, but it's not yet there. The purpose,
however, is coming into view: to provide a zero-impact framework which
allows custom additions. I'm coding it in TADS-3. I wouldn't use I7
unless I was trying to write a compilable haiku: I7 is ridiculous to
program in.

> In which language is it the easiest to do? (or at least possible to
> do?)

Well, Graham Nelson probably isn't the best person to pronounce the
incapabilities of I7. He says that it's possible to do this in any
language, which sounds reassuring, and it's probably technically true,
but then if you actually try to do it, it will take you such an
enormous amount of work that you'll forget why you started, and by the
time you reach that level of programming proficiency, all the pseudo-
benefits of I7's newbie-centric design will have been surpassed and
forgotten.

> Which language would be the more powerful for this sort of coding?

TADS-3. But it would be a whole lot of work.

> Is I7 a possible option?

Yes. I'd recommend I6 over I7, and even I6 is bad at this kind of
thing.

Really I'd recommend starting on a more manageable (small) project.
It's hard to know how complicated AI stuff is, until you get into
programming it.

ume...@gmail.com

unread,
Feb 19, 2007, 10:43:11 PM2/19/07
to

> One thing which seems to me that might make this sort of learning more
> work to code in I7 as opposed to TADS3 is the lack of dynamic data
> structures.

That was my impression also, so I was looking for a workaround...
Well... at least if it is not impossible in I7 it's a good thing to
know.

ume...@gmail.com

unread,
Feb 19, 2007, 10:59:11 PM2/19/07
to
On 2月20日, 午前11:57, "Emily Short" <emsh...@mindspring.com> wrote:
> On Feb 19, 6:33 pm, ume...@gmail.com wrote:
>
> > For example would it be possible at least to say to the dog "take",
> > not like an order but to teach it the action?
> > For "fetch" I have absolutely no idea of how I could show it so I give
> > up I think.
>
> I think it should be possible to get the dog to associate a string of
> text with a specific action it was supposed to do, yeah.

Great news ^^

By the way I played When In Rome 2 and the behavior of the alien is
indeed very interesting. It is lively like a pet(maybe too much :
every turn feels like a countdown)... as for the way to solve the
puzzle I found it not obvious but it is another story. I had
difficulties finding the way to interact (I'm not a huge player of IF
so consider this the viewpoint of a stupid newbie).
As for the NPC goal setting I think inform7 is great and allows to do
even more than I want, but it is on the dynamic learning part that I
have problems....
Imagine my idea like a frankenstein experiment ^^

> suspect --
> as your comments hint -- that the really challenging part of this
> design is going to be figuring out how the player communicates these
> ideas to the dog.

yes...
and maybe what "creative" behavior (I mean misunderstandings) could
result in the process (the dog would not do exactly the way taught
etc... that would require pre-coding behavior I think, of things to
learn... not an ideal situation)


> > The characteristics are randomly generated at start but it is
> > thinkable to make the characteristics change in the middle of a game,
> > as the NPC learns stuff (what I really intend to do)?
>
> Sure. If you write a rule that says "a strong NPC does this" and
> another that says "a weak NPC does this", there's nothing to stop you
> changing the NPC from weak to strong in the middle of the game.

Oh I see... It is a way of doing things I really couldn't get (even
though you explained it before ^^::)
That sounds interesting, and maybe permits me to make things I thought
I couldn't... I'll think about what I can do with this method thank
you (and sorry to be a little slow to get the point... the way to
think I7 code is really different)

ume...@gmail.com

unread,
Feb 19, 2007, 11:07:09 PM2/19/07
to

> Really I'd recommend starting on a more manageable (small) project.
> It's hard to know how complicated AI stuff is, until you get into
> programming it.


Yes, I know that... But it didn't look that difficult (like a lot of
things that are nearly impossible ^^:)

Basically I just want the player to CREATE the vocabulary and the
action of an NPC...
That would mean using strings buffers extensively, and it is the weak
point of I7.. so yeah I shouls also try to code this in TADS...
After coding a little I should see rapidly which system is the easiest
to work with. But the problem with tads is that if I have to change
the library and other pre-built stuff it looks overwhelming (><)

Jim Aikin

unread,
Feb 20, 2007, 12:13:47 AM2/20/07
to
>> My suspicion is that to do
>> what you're talking about, you would need to develop your own classes. I7
>> is
>> not class-based, it's rules-based.
>
> It sounded to me very much like a case for developing your own rules -
> I think the moral of this is that we perhaps regard the problems we
> confront with the preferences we had to begin with.

True enough. To a man with a hammer, the whole world looks like a nail.

My response was based not on any in-depth knowledge of I7, nor on any intent
to disrespect it, but on the vague idea that shuffling around a few property
pointers might be useful as an approach to the original poster's problem. In
fact, my first impulse, before I decided it would be snarky, was to suggest
to him that he would probably be better off in C++.

>> I'm sure I7 is a good fit
>> for a lot of people who want to try writing their own IF, but I suspect
>> that
>> it's oriented more toward producing games with standard, traditional
>> features rather than toward experimental software constructs such as
>> you're
>> envisioning.
>
> I'm hardly the best person to pronounce on I7's merits,

Au contraire. Who better?

> but I note
> that there are already games in the I7 canon which show exactly this
> kind of adaptive behaviour. Anyway, I'm sure any competent IF design
> system would be able to solve the problems we're talking about.

Although, as Emily pointed out elsewhere in this thread, before a behavior
can be "taught" to a real-time-constructed NPC, it already has to be defined
in the code.

There are ways around this, I suppose. You might be able to create a family
of meta-verbs that would allow a primitive form of run-time code entry, and
then write a virtual compiler to which the meta-verbs would address
themselves. I'm certainly not bright enough to pull it off, but in principle
it ought to be possible. Just insanely difficult and probably pointless.

--JA

ume...@gmail.com

unread,
Feb 20, 2007, 12:16:30 AM2/20/07
to

> > For example would it be possible at least to say to the dog "take",
> > not like an order but to teach it the action?
>
> I think it should be possible to get the dog to associate a string of
> text with a specific action it was supposed to do, yeah. I suspect --
> as your comments hint -- that the really challenging part of this
> design is going to be figuring out how the player communicates these
> ideas to the dog.

I thought about keywords.
The player coult teach "this is the apple" "take the apple"
but he could as well say "this is a fruit" "take the fruit".
In this case I think that only keyword recognition would work maybe.
Because the player won't name the action or the object with the exact
name used in the code.
The player would create his own relational vocabulary...
(so when giving orders we would have to override the built-in
behavior, and parse the text or at least have to translate something
at some point... I can't imagine all the twisted names payers could
try to use... but it is part of the game)
Is there a workaround or even a path to do this in I7 (without
touching to I6 code)?
I looked at the Tads documentation also but not sure it would be
simpler to do(yet to find a relevant passage in the documentation).

ume...@gmail.com

unread,
Feb 20, 2007, 12:35:01 AM2/20/07
to
On 2月20日, 午前11:13, "JDC" <j...@psu.edu> wrote:
> On Feb 19, 6:21 pm, "Jeff Nyman" <jeffny...@gmail.com> wrote:
>
>
>
> > "Emily Short" <emsh...@mindspring.com> wrote in message
>
> >news:1171916200.2...@a75g2000cwd.googlegroups.com...
>
> > > -- you might want to look at JDC's comp game Mobius, if you're
> You might also want to take a look at Jesse McGrew's extension Action
> Queuing, which I think has similar functionality (I haven't looked at
> it closely, and I don't know if it works with the current compiler).
> One thing which seems to me that might make this sort of learning more
> work to code in I7 as opposed to TADS3 is the lack of dynamic data
> structures.
>
> -JDC

I am reading the Queuing extension you talked about and I found a very
interesting passage :

We can also write "trying the current action" to have someone mimic
the player's action:

queue the mime trying the current action;
queue the mime trying the current action immediately;

I'll see if I can do something with that...
Very sweet.

Emily Short

unread,
Feb 20, 2007, 12:36:41 AM2/20/07
to
On Feb 19, 9:16 pm, ume...@gmail.com wrote:
> > > For example would it be possible at least to say to the dog "take",
> > > not like an order but to teach it the action?
>
> > I think it should be possible to get the dog to associate a string of
> > text with a specific action it was supposed to do, yeah. I suspect --
> > as your comments hint -- that the really challenging part of this
> > design is going to be figuring out how the player communicates these
> > ideas to the dog.
>
> I thought about keywords.
> The player coult teach "this is the apple" "take the apple"
> but he could as well say "this is a fruit" "take the fruit".

Sure. This is what the string buffer extension is good for -- giving
new labels to things. As a first approximation, here's how you might
teach the puppy to recognize the name 'fruit':

<code>
Include String Buffers by Jesse Mcgrew.

Lab is a room. Puppy is an animal in Lab. The player carries an apple.
The apple is a labeled thing which is hiding its label.

Understand "say [quoted text] to [someone]" as teaching to. Teaching
to is an action applying to one thing.

The idea is a labeled thing.

Carry out teaching to someone:
copy the quoted text to the idea;
say "[The noun] looks attentive, ready to learn the meaning of
'[message of the idea].'"

Instead of showing something to the puppy:
if the message of the idea is "blank"
begin;
do nothing;
otherwise;
copy the message of the idea to the noun;
say "Now [the second noun] understands that '[message of the noun]'
means [the noun].";
end if;

Persuasion rule: persuasion succeeds.

Test me with "drop apple / puppy, get fruit / get apple / say 'fruit'
to puppy / show apple to puppy / drop apple / puppy, get fruit".
</code>

ume...@gmail.com

unread,
Feb 20, 2007, 12:57:11 AM2/20/07
to

ume...@gmail.com

unread,
Feb 20, 2007, 1:22:42 AM2/20/07
to
Sorry I pressed the button "send" by mistake, sending a non wanted
mail.

Here is what I wanted to post:
I'd like to submit a bit of I7 code I wrote (warning : newbie code).
It works, but lacks the player's input of the name (and maybe I could
ask other parameters if I manage to get the thing to work...).

So I'd like to know what you would think of such a code (I haven't
written the report of the pushing action, neither the test on the
contents of the machine(I could base the test on the Transmutations
example maybe) and I have pasted bits of code from the technological
terror example to make the game playable).

What is the point in posting this code?
Well I'l like to know if the design is consistent or if there is a
better way to start.


---

"robot game" by anonymous

The Lab is a room. "A plain laboratory."

The machine is in the lab. It is a container. it is not portable.
the button is part of the machine. it can be pushed.
The left leg, the stainless steel right leg, the left arm, the right
arm, the terminator's head, the robocop's body, the post-it are in the
lab.

the robot is a thing.

The description of the post-it is "There is 'Robbie' written on it."


carry out pushing something:
say "You push the button";
now every thing which is in the machine is part of the robot;
now the robot is in the lab.

[I'd prefer have the machine ask to enter directly the name but for
the moment if I could at least manage to chose the name by pre-coded
post-its, or written post-its, would it easy to code?...]

Shooting is an action applying to one thing.

Understand "shoot [something] " as shooting.

Carry out shooting something:
say "ZAP! [The noun] twinkles out of existence! [if something is
part of the noun][The list of things which are part of the noun]
clatter to the ground! [end if][paragraph break]";
now every thing which is part of the noun is in the location;
remove the noun from play.

Instead of examining something when something is part of the noun:
say "[The noun] consists of [list of things which are part of the
noun]."

ume...@gmail.com

unread,
Feb 20, 2007, 2:28:04 AM2/20/07
to

> [I'd prefer have the machine ask to enter directly the name but for
> the moment if I could at least manage to chose the name by pre-coded
> post-its, or written post-its, would it easy to code?...]

I'll answer this part myself:
I seems I could use the Strings Buffer extension for this.
I could "label" the robot the name chosen by the player.

So in the code the robot would be referred as robot, and in the game
by the name the player chose.
Now if I want to save the game, will the buffers be saved?
And if I want 2 or 3 robots, how can I handle it in the code?

I am asking a lot of questions sorry...

ume...@gmail.com

unread,
Feb 20, 2007, 2:45:36 AM2/20/07
to

> > I thought about keywords.
> > The player coult teach "this is the apple" "take the apple"
> > but he could as well say "this is a fruit" "take the fruit".
>
> Sure. This is what the string buffer extension is good for -- giving
> new labels to things. As a first approximation, here's how you might
> teach the puppy to recognize the name 'fruit':

Oh thank you, I was reading the documentation of the strings buffers
and was really pleased then answered to myself in an other post before
noticing this one!
I'll try your code as soon as I have reinstalled inform (looks like it
couldn't find the extension... then the compiler crashed. I have
installed inform on an USB drive then copied it on the hard drive for
faster access, so it may have been confused at some point)

ume...@gmail.com

unread,
Feb 20, 2007, 3:02:29 AM2/20/07
to

I got the code to work...
It's beautiful.
At least it does the basic stuff I need to go forward.
Sorry to have messed so much with scattered mails.
wow, really I'm impressed.

Now, the question that could complicate a lot the thing :
does it saves when we save the game? ^^:

ume...@gmail.com

unread,
Feb 20, 2007, 3:18:13 AM2/20/07
to
Ah, let me add a little correction:

The test of the "message of the idea" on "blank" has an unwanted
result, instead this test works as planned :

Emily Short

unread,
Feb 20, 2007, 3:22:58 AM2/20/07
to

Good point, sorry -- in many of my own things I set the default text
to "blank", so I suppose I was on autopilot...

ume...@gmail.com

unread,
Feb 20, 2007, 3:33:58 AM2/20/07
to

well, in fact there is a problem with this too.
If I write "blank" in the code and starts by showing before saying
puppy will understand that "" means the apple.
if I write "" in the code, it will never understand anything.
I am debugging....

There's also the problem of the hidden label, since it is hidden the
player can't use "drop fruit" to drop the apple which is a bit strange
in context.

Adam Thornton

unread,
Feb 20, 2007, 7:29:56 PM2/20/07
to
In article <1171936894.4...@v45g2000cwv.googlegroups.com>,

<steve....@gmail.com> wrote:
>Nine fingers *and* a lisp? I'm impressed!

Yeth, Marther!

Igor

Adam Thornton

unread,
Feb 20, 2007, 7:31:00 PM2/20/07
to
In article <ere02b$8p2$1...@aioe.org>, Jim Aikin <edi...@musicwords.net> wrote:
>I'm certainly not bright enough to pull it off, but in principle
>it ought to be possible. Just insanely difficult and probably pointless.

Why should that stop, say, someone who implemented a Scheme interpreter
in zcode?

Adam

Jim Aikin

unread,
Feb 20, 2007, 8:03:49 PM2/20/07
to
Ah, another Terry Pratchett. Fan. But shouldn't that be "Marthter"?

--JA

"Adam Thornton" <ad...@fsf.net> wrote in message
news:4dgsa4-...@quicksilver.fsf.net...

Adam Thornton

unread,
Feb 20, 2007, 8:22:35 PM2/20/07
to
In article <erg5pk$lfd$1...@aioe.org>, Jim Aikin <edi...@musicwords.net> wrote:
>Ah, another Terry Pratchett. Fan. But shouldn't that be "Marthter"?

Yeth, it thould.

Igor

JDC

unread,
Feb 20, 2007, 8:44:17 PM2/20/07
to

I've pulled out the action storing and reporting parts of Möbius and
created a short demonstration of using this (and String Buffers) to
teach commands to an NPC. The source is a bit long, so I've posted it
at:
http://www.math.psu.edu/clemens/IF/Robopuppy/

This is pretty rough (in particular, the line breaking isn't quite
tweaked properly here and pretty much nothing is implemented) but it
should give a basic idea. I think quite a bit of work would be needed
to get reasonable parsing of the new commands (since they are parsed
with UnknownVerb they don't quite play well with adding direct objects
in the present form); I didn't try to tackle that issue. And (as noted
above), people may be entirely unimpressed...

It's commented pretty sparsely; you can read the in-game instruction
sheet (or the tests in the source) for the syntax.

-JDC

James Cunningham

unread,
Feb 20, 2007, 9:02:35 PM2/20/07
to
On 2007-02-19 21:01:34 -0500, steve....@gmail.com said:

> Graham Nelson writes:
>
>> It sounded to me very much like a case for developing your own rules -
>> I think the moral of this is that we perhaps regard the problems we
>> confront with the preferences we had to begin with.
>

> I agree. But let's leave at least a little room for objective fact;
> radical relativism is boring. Or maybe we can spice it up a bit with
> an anatomy of types of preference: instinctive, learned, appropriated,
> pretended....
>
>> I'm hardly the best person to pronounce[.]
>
> Nine fingers *and* a lisp? I'm impressed! (Wait, you'r ego ing to take
> that the wrong way. -- Not impressed, but I do think it's silly how
> you use the word 'pronounce'.)

Oh, god. *God*. You'r ego ing. 'Cause - 'cause - 'cause Graham has a
big ego. That's rich, man, rich - pure gold! Did the untold thousands
you spent edumacating yourself teach you that sort of repartee? Words
fail me. To live in the same world at the same time as someone with
your ascendent level of wit, I can't imagine being luckier.

Plato lived in the time of Socrates, and Boswell was brightened by
Johnson - hell, Watson had his Holmes - but I am luckiest of all: I may
experience the most entertaining doctor that never grabbed my balls and
told me to cough.

Best,
James

ume...@gmail.com

unread,
Feb 20, 2007, 11:55:15 PM2/20/07
to

Wow, Thank you.
I think it will take me time to get it all.
Thank you again!

ume...@gmail.com

unread,
Feb 21, 2007, 4:42:42 AM2/21/07
to
On 2月21日, 午前10:44, "JDC" <j...@psu.edu> wrote:

I have tested the game and besides the fact that the persuasion rules
still work with the command "puppy, take ball", it was pretty much fun
to create different commands. The robot is almost too good, as to
reproducing my mistakes and me trying to read the instruction sheet.
When I read the Strings Buffers extension documentation I couldn't
imagine we could go so far, I'm really impressed.
I think it could be a nice base-engine for what I want to do, I can
already imagine an infinity of possible puzzles.
Thank you for showing the power of Inform7, I was almost ready to try
another language (reading T3 doc and LambdaMoo programming manual...
talking of lambdamoo it's more a virtual reality than a game but there
is object oriented programming bundled into the game and some people
already made some pretty neaty dynamically evolving stuff, see the
Rube Goldberg contraption. There is even a book : http://www.yibco.com/
). Well I digress.
Now I'll try to get deeper in you source code, thanks again ☆

steve....@gmail.com

unread,
Feb 21, 2007, 9:42:46 AM2/21/07
to
James Cunningham writes:

> Oh, god. *God*. You'r ego ing. 'Cause - 'cause - 'cause Graham has a
> big ego. That's rich, man, rich - pure gold!

Hey, he got the joke! Give that boy a cookie. -- No, not that cookie,
the one that fell on the floor.

It wasn't supposed to be *that* funny. But a little wordplay to double
the point, though low, is probably still a bit higher, and probably
more amusing, than your pathetic screaming sarcasm.

> Words fail me.

Indeed they do. So badly, in fact, that I think you have grounds for a
lawsuit:

> Plato lived in the time of Socrates, and Boswell was brightened by
> Johnson - hell, Watson had his Holmes - but I am luckiest of all: I may
> experience the most entertaining doctor that never grabbed my balls and
> told me to cough.

I think you've got your doctors confused.

Daryl McCullough

unread,
Feb 21, 2007, 2:47:00 PM2/21/07
to
Adam Thornton says...

My preferred way to read Steve Breslin articles is after they
have acquired Adam Thornton commentary. Thanks for providing this
service...

--
Daryl McCullough
Ithaca, NY

0 new messages