We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › Text-Adventure game in Processing
Page Index Toggle Pages: 1
Text-Adventure game in Processing (Read 1951 times)
Text-Adventure game in Processing
Nov 15th, 2008, 7:28am
 
Hi there,

I am taking a beginning Processing course and for my final assignment, I am going to make a mini text-adventure game with PImages as the background images for each virtual room.

I just making a "proof of concept" and hardly a full game as I only have 3 weeks to come up with something and I am quite new to programming in general...
So, it would just be something with a few rooms and items in the inventory.

For reference, I have explored this Java based tutorial:
http://www.javacoffeebreak.com/text-adventure/index.html

However, I have not seen any documentation of creating a text-adventure game within the Processing environment itself...

Any suggestions of where to look or any ideas about how to make that JAVA tutorial even more Processing-friendly?

Thanks!
Jeremy
Re: Text-Adventure game in Processing
Reply #1 - Nov 17th, 2008, 12:45am
 
Yeesh. One of the pronounced limitations of Processing I found was its "single-state" nature. That is to say, that programs can only have SETUP and DRAW and that's it. Having branching event paths would be perhaps not-impossible but certainly difficult in Processing.

I guess you could write each Event as an Object and use Switch:Case to implement each possible scenario. I'm not sure how you'd "pause" for input, since noLoop() would cause draw to cease altogether.

Best of luck to you though, and if you DO in fact come up with something I'd be interested in seeing it.
Re: Text-Adventure game in Processing
Reply #2 - Nov 17th, 2008, 1:30am
 
Thanks for replying my post.

Hmmm..yes...I hope I am not getting into something too powerful for my limited coding abilities.

I was encouraged by that Java tutorial which I mentioned in my previous post...did you have a look at it?

The tutorial seemed to indicate how to make a text adventure possible by converting rooms, items and all that into classes and objects....  Hopefully, Processing's single-state nature will not get in the way too much from a Java based game to a Processing one.

Yes, I will need lots of luck...it will be a close call for sure...sigh!
Re: Text-Adventure game in Processing
Reply #3 - Nov 17th, 2008, 5:13am
 
sidpiz wrote on Nov 17th, 2008, 12:45am:
Yeesh. One of the pronounced limitations of Processing I found was its "single-state" nature. That is to say, that programs can only have SETUP and DRAW and that's it. Having branching event paths would be perhaps not-impossible but certainly difficult in Processing.

No, that's simply not true. Processing is no different than similar programming languages (e.g. Java or C++) in this regard. The fact that setup() and draw() are provided as mechanisms is a feature, not some sort of limitation.

As far as "programs can have only setup and draw and that's it", that's also completely false.
Re: Text-Adventure game in Processing
Reply #4 - Nov 17th, 2008, 5:42am
 
fry wrote on Nov 17th, 2008, 5:13am:
No, that's simply not true. Processing is no different than similar programming languages (e.g. Java or C++) in this regard. The fact that setup() and draw() are provided as mechanisms is a feature, not some sort of limitation.

As far as "programs can have only setup and draw and that's it", that's also completely false.



With great apologies to the Maker, but in my admittedly limited understanding of Processing, that has been the case for me. No Book or Example has explicitly demonstrated a "draw2" or otherwise multi-level draw stage that I know of. The only Other stage I know of is the "stop" portion for closing libraries.

I am plainly unsure of how you could have multiple-states or events in Processing.
Re: Text-Adventure game in Processing
Reply #5 - Nov 17th, 2008, 7:05am
 
Hello there Sidpiz and Fry,

First of all, thanks for taking part in this thread.

It is encouraging to note that Processing is as flexible as I thought it would be. It is also an honour to have one of the founders of Processing take part in this discussion.

For the record, the TA for my course also confirmed that what I read in the JAVA tutorial is, for the most part, translatable into the Processing environment.

I hope to begin coding some of this in a few days...first I gotta make my map for the structure of this mini-game.

If there are any suggestions as to the kinds of things I should keep in mind for making this text-adventure game in Processing, please let me know...maybe there is stuff I can practice on immediately to get familiar with the coding?

Cheers,
Jeremy
Re: Text-Adventure game in Processing
Reply #6 - Nov 26th, 2008, 1:30pm
 
Jot:

I know this is the Processing forum, and that you're doing this for a Processing class but I'll say that I think Processing is really a poor choice for a text adventure.  It matches the strengths of the genre with the weaknesses of the language, and vice-versa (using a programming language with rich possibilities for visualization in a medium which relies on ascii text and no visualization at all).

If you want to write a text adventure, there are some fantastic tools out there (Inform 7 comes to mind).  Of course that doesn't do much for you here.

For a class, I'd do a simplified variation on point-and-click adventures, no text parser at all; use a series of images for the backgrounds, small images for items the player can pick up or change, maybe (if you want to be really spiffy) a map pane which revealed rooms as you went, and then maybe, if you wanted to include inventory, an inventory pane showing what the player has picked up.  You could write a really simple engine almost as a state machine; there's plenty of literature out there for that.

And for a class... well, keep it really simple.  Game development is not nearly as easy as most people think it is, particularly if you want other people (the folks grading you) to play it.  They will try the damnedest things you never imagined and then wonder why they don't work.
Re: Text-Adventure game in Processing
Reply #7 - Nov 26th, 2008, 6:39pm
 
No regex advice? I'm dissappointed. One of the hardest things to do in a text adventure is going to be sorting through strings.

As for Processing being a bad choice for a text adventure? Well yes it is. Which is why if I saw a student doing it in a class, I would be impressed. It may not fit the bill exactly, but it forms the groundwork for some original research. I've already done some heavy string crunching in Flash, all I needed was my trusty regex.

These help:

http://www.regular-expressions.info/java.html

http://java.sun.com/docs/books/tutorial/essential/regex/intro.html

And here's a demo:

Code:
import java.util.regex.*;

String input = "i want to go east";

// Tell regex we're going to search for EAST or E
Pattern pattern = Pattern.compile("EAST|E", Pattern.CASE_INSENSITIVE);
// Tell regex we want to look in the string "input"
Matcher matcher = pattern.matcher(input);

println(matcher.find());


Regex will indeed soar beautifully over your head, but if you only try to do really basic stuff with it you should be fine.
Re: Text-Adventure game in Processing
Reply #8 - Nov 26th, 2008, 9:49pm
 
Hello again,

Thanks for continuing to reply to my thread.

I agree that technically, the text-adventure idea is not ideal for the Processing environment.  I must admit that I knew this before picking the text-adventure.  I chose to do a graphical text-adventure (1980s style with still PImages) partly because I like to write long strings of text rather than math formulas (my background is as a writer, not a coder).

The good news is that I am not expected to make a full adventure game for my final assignment since this course is still technically for beginners.  The gameplay will not be that fulfilling but will almost ummmm.. simulate the experience of gameplay.

Anyways, here is a link to my text summary about what I promised to do in class for the full context:

http://www.sfu.ca/~jot/JOT/finalproject/text/

I have also produced 2 map iterations of the "gameplay":

http://www.sfu.ca/~jot/JOT/finalproject/Maps/

So the hardest part for me now is trying to figure out and remember the coding syntax and the best (easiest) way to structure all these rooms, items and commands etc etc.

Anyways, I like the idea of the navigation/interaction panes mentioned by vputz although I doubt I will have enough time to create those panes since it is basically due in 2 weeks...sigh!

Thanks for the "Regular Expressions" for JAVA, st33d...yes, most of it soars over my head but I think I can see the usefulness of going that route.

Please continue to reply to this thread.  I do not feel so alone when other people appear to be at least interested in my (hopefully not futile) attempt.
Page Index Toggle Pages: 1