[MUD-Dev] Re: Prepositions and parsing

clawrenc at cup.hp.com clawrenc at cup.hp.com
Thu May 8 09:59:21 New Zealand Standard Time 1997


In <01IIL0PA7AVM99FU60 at nova.wright.edu>, on 05/07/97 
   at 07:59 PM, S001GMU at nova.wright.edu said:

>Date: Tue, 06 May 1997 20:45:19 +0000 (PST8PDT)
>From: clawrenc at cup.hp.com

>>What with the recent discussion of parsers and methods of parsing
>>commands, and old entry from my to-do list popped up:
>>
>>  Support for prepositions such as "under", "on top of", "behind" etc.
>>
>>Anyone got any ideas for supporting/parsing a command like:
>>
>>  hide under the desk
>>
>>or
>>
>>  put the rock under the rug behind the pillar

>'On top of' and 'under' are pretty easy to handle.

How about, "beside", "behind", "above", "between", "near", "close to",
"over" etc?  I'm specifically looking for intelligent handling that
will allow the following sequence:

  > put the book on the table
  OK.
  > put the paper under the book
  OK.
  > l
  There is a table here with a book on it.
  > get book
  OK.
  > l
  There is a table here with a paper on it.

or, 
  
  You are flying.
  > hover over bubba
  OK.
  > l d
  Looking straight down you can see Bubba.

and:

  > l
  There is a rock and a hard place here.
  > put XXX between rock and hard place.

I do see that some prepositions are fairly easy to handle as special
cases, but I have a very strong feeling that that's just a gross over
simplification that's going to wind you in trouble later when you try
and handle the rest.  I'm trying to think of a general parser model
which properly handles prepositions.

>  What does 'Behind the pillar' mean?  Is behind relative to the room
>or to the player?  

That was deliberately ambiguous with the ambiguity both on placement
"behind") and selection ("put the rock under (the rug behind the
pillar)" vs "(put the rock under the rug) behind the pillar").  

>The former is easy, the later not so easy, but
>much more realistic. 

My intention would be to always default to the player's POV as the
frame of reference.  Obviously there are cases where that POV is
modified by an external circumstance, usually due to large
spaces/small spaces being juxtaposed, or a directionality of the
object in question (a car for instance has a front and a back, which
as prepositions can override the player's POV of "in front of",
"behind" etc).
 
it is at this exact point that I think the special casing mentioned
above gets really ugly.  Imagine the case of a huge spaceship lieing
upside down.  "Under" and "above" can be argued to be ambiguous terms.

>If you wanted it to be relative to the player
>you would have to know where the player was relative to the object.  

Yup.  Remember -- I've always intended to do a coordinate system.

>'Spose you could also have it be  relative to the object in
>question... a TV has a definite front and back... when you are
>interested in watching it.  If it's just collecting dust in the
>attic, though, then I don't spose it'd make a difference what
>direction it was facing.. :)

Bingo.

>You could have each object type have the possibility of a defined
>orientation. The parser could then look for that first, and failing
>that, go by the  character's position.

Good idea.  I like this.  While an object defines its own size and
shape, it can also surround itself with a field which defines
comparitive placement...  This most all of the placement preopositions
then devolve to picking the approriate offset from the object's field.

  ie:
 
  Object X.

 "Above" is defined as vector (0, 0, -1) from ObjectX's origin.
 "Beside is defined as vestor (1, 0, 0) from ObjectX's origin.
  etc.

>Once you have the orientation of the object in question, you could
>then just have some algorithm that determines what parts of the
>room's coordinate space belong to what preposition.  An easy alg I
>can think of would be to treat  the object as a rectangular solid
>with each face of the solid determining the near boundry of the
>coordinate space belonging to a given preposition (wouldn't work too
>well with oddly shaped objects, though).  The far boundry could be
>determined based on the size of the object in question... beside a
>building and beside an apple are two entirely different things.

Hurm...

--
J C Lawrence                           Internet: claw at null.net
(Contractor)                           Internet: coder at ibm.net
---------------(*)               Internet: clawrenc at cup.hp.com
...Honorary Member Clan McFUD -- Teamer's Avenging Monolith...




More information about the MUD-Dev mailing list