Tuesday, February 28, 2012

Followers, spoken commands, and quests

I think I've found something that hasn't been done that could add a lot to roguelikes: spoken commands. You type what you want your followers to do and they do it. Instead of having a complex AI that handles the entire english language, you could focus on a few things that could be combined in different ways. If you have many people following these commands then you and your rag-tag team of adventurers could really change the world.

Here's a simple command syntax that I have in mind:
  <target> <verb> [<objects>] [<preposition clauses>]

target is an optional person or group you are talking to: healer, fighters, Bob, Joe, etc.
verb is one of a dozen or so supported verbs: attack, defend, go, pickup, drop, help, etc.
objects are the people, places, or things directly involved with the verb: a sword, goblins, me, the desert, home, etc.
preposition clauses are optional clauses that constrain the verb: in <location>, with <item>, etc.

The prepositions are where the real flexibility and power come from since you can specify where something should happen, what should be used, or whatever else makes sense. The verbs, people, places, things, and prepositions would be whatever is appropriate to the game; resource gathering, squad maneuvers, mixing potions, social intrigue, whatever you can think of.

Turning the spoken words into commands would be three steps:
  1. Normalize the sentence, removing fluff words and changing synonyms (protect -> defend)
  2. Parse the sentence
  3. Correct the prepositions and objects if necessary

As an example, Miners, give the blacksmith ore from the mines would be normalized into
 miners give blacksmith ore from mines which would be parsed into this:
 target = miners
 verb = give
 objects = blacksmith, ore
 prepositions = from mines

The correction phase would be necessary in this example since the "give" verb requires the verb's object to be a thing and requires a "to <person>" prepositional clause. "blacksmith" is a person and "ore" is a thing so "blacksmith" should be the "to" prepositional clause and "ore" should remain as the verb's object. The corrected interpretation is:
 target = miners
 verb = give
 objects = ore
 prepositions = from mines, to blacksmith
or miners give ore from mines to blacksmith

So the miners who hear this would get ore from the mines and give it to the blacksmith.

Some other example commands:
 healer, help the villagers at home
 kill the goblins in the dark forest with spears
 Urist, craft a sword with steel at the master's forge
 guards, escort the prince from the castle to the fort

There seems to be a deep similarity between commands and quests. Even my example Lost Heirloom Quest could be seen as a command: player, give the McUrist family watch from the dark forest to Urist McUrist. Since the NPCs can follow commands, and commands and quests are the same, then they should be able to follow quests. Also; since the player can give commands, the player is also giving quests. Imagine a world with a few hundred NPCs running around trying to fulfill quests and giving quests to others when appropriate.

No comments:

Post a Comment