Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Any tips for console text game?

 
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.
 
lowercase baba
Posts: 12871
62
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?
 
Greenhorn
Posts: 1
Android Mac OS X Linux
  • 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
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic