So how to get an NPC act more realistic ind still get it easier?
So the main problem on the Dialogs is to figure out the correct keyword or keysentence.
In fact that people all over the world are playing that game it is quite difficult to get it sometimes. In natural spoken language someone will understand me even if I misstyped a key or changed the lexical order.
So it doesn\'t realy matter if I say:
1. \"Have you a quest?\"
2. \"Do you have a quest?\"
3. \"Do u have a kest?\"
In the sentence 3 a natural speaker would correct me and ask: \"Do you meant \'quest\'?\".
Ok .. one goal is that NPCs will give more detailed feedback as shown above. So if It sounds like the Keyword the NPC will reask the Player if he meant that.
So how it may be implemented? There is a function called SOUNDEX (see
http://en.wikipedia.org/wiki/Soundex) which is even included in MySQL. This function reduces words on there phonetic description into Soundex Tokens.
So as example the word \'Holy\' and \'Holly\' will both result in the Soundex Token \'H400\'
That does not mean that the player has to type in the Soundex! Instead the client will transform the typed dialog into a list of Soundex Tokens. That Soundex Tokens will be send to the server who will prrof it with the keywords in the Quest.
Player \'Holly\' -> Client \'H400\' -> Server \'H400\'=Soundex(\'Holy\')
Maybe a more detailed example:
1. Player typed in:
\'Allover I forgot,
Bjorid is realy in
need of some blue
dye\'
2. Client transforms that with Soundex into:
\'A416 I000 F623,
B263 I200 R400 I500
N300 O100 S500 B400
D000\'
.. where
XxXx may be the keywords ..
3. Server prechecks for the Soundex Keys
Found:
B263,
N300,
D0004. Server rechecks if also the regular Words in the sentence
Found:
Bjorid,
need,
dye5. Server goes into next Quest state
So what happens on misspelling?
1. Player typed in:
\'
Biorid realy
nied some blue
dye\'
2. Client transforms that with Soundex into:
\'
B263 R400
N300 S500 B400
D000\'
.. where
XxXx may again be the keywords ..
3. Server prechecks for the Soundex Keys
Found:
B263,
N300,
D0004. Server rechecks if also the regular Words in the sentence
Found:
dyeFailed:
Bjorid,
need5. Server let the NPC reask both words:
\'You mean
Bjorid need something?\'
6. Player may type the sentence correctly again
..
So what happens if even soundex failed?
1. Player typed in:
\'Allover I forgot I
need some blue\'
2. Client transforms that with Soundex into:
\'A416 I000 F623 I000
N300 S500 B400\'
.. where
XxXx may again be the keywords ..
3. Server prechecks for the Soundex Keys
Found:
N300Failed:
B263,
D0004. Server let the NPC reask including found Keyword:
\'Who
need what?\'
6. Player may type the sentence correctly again
..
So it\'s more like a dialog then a bubbling of monologues where the player hopes he might have typed the correct one.
Maybe to prevent to big data packages the client can remove the keywords like \'I=I000\' before sending the data to the server.
If the sentence is still to long the NPC might answer with \'Please don\'t use such complex sentences\' which in that case is also a good hint for the player to use more simple sentences!