Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > Advanced MUD Concepts
Click here to Register

Reply
 
Thread Tools
Old 04-04-2006, 08:12 PM   #1
Drealoth
Member
 
Join Date: Jan 2006
Location: Japan
Posts: 74
Drealoth is on a distinguished road
Send a message via MSN to Drealoth
One of the weakest parts of the vast majority of text MUDs I've found has been the parse. They often follow a very rigid syntax focused too much on syntax than actually figuring out what you mean. The simple command 'get the sword' fails on a huge number of MUDs because of 'the'. If you want to get a yellow sword from a blue box you usually end up having to type something like 'get 'yellow sword' 'blue box''

Personally, I've wanted MUD parsers to be more English like - 'get the first and second yellow swords from the weapon rack' should work properly. I've also thought that it would be cool to be able to have adverbs in sentences, so something like 'quickly get the sword' would modify get appropriately. Although I imagine it would be mostly emotive, there could definitely be some interesting game mechanics based around it. I've also wanted to see better error messages. Most muds give you 'Huh?' or its equivalent. 'get the sowrd' will probably say 'You can't find that here.' Why not 'There's no sowrd here - did you mean 'sword''? Finally, I think that there's no reason that a MUD shouldn't support having multiple verbs in a sentence - 'quickly stand and get the sword from the table'.

Although a lot of these can be done in most muds using other syntax, I think people are forgetting that the parser is the player's interface with the world, so the more expressive it is the more freedom it gives the player. With the two verbs in a sentence example - in most muds, you'd have to do 'stand' 'get sword table' which would appear to the world as 'Drealoth stands up.' 'Drealoth gets the sword from the table.' instead of 'Drealoth quickly jumps to his feet and grabs the sword from the table.'

Anyway, just some thoughts. What would you like to see in a MUD's command parser?
Drealoth is offline   Reply With Quote
Old 04-05-2006, 05:10 AM   #2
KaVir
Legend
 
KaVir's Avatar
 
Join Date: Apr 2002
Name: Richard
Home MUD: God Wars II
Posts: 2,052
KaVir will become famous soon enoughKaVir will become famous soon enough
Perhaps it's the programmer part of me, but to be honest I actually prefer a fairly rigid syntax.  I know natural language parsers are supposed to be "fashionable and cool", but the question is, do they really add anything to the game?

Let's look at some of the advantage of a rigid (but well-designed) command syntax:

1. Quick to type: It's much faster to type "get 2.sword" than "get the second sword".  This becomes particularly important in combat situations where even a single second can make a difference.  It can also save the player a lot of unnecessary typing over the many hundreds of hours they put into the mud.

2. Consistent: Once you understand the syntax for one command, you'll be able to apply the same syntax rules to other commands.

3. Reliable: Because the syntax is rigid, you won't have to worry about it trying to second-guess you or misinterpretting what you're trying to do.

4. Easy to learn: Learn the commands, learn the simple syntax rules, and that's it.  You don't have to worry about learning how the various quirks of a natural language parser apply to each command, because there won't be any.

5. Easy to implement: Much easier to implement, particularly for a game which is always evolving and changing.

Even if you could create a 'perfect' natural language parser, which didn't make mistakes or misunderstand command requests, you'd most likely still find that hardly anyone used it.  Perhaps the occasional newbie trying their first mud would use it, but they'd soon wittle it down to the shortest form possible.  It'd be a huge amount of work for something which most people wouldn't use, just for the sake of having something 'cool' on your feature list.  Plus there's the fact that no natural language parser is 'perfect'.

However that doesn't mean that the command syntax can't be made a bit more flexible.  For example, my 'give' command supports the following:

Syntax: give <object>
Syntax: give <object> <creature>
Syntax: give <object> to <creature>
Syntax: give <creature> <object>
Syntax: give to <creature> <object>


This is obviously fully compatible with the standard Diku syntax, but it also supports the other typical variations that newbies tend to try, without the implementation effort required for a natural language parser.

Feedback such as "There's no sowrd here - did you mean 'sword'?" is of dubious value in my opinion.  In that example it's fairly obvious what the player meant, and there's no real need to tell them about it, while other cases (eg "There's no artwork here - did you mean 'armour'?") are just going to sound odd.  It's also likely to start requiring a lot of extra processing, and could end up giving some really strange messages once you start taking player names into account.

The combined verbs idea is nice though, and could certainly add some flavour to the game, particularly for roleplaying muds.
KaVir is offline   Reply With Quote
Old 04-05-2006, 07:28 AM   #3
Baram
Member
 
Baram's Avatar
 
Join Date: Jan 2006
Location: Seoul
Home MUD: Tears of Polaris
Posts: 218
Baram is on a distinguished road
I'm with Khavir on this one, and he makes a great point about being flexable. Besides the painful amount of time and energy to make a parser like that, as Khavir pointed out, most people will break down to the fastest way of typing.
Baram is offline   Reply With Quote
Old 04-05-2006, 11:53 AM   #4
Malifax
Member
 
Join Date: Mar 2006
Posts: 108
Malifax is on a distinguished road
Simplicity is best, IMHO. You can string commands together to do anything you want and add flavor by emoting.
Malifax is offline   Reply With Quote
Old 04-05-2006, 12:44 PM   #5
Ide
Senior Member
 
Join Date: Feb 2006
Location: Seattle
Posts: 361
Ide will become famous soon enoughIde will become famous soon enough
Ide is offline   Reply With Quote
Old 04-05-2006, 07:57 PM   #6
Drealoth
Member
 
Join Date: Jan 2006
Location: Japan
Posts: 74
Drealoth is on a distinguished road
Send a message via MSN to Drealoth
At this point my mud doesn't exist, but if (and maybe when) it did, it would be on the table. Looking at the table would give 'There's a table here with a sword lying on it.' If you kicked the table, it would fall off - if it was made of glass, it might break when it fell.

Right now I've been mostly doing the parser for fun, to see how far I can take it so that it still understands my commands. One feature it has right now is that adjectives on a noun are attached as a list to it, so 'get yellow shining sword' 'get shining yellow sword' 'get yellow sword' and 'get shining sword' all will (probably) target the same object.

Also, to reply to KaViR's point that it's faster to type - I was thinking of this system as a compliment to a shorter condensed system, not a replacement. If a person knows the condensed syntax, they'll obviously use that. If a player wants to get the second sword, all they have to do is type 'get the second sword.' The game might even reply with 'HINT: This command is the same as 'g 2.sword'.' I think that having a more english like syntax available would help make it so the player doesn't have to be constantly looking up help files for commands.

The other thing that will be implemented will be the ability to specify a number of objects to perform the verb on. 'get three apples from basket'

Here's some buggy code in Ruby that I threw together yesterday. Doesn't work properly yet, but I'm getting there.

[code] # An object within the game. Takes a name and any number of adjectives
class Game_Object
attr_accessor ;adjectives #A list of adjectives associated with the object
attr_accessor ;name #A single word describing the object

def initialize(name,adjectives)
@name=name
@adjectives=adjectives #adjectives can be any number of single words.
end
end

#For parsing input
class Parser
def initialize
@ignore=['a','the']
#A list of default objects for testing purposes.
@nouns=[Game_Object.new('sword',['shining','short' ]),
Game_Object.new('sword',['long','shining']),
Game_Object.new('table',['short', 'sturdy']),
Game_Object.new('knife',nil),
Game_Object.new('chair',['sturdy','wooden']),
Game_Object.new('chair',['tall','sturdy','wooden'] ),
Game_Object.new('chair',['metal']),
Game_Object.new('door',['sturdy','iron']),
Game_Object.new('chest',['small','iron'])
]
@verbs=['get','put','sit','stand','run']
@prepositions=['from','on','with','to','at']
@adverbs=['quickly','slowly','quietly']
@counters=['first','second','third','fourth','fift h',
'sixth','seventh','eighth','ninth','tenth'
]

#and here we define our grammar. Ones that go to ';end' can end the phrase
@expected= {
;verb => [;preposition,;ignore,;counter,;adjective,;noun,;e nd],
;adjective => [;adjective,;noun],
;noun => [;list,;adverb,;preposition,;end],
;adverb => [;verb,;end],
;preposition => [;ignore,;adjective,;noun,;counter],
;ignore => [;counter,;adjective,;noun],
;counter => [;adjective,;noun],
;list => [;ignore,;counter,;adjective,;noun]
}
end

#to determine the type of a word
private
def is_verb?(word)
return false if word == nil
return @verbs.include?(word)
end

private
def is_noun?(word)
@nouns.each do |noun|
return true if noun.name==word
end
return false
end

private
def is_adverb?(word)
return false if word == nil
return @adverbs.include?(word)
end

private
def is_preposition?(word)
return @prepositions.include?(word)
end

private
def is_counter?(word)
return @counters.include?(word)
end

private
def is_adjective?(word)
@nouns.each do |noun|
return true if noun.adjectives and noun.adjectives.include?(word)
end
return false
end

private
def is_ignore?(word)
return @ignore.include?(word)
end

private
def is_list?(word)
return word=='and'
end

private
def is_type?(type,word)
case type
when ;verb then return is_verb?(word)
when ;adjective then return is_adjective?(word)
when ;noun then return is_noun?(word)
when ;preposition then return is_preposition?(word)
when ;counter then return is_counter?(word)
when ;adverb then return is_adverb?(word)
when ;list then return is_list?(word)
when ;ignore then return is_ignore?(word)
end
end

#Yes, this shouldn't be here, but it makes life easier.
public
def look
puts "You see;"
@nouns.each do |noun|
line="A "
if noun.adjectives
noun.adjectives.each do |adj|
line += adj + " "
end
end
puts line + noun.name + "."
end
end



#Parse 'msg'
#TODO; adverb support later.
def parse(msg)
return "Empty message" if msg==nil
words = msg.strip.downcase.squeeze(' ').split(' ')
argc=words.length
return "Empty message" if words.length==0
#now we just have to iterate over the tree

#the first word must be a verb (or adverb eventually)
valid_types=[;verb]
is_valid=validate(words,valid_types)
return is_valid
end

#recursively valdiate the list of words
private
def validate(words,valid_types)
word = words[0]
if words.length == 1
if is_adverb?(word) || is_verb?(word) || is_noun?(word)
return true
end
puts "Sorry, #{word} is not a noun/verb/adverb."
return false
end
valid_types.each do |type|
if is_type?(type,word)
return validate(words[1..words.length-1],@expected[type])
end
end
return false
end

end


##
# Testing, testing, one two three.
##

parser=Parser.new
parser.look
puts
puts "TEST CASES;"

puts "The following should fail due to syntax;"
puts parser.parse(nil)
puts parser.parse('')
puts parser.parse('hello world!')
puts parser.parse('sit on')
puts

#These ones are syntactically correct, but should return errors for reasons
#such as an object not existing
puts "The following should fail due to circumstance;"
puts parser.parse('get axe') #no axe in the room
puts parser.parse('get the second shining axe') #Again, no axe in the room
puts parser.parse('get the second shining axe from the chest')
puts parser.parse('get the sword from the strange box') #No strange box.
puts parser.parse('get second long sword') #only one long sword
puts parser.parse('sit on couch')
puts parser.parse('sit on the couch')

puts

puts "The following should succeed;"
puts parser.parse('sit')
puts parser.parse('get sword')
puts parser.parse('get shining sword')
puts parser.parse('get the sword')
puts parser.parse('get the shining sword')
puts parser.parse('get the second shining sword')
puts parser.parse('get sword from chest')
puts parser.parse('get the sword from the chest')
puts parser.parse('get the shining sword from the chest')
puts parser.parse('get the second shining sword from the iron chest')
puts parser.parse('sit on chair')
puts parser.parse('sit on the chair')
puts parser.parse('sit on the wooden chair')
puts parser.parse('sit on the metal chair')
puts parser.parse('sit on the second chair')
puts parser.parse('sit on the second wooden chair')
puts parser.parse('sit on the second sturdy wooden chair')
puts parser.parse('put the second sword on the second wooden chair')

puts
puts "Fin."[/quote]
Drealoth is offline   Reply With Quote
Old 04-07-2006, 06:29 PM   #7
NotL337
Member
 
Join Date: Apr 2006
Posts: 42
NotL337 is on a distinguished road
It's an interesting idea, but personally I've played a few muds where you DO have to type out: "put the sword in the bag" and it drives me up the wall.

I would rather just type in put sword bag and get on with my role playing.
NotL337 is offline   Reply With Quote
Old 04-07-2006, 07:54 PM   #8
prof1515
Senior Member
 
Join Date: Aug 2003
Location: Illinois
Posts: 791
prof1515 will become famous soon enoughprof1515 will become famous soon enough
Send a message via AIM to prof1515 Send a message via Yahoo to prof1515
This is technical and really doesn't have an impact on the players' "expressive" freedom. They're commands, not expressions.

I'm curious. Would you require them to type "Check my character's skill level?" or "Log out of the game." with proper punctuation while you're at it? I think you see the senselessness of that.

Take care,

Jason
prof1515 is offline   Reply With Quote
Old 04-07-2006, 08:04 PM   #9
NotL337
Member
 
Join Date: Apr 2006
Posts: 42
NotL337 is on a distinguished road
NotL337 is offline   Reply With Quote
Old 04-07-2006, 10:56 PM   #10
Davairus
Member
 
Join Date: Jun 2002
Posts: 159
Davairus is an unknown quantity at this point
Did you ever dig up that idea about proximity links between objects? It might help you make your expanded parser more important.

e.g.'s
monkey IN box
box UNDER table
table ON closet
closet IN FRONT OF door
->
A monkey is in a box under a table, on a closet in front of the door.

"open the door"
Move all that stuff first!

Would be a fun puzzle having to find the way to get all that done in one line (if you can't do it in one command, the monkey puts everything back).. its like lockpicking..
Davairus is offline   Reply With Quote
Old 04-08-2006, 04:38 AM   #11
Hadoryu
Member
 
Join Date: Jan 2006
Posts: 102
Hadoryu is on a distinguished road
This is pretty interesting. In my experience, if your commands are closer to the general language it'll be much easier for players to get into the game. You'll be eliminating a somewhat significant first hurdle. Having to read through HELP BASIC_COMMANDS when they're two pages long on a new MUD is something very un-fun to have to do and if you could just go ahead and type "get the sword from the backpack" it'd make things a lot easier on new players. There's no reason to not include some sort of condensed syntax in there as well for advanced players, of course.

Furthermore, you could make things easier by giving hints if a player enters a wrong command, ala Google's "Did you mean 'get the bardiche from the weapon rack'?"

Having multiple ways to tell the MUD something is a plus for players as well, since they can stick to whatever syntax works for them. I've found I much prefer inputting commands that make some general sense and I'll always prefer that to typing ID numbers (which mind you are still incredibly useful).
Hadoryu is offline   Reply With Quote
Old 04-08-2006, 01:58 PM   #12
xotl
New Member
 
Join Date: Apr 2002
Posts: 26
xotl is on a distinguished road
We lean towards supporting natural english command syntax at AL, though we do support short syntax as well so long as it isn't ambiguous. We have a simple NLP system with verbs where each command must have language option functions put in manually if they make sense, and the parser takes care of the generic work. Basically, we try to take a lot of the irritating guesswork out of learning new command syntax.

Here are some examples -- note that objects have a position in the room, so some syntax involves position:

light unlit thing with lit thing

skin nearest unskinned corpse

put held sword in basket

put held on table (for all held)

put all in container

look at second man's bracer

hold sword in right hand

hold the sword in my right hand

press the red sigil on the amulet

put the silver knife in my backpack

look at the swords in my pack

look sword 2

- Xotl
xotl is offline   Reply With Quote
Old 04-09-2006, 06:22 AM   #13
Drealoth
Member
 
Join Date: Jan 2006
Location: Japan
Posts: 74
Drealoth is on a distinguished road
Send a message via MSN to Drealoth
I think you're missing the point here. The idea is to make it verbose enough that the player doesn't have to worry about getting bogged down in the syntax and can accomplish their goals without having to refer to help files.

Suppose that there are three leather bags. In bag number two, there are two cool swords, the second of which you want to get.

In most muds you end up typing something like get 2.'cool sword' 3.'leather bag'. However, suppose a player doesn't know this - it's not exactly the most intuitive expression out there. They try get second cool sword from third leather bag. That fails on a lot of muds, and I don't think it should. The interface should be intuitive. That doesn't mean that get 2.'cool sword' 3.'leather bag' won't work either - in fact, as I said in an implimentation I would probably pass a hint saying that "You can condense this command to <blah>." My philosphy is verbosity as an option for the player, not a necessity. Or suppose you want to get all of the cool swords from the bag, but you don't want to get the uncool swords or the "sorta cool sword" - is that even possible on most muds in a single command?

In addition, verbosity can allow for more complex commands, giving the player even more freedom to interact with the world in the way that they see fit. I don't know of any mud parsers that would let you specify multiple verbs within a command, or that let you get more than one of a different type of object.


EDIT: So... Ikonboard doesn't support nested quote tags apparently...
Drealoth is offline   Reply With Quote
Old 04-09-2006, 02:04 PM   #14
aegora
New Member
 
Join Date: Aug 2005
Location: VAncouver, BC, CAnada
Posts: 23
aegora is on a distinguished road
Post

aegora is offline   Reply With Quote
Old 04-09-2006, 08:15 PM   #15
Smith
Member
 
Join Date: Dec 2005
Posts: 33
Smith is on a distinguished road
I would argue against NLP on the principle of least supprise.
English has ambiguities, and NLP has a tendency to just choose one of those ambiguous overloads for you. The end result, you type in some command which you think is going to do one harmless thing, and could end up doing something dangerous, which gets you or others killed.
Having extended syntaxes for commands to explicitly handle all the different variants your mud needs, potentially with several variants for performing the same task is well and good. But full NLP is a dangerous ground.
Smith is offline   Reply With Quote
Old 04-27-2006, 02:08 PM   #16
DarkFireGames
New Member
 
Join Date: Apr 2006
Posts: 1
DarkFireGames is on a distinguished road
Our command parser actually allows "get the sword in my pouch" as well as "get sword pouch" as well as "ge sw pou"(or any abbreviation of that). It's good to see we're going somewhere not all MUDs have gone. We also ahve an accoutn system, though I see that is not something everyone agrees on.
DarkFireGames is offline   Reply With Quote
Reply


Thread Tools


Features of a MUD command parser. - Similar Threads
Thread Thread Starter Forum Replies Last Post
MUD Features somied Advanced MUD Concepts 23 02-05-2006 01:23 PM
command processor Dubthach MUD Coding 4 10-26-2004 11:01 PM
Jog Command Jaegar MUD Coding 4 04-09-2004 04:41 AM
Switch command Verboden Faction MUD Coding 8 05-15-2003 09:31 PM
Chown Command Verboden Faction MUD Coding 9 03-23-2003 07:12 PM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 03:50 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2022