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#
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 #ifdef
s here and there.
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).
You will probably want to look into the PDCurses library ... it supports a number of different platforms.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With