Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any tips for console text game?

 
Kacper Szmigiel
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 12122
30
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kacper Szmigiel
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:Throw all your code away.


Done!

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
Greenhorn
Posts: 1
Android Linux Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic