Page 1 of 1

Simple Text Adventure coding method?

Posted: Fri May 10, 2013 1:57 am
by Callan S.
I want to make a very, very simplistic choose your own adventure game - just text based (I really meant simple!). I'm still fairly new to unity.

I'm wondering if I should just use one scene and have the various locations stored to memory in a script? What's a neat way of doing that?

I've found some old code where I have a working button and can get text to the screen. I'm just wondering about what sort of method of storing text descriptions I aught to use?

Re: Simple Text Adventure coding method?

Posted: Fri May 10, 2013 3:37 am
by a_bertrand
Why use unity for text game? Sorry but doing it in PHP or JS would be for me easier... and would be playable without any plugin requirements.

Re: Simple Text Adventure coding method?

Posted: Fri May 10, 2013 4:12 am
by Callan S.
I can't host right now and will be using a games host. Also I'm not familair with JS.

Re: Simple Text Adventure coding method?

Posted: Fri May 10, 2013 5:04 am
by Jackolantern
Hey! This may actually be a use for HOOT, previously know as JsTinyTale, which I linked on the big PBBG engine list since I thought it seemed cool even though it wasn't a PBBG lol. It allows you to make Zork-like text-based adventure games. If you haven't played one before, Zork is much more simple than a MUD or a true RPG. You read text, make decisions and can move around, but about the only RPG-like thing is that you did have an inventory (mostly to hold puzzle key type items).

HOOT seems to be a bit bigger and more powerful than it was when it was JsTinyTale. It is now a very simple programming language, whereas it was simply a text parser before. On the front page it has a couple of pages worth of text, after reading which it says you are armed with enough knowledge to create a text-adventure game, so it must be quite simple (and it looks like it from what I saw, too). The site claims it will only take a few minutes to learn enough to make adventure games with it. Also, I believe that JsTinyTale would only work on the author's website, but now you can upload adventure games created in it anywhere. The site lets you type your adventure right into the page and try it out, although instructions are included for saving it and putting it up on your own site. This could work quite well for what you are wanting to do :)

Re: Simple Text Adventure coding method?

Posted: Fri May 10, 2013 7:18 am
by a_bertrand
Well not being familiar with JS is a good reason to pick it, as you will need it for most web related projects. Hosting can start with a free hosting btw... or even on your on PC until you go to public.

Re: Simple Text Adventure coding method?

Posted: Fri May 10, 2013 9:09 pm
by hallsofvallhalla
I will host it. Do you have a domain? If not I can get you a folder in one of my domains I am not really using at the moment, asciiwars.com, viraldawn.com, forsakensanctum.com, hallsofvallhalla.com, armageddonearth.com, thegamesguildstudios.com,hmm the rest are not really game related, or i might even can add a folder at indie-resource.com

Re: Simple Text Adventure coding method?

Posted: Sat May 11, 2013 4:16 am
by Callan S.
hallsofvallhalla wrote:I will host it. Do you have a domain? If not I can get you a folder in one of my domains I am not really using at the moment, asciiwars.com, viraldawn.com, forsakensanctum.com, hallsofvallhalla.com, armageddonearth.com, thegamesguildstudios.com,hmm the rest are not really game related, or i might even can add a folder at indie-resource.com
That would be cool, Halls! I was hoping to start this thing (or atleast do it myself) of people writing very, very small games in say an hour or two (or even just writing in new data/new levels to a previous game they've made), as an exercise in just working on games together and because of the very short release cycle, we can encourage and affect each others designs (instead of us working on large projects and because they are large, kinda going into suclusion to develop them).

I'll try and work up a unity thing to get an idea of what is needed to be hosted (and as I say, it'll be a very simple game - as I said in the previous thread, I'm hoping to have games that have a sort of level structure to them, starting at level 1). Though I'm wondering if I'll cave in and code in game maker (which I know better). But I hope to bang off something soon, hopefully with the source code available for others to use for level 1 games.

I don't have a domain name. I'm pretty clueless in regard to hosting!

Re: Simple Text Adventure coding method?

Posted: Mon May 13, 2013 6:14 am
by Kesstryl
hallsofvallhalla wrote:I will host it. Do you have a domain? If not I can get you a folder in one of my domains I am not really using at the moment, asciiwars.com, viraldawn.com, forsakensanctum.com, hallsofvallhalla.com, armageddonearth.com, thegamesguildstudios.com,hmm the rest are not really game related, or i might even can add a folder at indie-resource.com
Yep I can understand collecting domains for future projects, I have a couple myself. Gotta move myself to actually use them for soemthing.

Re: Simple Text Adventure coding method?

Posted: Mon May 13, 2013 1:44 pm
by hallsofvallhalla
haha no doubt, i have a ton but I can't bring myself to let them go.

Re: Simple Text Adventure coding method?

Posted: Tue May 14, 2013 8:56 am
by Callan S.
I found some code and adapted it to this

Code: Select all

    var arrayOfSituations : Situation [];
    
     
    class Situation
    {
    var description : String;
    
    var action_a : String;
    var action_b : String;
    var action_c : String;
    
    var result_a : String;
    var result_b : String;
    var result_c : String;
    
    var goto_a 	 : int=0;
    var goto_b	 : int=0;
    var goto_c	 : int=0;
    }
It's well laid out in the unity inspector.

Now I'd like to use something like action[0], action[1], etc. But I've tried a few ways and it doesn't like it. I'm not really familiar with the class method that was used in the original code snippet I adapted.

Any ideas?

Dunno how this post got to 2Dengines.