1
General Discussion / The NPC "language" algorithm
« on: April 28, 2007, 01:26:20 pm »
May I ask the nature of the NPC language alorithm in the game? I have some thoughts related to the topic, but I'd like to make sure they aren't already in place.
I.E.
I go to an NPC, and both "give me a quest", and "can I help you" seem to work, but "do you have a task for me" doesn't.
Ahh, well, I'll just say it here, to possibly save time.
My thought was rather than have individual words searched for, use synonym grouping instead. Each word could have a synonym grouping, they can fit into multiple groupings.
quest, job, task, work - the "task" synonym grouping.
Next words also have themes - example, certain words are related to "locations"
distance, place, location, where, to, from - "location" theme
where, what, when, who, why - "inquiry" theme, used for questions and indications
Finally, there's word type:
Shrine - noun
Walk - verb
Hoof - noun, verb (hoof is used as a verb some times)
Rather than looking at everything, it could simply look for certain themes/concepts in sentance, and then respon, allowing more flexible reading, and it would be more like a person in it's ability to understand malformed statements. Additionally, by having multiple requirements, a simple one-word chat would rarely have effect ("hello" would be ok, but "quest" would not).
Additionally, you could have some 'fuzz' in the logic - it is required to recognize a certain percent of words. For example, 50%, to allow a request.
Sample use:
"Give me a quest"
"Do you have a job for me?"
"Got Quest"
"Can I have a task?"
All have two relevant themes - a "taks" theme, and a "possession them:
Task: quest, job, task
Possesion: Give, have, got
"do" and "can" suggest asking, without them it seems more demanding, some NPCs might respond differently to different styles.
"I", "You", "Me", etc would be words that are known but flagged to ignore (later you could add logic to handle them). The word "a" can be flagged as ignore, also. "For", could be known and at least in part thought of as a possesive.
Now, I would put for that - Requires 1 task, 1 possesion, 75% recogintion.
"Task?" - lacks possesion
"Tell me what you need done" - If the log picked this up as an unkonwn sentance, you could add "task" as one of the themes for "done", "need" for a possesion, flag the other words as ignorable.
"Do you have any food for me" - a possesion but no task word.
I.E.
I go to an NPC, and both "give me a quest", and "can I help you" seem to work, but "do you have a task for me" doesn't.
Ahh, well, I'll just say it here, to possibly save time.
My thought was rather than have individual words searched for, use synonym grouping instead. Each word could have a synonym grouping, they can fit into multiple groupings.
quest, job, task, work - the "task" synonym grouping.
Next words also have themes - example, certain words are related to "locations"
distance, place, location, where, to, from - "location" theme
where, what, when, who, why - "inquiry" theme, used for questions and indications
Finally, there's word type:
Shrine - noun
Walk - verb
Hoof - noun, verb (hoof is used as a verb some times)
Rather than looking at everything, it could simply look for certain themes/concepts in sentance, and then respon, allowing more flexible reading, and it would be more like a person in it's ability to understand malformed statements. Additionally, by having multiple requirements, a simple one-word chat would rarely have effect ("hello" would be ok, but "quest" would not).
Additionally, you could have some 'fuzz' in the logic - it is required to recognize a certain percent of words. For example, 50%, to allow a request.
Sample use:
"Give me a quest"
"Do you have a job for me?"
"Got Quest"
"Can I have a task?"
All have two relevant themes - a "taks" theme, and a "possession them:
Task: quest, job, task
Possesion: Give, have, got
"do" and "can" suggest asking, without them it seems more demanding, some NPCs might respond differently to different styles.
"I", "You", "Me", etc would be words that are known but flagged to ignore (later you could add logic to handle them). The word "a" can be flagged as ignore, also. "For", could be known and at least in part thought of as a possesive.
Now, I would put for that - Requires 1 task, 1 possesion, 75% recogintion.
"Task?" - lacks possesion
"Tell me what you need done" - If the log picked this up as an unkonwn sentance, you could add "task" as one of the themes for "done", "need" for a possesion, flag the other words as ignorable.
"Do you have any food for me" - a possesion but no task word.