Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terminal based RPG

Tags:

java

c++

terminal

I am looking into creating a terminal based RPG, what are the accepted and recommended methods for writing this in a cross platform way? I'm not sure what language I will be using yet, but i will need something with the functionality to move the curser and change the foreground color. Inspired by games like NetHack, this kind of control would be ideal, and I want to be able to write it so i can release it for windows and unix systems. I have used ncurses for C++ and i was wondering if there is something similar to this for use with cross platform projects.

Considering: Java C++ C C#

like image 426
lilroo Avatar asked Feb 16 '12 12:02

lilroo


3 Answers

I don't think there is a platform-independent alternative to ncurses. Your best bet would be to use ncurses for Unix systems and pdcurses for Windows. Since the APIs are largely the same, you hopefully won't end up with too much duplicated code - just a couple of #ifdefs here and there.

like image 182
sepp2k Avatar answered Sep 20 '22 01:09

sepp2k


If you're planning on doing terminal graphics, you can write your own wrapper functions for the VT-100 terminal escape codes, which can, among other things, change the foreground and background color and move the cursor. All you have to do is write the proper escape codes.

http://www.termsys.demon.co.uk/vtansi.htm

Also, Java is probably the simplest way to be cross-platform, although it does obviously require that th0e people running your game have the Java runtime installed. C and C++ can be quite cross-platform as well if you write your code carefully, particularly if you don't have too many external dependencies (which shouldn't be necessary for a text-based game).

like image 30
Lendrick Avatar answered Sep 19 '22 01:09

Lendrick


You will probably want to look into the PDCurses library ... it supports a number of different platforms.

like image 43
Jason Avatar answered Sep 20 '22 01:09

Jason