File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Game Development and the fly likes Any tips for console text game? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "Any tips for console text game?" Watch "Any tips for console text game?" New topic

Any tips for console text game?

Kacper Szmigiel

Joined: Sep 18, 2012
Posts: 24
So... I'm writing some short text game in console. Why? I just line these games. I already have something about 100 lines of code (intro etc.) but I don't really know anything about making text games. Do you have any technical tips for me? Any special libraries? Some Java API libs that I should to know? Greetings, Kacper.
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11955

Here is my tip: Throw all your code away.

The most important thing to do when you write code is to know what you are doing BEFORE you write any code. Turn off the computer, sit down with pencil and paper, and write out what your code needs to do first. Then revise it, then revise it again.

Only after you've done all that should you CONSIDER writing a single line of code.

Then, only write 2-3 lines of code at a time. Make sure it works before you do anything else, then write 2-3 more.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Kacper Szmigiel

Joined: Sep 18, 2012
Posts: 24
fred rosenberger wrote:Throw all your code away.


fred rosenberger wrote:sit down with pencil and paper, and write out what your code needs to do first.

Working on this

Any other advices?
Rob Powell

Joined: Feb 01, 2010
Posts: 1

I wrote a simple text game for an old project, It first built a map using objects(nodes) mapped together. Once the map was built, the main character (You) would start off in a room and be able to list all the exits in the room and items too. Navigation was done by N,E,S,W to enter different rooms. The items could be picked up and used in different contexts, say if a monster entered the same room as you then you could attack it with something you are carrying, Just an idea. My game was based on finding a treasure in a tomb and avoiding the mummies roaming around. The mummies may or may not attack you if they enter the room. I used an AI element (JFuzzy Logic) to calculate damage points and attack points during fights, this also was used when reviving from battle too.

The biggest part is the design, once you have the full game (map, commands, items, character(s), objective) taught out and are happy with its ending(s) then you should implement the design in code. Try to program to abstraction so you can easily swap in new items or/and add new locations to the map.
The AI part is entirely up to you, it should be one of the final things implemented in your release.

Since the project I have a soft spot of text based games so if your game does go stream-line then please let us know
I agree. Here's the link:
subject: Any tips for console text game?
It's not a secret anymore!