Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Is there a way of swapping noun1 and noun2?

A topic by Garry Francis created Jun 13, 2020 Views: 105 Replies: 4
Viewing posts 1 to 3
Submitted

Consider the following two commands:

>GIVE AXE TO TROLL

>GIVE TROLL AXE

They both mean exactly the same thing. In both cases, AXE is the direct object and TROLL is the indirect object. In the first one, noun1 is the direct object and noun2 is the indirect object. In the second one, it's vice versa. So, is it possible to swap noun1 and noun2 in cases such as this when the preposition is omitted?

Host

Not yet. But I've been thinking about this for quite a while. I've watched players invert noun order so many times.

I'm not sure it's a universal rule of English that omitting a preposition switches the order or direct and indirect verb. It's tempting to implement it as such. Can anyone find a flaw in such a general rule.

Submitted

It's not that simple. There are actually very few situations where omitting the preposition changes the order of the direct and indirect object. In most cases, it just makes the sentence sound like nonsense. That's why you need to be able to specify the grammar (i.e. the pattern of the words used) and map this to an action. You can't do this in Adventuron or any of the old languages (Quill, PAW, DAAD etc.) that it's inspired by. Whereas you can do this in all modern IF languages (Adrift, Alan, Hugo, Inform, TADS, Quest etc.).

I have started using multi-word input for the first time and have decided that it's just too hard in Adventuron. Consider the following:

HIT
HIT dobject
HIT dobject WITH
HIT dobject iobject
HIT dobject WITH iobject

where dobject = direct object (noun1 in Adventuron) and iobject = indirect object (noun2 in Adventuron).

Only the last one is valid grammar. In the second one, you can imply that you are hitting the object with your hand or you can imply that if the relevant indirect object is held, then you hit the direct object with that. That's what old-school adventures with a two-word parser usually do.

However, in all cases, the direct object can be present or absent or a nonsense word. If present, it may be visible, but not accessible. It may be an animate object (non-player character) or an inanimate object. It may be in the player's inventory or worn or in a container or even the player himself/herself. The indirect object can be the same. For the action to make sense, the direct object should generally be an accessible object that is in the room, not in the player, and the indirect object should be carried by the player and not worn or in a container.

Now imagine testing for all these situations for every direct object that can be hit and every indirect object that can do the hitting, the code becomes unmanageable. That's why you need a grammar that can be specified in a standard library and supplemented or overridden. Then all you need to do is code the exceptions to the general case.

For me, I designed a small game in Inform 6 that was dependent on containers/supporters and multi-word input. As it's only a small game, I thought it would be easy to port to Adventuron. Now I'm tearing my hair out.

Host

As I've told you in the past, I'm moving away from "match" based matching, which also does away with things like

  • noun1_is
  • noun2_is
  • adjective1_is
  • adjective2_is
  • prepositon_is

You simply specify grammar patterns then pluck out subject1 (direct object) and subject2 (indirect object), and let adventuron do the rest.  Adventuron will be aware of things like where to look for subjects, how to respond if a subject isn't there or isn't known, if the subject doesn't have the appropriate traits for the action to make sense (e.g. SWIM IN LOG). Action handlers would be object centric, and contained within objects. Which I believe is the best approach for keeping code organised.

I do think there is a place for match based handlers, particularly in games that are overtly verb noun. and I am trying to make it so that both systems can co-exist, even though I think it unlikely and foolish to use both systems together in the same game.

Sorry, but for this jam, you'll have to make do with the lower feature set and sacrifice, or work around the edge cases.

Submitted

That's something to look forward to.