WARNING: CONTAINS REFERENCES TO PONYS- HONESTLY THEY ARE REALLY JUST PLACE HOLDERS FOR MY GAME.
you've been warned, this is also copy pasta from my development collaboration, but I need input from anyone that thinks that have anything to offer.
Some background info:
This game's engine is currently under development. It is a text based open world life simulation game and essentially I am trying to get feed back on how to parse player input, and to translate the commands, to actions that effect things in-game.
[QUOTE]This will dictate the command language the player will use to input and control their character. There will be 2 main scenarios we need to address, and if I miss anything, or you would like help elaborate. please contribute, but the more general and applicable, the better.
First situation, Direct Interaction, Character -> Something.
Should look something like this.
(Command/Verb/Action) + (Linking Verb i.e. at, to, for ect.) + (Target,object ect.)
I.E.
Talk to Twilight Sparkle.
Yell at Twilight Sparkle.
(In the above cases, the player will be prompted to input what they want to say next. This will be an obselete system eventually, as I plan on making it some thing where the player will be able to type in, "Hey Twilight Sparkle!" and that will be translated as, Yell "Hey" at Twilight Sparkle. But this is a much more complicated procedure, and for now, we just want to take baby steps to insure we build as immersive of a game as possible, and that way we can consider any other possibilities to this mechanism as well.)
Walk to Twilight Sparkle.
Wave at Twilight Sparkle.
These basic commands will be the norm early in the game's life. As we continue to complete and start expanding upon features, we will add more ways to initiate commands, and to even give more complex commands like,
Walk to Twilight Sparkle and give her a hug.
That will make it considerably more complicated, that little piece alone as it may require its own parser and translation system all together.
(This game's engine is 95% parsing and translating.)
But I am also considering making this more complicated 2 phase command, a 2 turn move as well.
So after the player's character was to approach Twilight Sparkle, (Which before the more complicated model is introduced, would be 1 turn anyways with the basic model.) then the world would simulate as well (giving Twilight Sparkle the time to do something, for some crazy random event to happen, for Derpy to come flying in baring muffins, who knows.) but then after the world stopped simulating, then the player would give Twilight a hug, she would give the player a response, and then the player would be prompted to enter another command.
I should also note now, if you haven't noticed, yes, as of now the game will not be real time- necessarily. The only difference is, is that the game is paused while the player is given time to enter a command, but to emulate a more realistic feel, that tense, suspenseful feeling of having to make a decisions in a timely manner and to keep up with the game's events, as if in a realtime game the player is only given so much time to decide before time will advance. (There will be a pause command or something to that effect to stop the timer. In the future when a gui is introduced it will be a menu, or a pause hotkey.) Because, it is a text based game, and you will need time to read the text, go afk, ect.
Secondly, there will be Indirect Interactions. Character -> Something -> Something
(Verb/Action/Command) + (Target/Object) + (Linking Verb into, with ect.) + (Target/Object)
I.E.
Slash Gilda with Sword
Cut Rope with Knife
Push Twilight Sparkle into Spike
Throw Tom into Mt. Doom
My brain just hurts thinking about these but the concept wont be too much more difficult than the direct interactions.
There are several problems here however, but firstly I would like to mention.
Yes, you could do, "Push Twilight Sparkle," without the into Spike part, but that would be considered a direct action.
Hence its structure if you compare it to the structure in the first example, minus the linking verb. The linking verb won't necessarily be required. If the user typed, "Talk Twilight Sparkle." The engine should be able to translate that as, Talk "to" Twilight Sparkle. But that wouldn't be very immersive now would it? With that command being not as eloquent as it could. But the player will be free to do as he chooses.
Like I said before, the player in the future will be able to skip the "Talk" command all together. So lets change the context of "Talk Twilight Sparkle" to an actual thing the player is commanding to say, as if interrogating best pony. "Talk, Twilight Sparkle!" In the dialogue itself, the player is making a command to Twilight Sparkle. So, also keep in mind the complexity of all this, as dialogue will need to run through the parsers and translators themselves. But also that, it being a command in the conversation, even though that linking verb isn't there, and it is rather proper (being dialogue and given the difference in context) the player is issuing a command for "Twilight Sparkle to Talk". Notice any similarities? Well, the engine will be able to translate that to (Depending on how Twilight Sparkle wants to respond to the player's command, considering all sorts of variables) "Talk to Twilight Sparkle to Talk". And there is our magic indirect formula again.
Look at it like this:
Here is our command:
(Basic model, before more advanced commands)
Talk to Twilight Sparkle (Direct command)
Say what?
"Talk, Twilight Sparkle!" But this, makes it an Indirect command!
Translated by engine as:
Talk to Twilight Sparkle to Talk
Player -> Twilight Sparkle -> Twilight Sparkle
Because the player is using Twilight Sparkle (By asking her to talk) to get Twilight Sparkle (Herself) to talk. (But depending on how Twilight Sparkle handles us asking her to talk, will effect the indirect interaction which is (what we want) for Twilight Sparkle(Herself) to talk.)
.
.
.
.
.
.
.
Logic.
If this deters you from wanting to code...
I don't blame you, it is a mind fuck sometimes.
But to make it easier.
Direct Interaction : Player uses himself to interact with something/one else
Indirect Interaction : Player uses something/one to interact with something else/one else(and as we learned, can even use someone to interact with themselves!)[/QUOTE]
[url]http://www.antlr.org/[/url]
I'd recommend using ANTLR for something like this, it's a powerful tool that can be used to produce language recognition softwar e. You'll need to understand a few things such as context free grammers and abstract syntax trees:
[url]http://en.wikipedia.org/wiki/Context-free_grammar[/url]
[url]http://en.wikipedia.org/wiki/Abstract_syntax_tree[/url]
I've not used this for a couple of years now but I remember using it to generate the front end of a compiler. By defining language rules you can get ANTLR to generate java source files that will let you accept natural language and produce meaningful output.
for example;
'Talk to Man'
[code]
COMMAND -> ACTION PREP ID;
ACTION -> "Talk" | "Throw" ID | "Look"
PREP -> "at" | "on" | "to"
ID -> "Man" | "Woman"
[/code]
Antlr can then produce the source files from a grammar like this (this is not a correct grammar), allowing you to then program functionality from a recognised sentence.
COMMAND -> ( ACTION="Talk", PREP="to", ID="Man")
[QUOTE=Mattz333;39482540][url]http://www.antlr.org/[/url]
I'd recommend using ANTLR for something like this, it's a powerful tool that can be used to produce language recognition softwar e. You'll need to understand a few things such as context free grammers and abstract syntax trees:
[url]http://en.wikipedia.org/wiki/Context-free_grammar[/url]
[url]http://en.wikipedia.org/wiki/Abstract_syntax_tree[/url]
I've not used this for a couple of years now but I remember using it to generate the front end of a compiler. By defining language rules you can get ANTLR to generate java source files that will let you accept natural language and produce meaningful output.
for example;
'Talk to Man'
[code]
COMMAND -> ACTION PREP ID;
ACTION -> "Talk" | "Throw" ID | "Look"
PREP -> "at" | "on" | "to"
ID -> "Man" | "Woman"
[/code]
Antlr can then produce the source files from a grammar like this (this is not a correct grammar), allowing you to then program functionality from a recognised sentence.
COMMAND -> ( ACTION="Talk", PREP="to", ID="Man")[/QUOTE]
Nice this might make everything a hundered times easier, I just wish there were reliable instructions on integrating it into eclipse.
There's also something called Parboiled you might like to look at. It might be easier for you.
[url]https://github.com/sirthias/parboiled/wiki[/url]
Sorry, you need to Log In to post a reply to this thread.