I’ve been thinking about doing a interactive fiction game with Xojo, OK I know there is already engines out there, Tads, Adrift etc , but I want to add graphics as well and these engines aren’t that nice at handling such things
What would be the best way to handle the text input?
usually , say there is an apple in the scene, that you can pick up, look at, use… usually these game you can “Pick up the apple” or “Pickup apple” or Take the apple" etc which means the same thing, likewise go west or west or w
I think you will have to use some grammar checking probably by setting up a dictionary with verbs, nouns and all the rest and then analyze the user input to find out what is subject, object and predicate by their appearance in the sentence and the position compared to propositions. In your example the use of “pick (up)” or “take” would indicate that if only one noun is present after the verb this should be the object of the sentence.
Uh, how much I still remember my victory having found out “tickle chin with feather” was the clue to a riddle in what was that? Dallas Quest?
YOu are going to need to deal with lexical analysis to determine nouns, verbs, adjectives (is is the blue sword or the red one?)
and be able to rearrange the words to meet a predetermined structure. “Use the Red Sword to kill the ugly dwarf” might have to become “KILL DWARF WITH RED SWORD”… I toyed with this a number of times over the years… and never got a lexical parser I liked… especially since it needs to conform to the syntax AND the language… English has one structure, Spanish another etc.
The earliest of these games used a fixed two word syntax
TAKE CUP
EAT BISCUIT
GO NORTH
And you could more or less assume that the first word was the verb, the second was the object/direction/ subject
You throw away words like THE, A etc
Then it can be extended by having a second phrase… the WITH clause
Thats identified by having a sentence containing WITH and the subject of the WITH is the word that follows
Your objects have properties.
They may be visible, carryable, edible, poisonous, a weapon, a source of light, and so on.
Your inventory is like a room into which things can be placed, but which you cant enter by moving around.
This takes me back to writing games like this on the BBC Model B. (Sigh)
Hi Jeff, yes my first encounter was on the Amstrad with the green screen and the Hobbit game, my first try at writing something(apart from on a ZX81) was on a Intel P60 with Tads… anyway the goal is something like the Hobbit game or a Make Your Own Adventure which is little bit easier which have come popular again.
If it became a serious attempt I don’t think “Take Hammer” would cut it with a IF fan, personally I’d rather be able to type just that rather than a short essay
I’m trying a few things and I’ll let you know how I get on