View Full Version: Text Adventure

lassie >>Discussions >>Text Adventure


<< Prev | Next >>

fatbuoy1- 10-06-2007
Text Adventure
I may be needing to create a quick text adventure (original Hitchhikers Guide style) and am wondering how I should go about it. It would be part of a larger website, so would it be easier to build it in LASSIE, or would it be simple enough to build using just Actionscript in Flash (Bearing in mind i'v never used Actionscript for more than making navigation buttons on websites) so I could easier incorporate it into the site? It wouldn't be very big, probably involving no more than ten inputs to complete it. Any ideas?

SeanCyrusTowel- 10-06-2007

Hmmmmm..... My choice would be C++ (I think they used that for the original Hitchhikers game), however, since you want it on a website, Java (which they use now to recreate the hitchhikers game) might be best. However, that requires quite a bit of programming knowledge in either language.... Don't know much about actionscript myself, but I'm sure it's possible.

fatbuoy1- 10-07-2007

Yeah I wasn't wanting to go that far... I guess I could do it in Actionscript the same way i'd do a password protected page, if they input the right word they progress... but is there any better way?

bigmac- 10-08-2007

I tried to reply to this last night but lost Internet. Mmmph. So, my short answer: ActionScript is easy compared to C++ or Java and is the only of the three with a good web deployment method. So I'd say to go the AS route. I don't know exactly how text-based adventures work... you literally just enter text and get a text response? If so, yes, you could do it a lot like you would a password.... but with some flair. I'd make each action scenario a frame on a timeline. Label each frame and place a user input field on each for collecting input. Then do this: var userInput:String = input_txt.text; var actions:Object = { enterDoor:["open door", "enter door", "walk through door"], getTreasure:["take treasure", "pick up treasure", "steal treasure"] } var validInput:Boolean = false; for (var j:String in actions) { // loop through action nodes for (var k:Number=0; k<actions[j].length; k++) { //loop through each action's array of valid responses if (userInput == validResponses[k]) { //if valid response was found, flag and break loop validInput = true; break; } } if (validInput) { //if a valid input was found, go to the action's frame gotoAndStop(j); return; } } That "actions" object is keyed with frame labels from the timeline. Each action key has an array of valid responses associated with it. Then there's a double-loop. The first loops through all action keys, the second loops through the responses for each key. If the user's input matches a valid response, then the timeline jumps to the frame of the associated action. SO, in the above example... if the user were to enter "take treasure", the timeline would jump to a timeline frame called "getTreasure". Make sense?

SeanCyrusTowel- 10-08-2007

and if the user doesn't enter the proper command? you just stay on that page, with the same message?.... that's not really in the spirit of a text adventure. You need to know "There is no screwdriver here" and such..... but that is just MY opinion

fatbuoy1- 10-08-2007

And that was your SHORT answer? :P Thanks very much Greg. Its actually for a uni project we're doing on vernacular language (slang). In Northern Ireland people's accents and slang vary so much that if you go from one town to another, 10 miles away, the people talk completely different. The project is to design some sort of large-scale poster (20mx4m) to promote vernacular language... and create a website to go alongside it. So I thought the website could have a nice feature where people can navigate through it by typing slang commands (e.g. "hae a wee nosy" = have a look)... like in a text adventure. Its just a very vague concept at the moment, so havn't decided whether i'll use it or not. But thanks a lot Greg, i'll try it out anyway!

bigmac- 10-09-2007

and if the user doesn't enter the proper command? you just stay on that page, with the same message?.... that's not really in the spirit of a text adventure. You need to know "There is no screwdriver here" and such..... but that is just MY opinion Having never played a text-based adventure, I don't know the full logistics of them, or user experience. And come on... what do you want from me with a two minute code example?

bigmac- 10-09-2007

And that was your SHORT answer? :P Actually, this was my short answer paraphrasing what I'd try to post the night before: ActionScript is easy compared to C++ or Java and is the only of the three with a good web deployment method. So I'd say to go the AS route. I don't know exactly how text-based adventures work... you literally just enter text and get a text response? If so, yes, you could do it a lot like you would a password. But then I got an easy code idea and got carried away :D

SeanCyrusTowel- 10-09-2007

Best example for a text adventure: Take King's (Space, Peasants) Quest I II or III and subtract any actual pictures. You type a command based on the room, and you get a response to it. well, here.... if you need to try a text adventure.... gotta try the most classic of them all.... and probably one of the most hardest/in-depth of them all as well.... http://www.douglasadams.com/creations/infocomjava.html

NigeC- 10-25-2007

It maybe be worth looking at TADS http://www.tads.org/ to see how text adventures work, like AS etc it works on variables so a few people could probably figure out a AS option a graphical based adventure like the online HHGTTG is very possible in Lassie :D

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.