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.
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
Joined: Sep 18, 2012
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.
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