7 Replies - 15888 Views - Last Post: 11 May 2011 - 12:00 PM Rate Topic: -----

#1 JakeAuditore  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-May 11

Text-Based Adventure Game

Posted 11 May 2011 - 06:09 AM

Heyo guys

I have a few months experience with Java, and lately I've been interested in text-based games. Specifically, I've been wanting to create an adventure.

Now, I have looked around everywhere I know of, just looking for basic framework of what I need so I can start the real planning phase, but I haven't found any good resources. So what I'm curious about; Where would I start with this? Again, it's just a text-based adventure game with all the standard features (items, rooms, enemies at some point, etc.).

Is This A Good Question/Topic? 0
  • +

Replies To: Text-Based Adventure Game

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8327
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Text-Based Adventure Game

Posted 11 May 2011 - 06:14 AM

Scanner scan = new Scanner(System.in); to read user input
System.out.println(); to output text
Was This Post Helpful? 0
  • +
  • -

#3 JakeAuditore  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-May 11

Re: Text-Based Adventure Game

Posted 11 May 2011 - 06:21 AM

View Postpbl, on 11 May 2011 - 08:14 AM, said:

Scanner scan = new Scanner(System.in); to read user input
System.out.println(); to output text



Erm.. I'm guessing that was sarcasm.

If you haven't noticed, it's quite a bit more than just outputting text.
Was This Post Helpful? 0
  • +
  • -

#4 japanir  Icon User is offline

  • jaVanir
  • member icon

Reputation: 1010
  • View blog
  • Posts: 3,025
  • Joined: 20-August 09

Re: Text-Based Adventure Game

Posted 11 May 2011 - 07:00 AM

I guess you already know that programming a game is not a simple task at all. You'll have to master all aspects of the language, in your case Java, in order to do it. OOP design, and maintaining a DataBase are just two examples for what you'll have to use in a text based game.
So, what exactly is the question? Are you looking for resources about game programming in general?
if yes, We have an excellent Game Programming forum here on DIC:
http://www.dreaminco...me-programming/
If you are looking for Help with Java, search the Tutorial and snippets section here on DIC:
http://www.dreaminco...java-tutorials/
Was This Post Helpful? 0
  • +
  • -

#5 JakeAuditore  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-May 11

Re: Text-Based Adventure Game

Posted 11 May 2011 - 07:43 AM

View Postjapanir, on 11 May 2011 - 09:00 AM, said:

I guess you already know that programming a game is not a simple task at all. You'll have to master all aspects of the language, in your case Java, in order to do it. OOP design, and maintaining a DataBase are just two examples for what you'll have to use in a text based game.
So, what exactly is the question? Are you looking for resources about game programming in general?
if yes, We have an excellent Game Programming forum here on DIC:
http://www.dreaminco...me-programming/
If you are looking for Help with Java, search the Tutorial and snippets section here on DIC:
http://www.dreaminco...java-tutorials/


I know it'll be a challenge. I'm just wanting to go farther than making the console solve simple math equations, and repeating my name over an over again. I've been a fan of text adventures (Zork) for awhile, so it seems like a good challenge to branch out into.

As for the question, it's not really java game programming in general. If, of course, you mean 'general' as "How do I make a game."
As I said before, I have a few months experience. What I want to know is where to start, and the basic stuff needed (if it's different than graphical games) to create a basic text game involving a few rooms and items, and expanding from there when I understand it a bit better.
Was This Post Helpful? 0
  • +
  • -

#6 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10442
  • View blog
  • Posts: 38,677
  • Joined: 27-December 08

Re: Text-Based Adventure Game

Posted 11 May 2011 - 09:36 AM

Start with Object-Oriented Programming. Can you design a class to model a Room, Player, Item, etc.?
Was This Post Helpful? 0
  • +
  • -

#7 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7624
  • View blog
  • Posts: 12,852
  • Joined: 19-March 11

Re: Text-Based Adventure Game

Posted 11 May 2011 - 10:57 AM

If you just want to design a game, meaning you just want to put the user behind a white house and make a world for them to explore, I believe the engine that Infocom used for driving all those games is out there, and you can write to it. Look around for the Z-machine. There's scads of people writing these, most of them of course not so very interesting.

If you want the coding project, I would take that model. You're actually writing an engine, and feeding it data. The engine will serve as the parser/interpreter, and you want to externalize all of your data.

I would start with the parser. Look at the zork interface and figure out what the language is you're trying to represent, and try to spell out the grammar of that language.

Some sentences:

north
take sword
kill thief with sword
put egg in bird


Are there other sentences? Yes, there are a few, I think, but not many.

You'll have to figure out how to represent the various lexical items - I'd suggest a lexicon external to the engine, but that's your decision.

You might want your parser to create "command" objects, which might be as simple as a bundle of "verb", "object" and "prepositional phrase", or they might be more complex - whatever you need to represent the language you want to work with. You could ask your parser to pass those objects to the game engine, which would process them, change its internal state, and present some text to the user, and then you're in a loop.

Actually, this sounds like fun. Maybe I'll write one, too.
Was This Post Helpful? 0
  • +
  • -

#8 JakeAuditore  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-May 11

Re: Text-Based Adventure Game

Posted 11 May 2011 - 12:00 PM

View Postmacosxnerd101, on 11 May 2011 - 11:36 AM, said:

Start with Object-Oriented Programming. Can you design a class to model a Room, Player, Item, etc.?


I'm not familiar with OOP. But that's the whole point of this project, learning as I go along, and becoming more proficient to expand the game. Thanks for the link, I'll be sure and get some tips from there, along with other resources.


jon.kiparsky said:

If you just want to design a game, meaning you just want to put the user behind a white house and make a world for them to explore, I believe the engine that Infocom used for driving all those games is out there, and you can write to it. Look around for the Z-machine. There's scads of people writing these, most of them of course not so very interesting.

If you want the coding project, I would take that model. You're actually writing an engine, and feeding it data. The engine will serve as the parser/interpreter, and you want to externalize all of your data.

I would start with the parser. Look at the zork interface and figure out what the language is you're trying to represent, and try to spell out the grammar of that language.

Some sentences:

north
take sword
kill thief with sword
put egg in bird


Are there other sentences? Yes, there are a few, I think, but not many.

You'll have to figure out how to represent the various lexical items - I'd suggest a lexicon external to the engine, but that's your decision.

You might want your parser to create "command" objects, which might be as simple as a bundle of "verb", "object" and "prepositional phrase", or they might be more complex - whatever you need to represent the language you want to work with. You could ask your parser to pass those objects to the game engine, which would process them, change its internal state, and present some text to the user, and then you're in a loop.

Actually, this sounds like fun. Maybe I'll write one, too.


Ok, great. Thanks for the help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1