Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Text Mode under Linux  (Read 1704 times)

datalurkur

  • Escaped Lunatic
    • View Profile
Text Mode under Linux
« on: May 18, 2010, 04:38:02 pm »

Has anyone fiddled with text mode under linux?  I'm having some difficulties coercing DF into producing proper output.  I'm all but certain that it is an issue with the character encoding.  If I'm not mistaken, DF uses CP437.  I can't seem to discover the correct way to set this up.

First, a little context:
I'm running archlinux, and have a 32-bit chroot set up specifically for DF (since DF doesn't play nicely with x86_64).
Currently, I'm logged into my machine remotely via SSH.

Obviously the problem is that my locale is set up to be UTF-8, but every attempt I have made to switch to CP437 finds me without the ability to use the keyboard.  Has anyone had experience with this/figured out some clever way of doing things?  I've messed with DFTerm, but basically once I'm connected to the dfterm server I'm met with the same issues.

EDIT: I have discovered the solution!  It seems the problem was not with locales, but with libncurses and Archlinux.  I found the solution in this thread, for 40d18:
http://www.bay12forums.com/smf/index.php?topic=50084.msg1050876#msg1050876
tl;dr - To solve this, make a symlink called libncurses.so.5 that points to libncursesw.so (in /usr/lib)

EDIT: I now have an issue where many characters (menu items, pieces of terrain) are printed the same color as the background.

EDIT: The issue I encountered with characters printing the same color as the background was related to the terminal client I was using to SSH into my home machine.  Now that graphics are looking as they should, I'm having unacceptable issues with keyboard input being ignored/crashing the game and have essentially given up on DF in text mode for the time being.  I'll keep my eyes/ears open and post any further information I discover here and possibly on the DF subreddit.  Thanks for everyone who helped out.
« Last Edit: May 19, 2010, 02:01:43 pm by datalurkur »
Logged

trousermonkey

  • Bay Watcher
    • View Profile
    • http://trousermonkey.dyndns.org
Re: Text Mode under Linux
« Reply #1 on: May 18, 2010, 09:29:57 pm »

I haven't had much luck with 31.04 in text mode (using 10.04 kubuntu).  My efforts to force it to use libncursesw didn't seem to help. 

I'm hoping someone more knowledgeable than me will write up a howto on the wiki - or for toady to acknowledge it as a render bug. 

I did a cursory search on the bug tracker but didn't see anything - I'm not confident my system isn't messed up. 
Logged

Scarpa

  • Bay Watcher
    • View Profile
Re: Text Mode under Linux
« Reply #2 on: May 18, 2010, 10:19:37 pm »

The old 40d19 thread had some information on it...
Logged

jonharson

  • Bay Watcher
    • View Profile
Re: Text Mode under Linux
« Reply #3 on: May 19, 2010, 05:56:13 am »

ncurse is disabled at a define level in the renderer source code, a rebuild would be necessary for it to be usable.
Logged

datalurkur

  • Escaped Lunatic
    • View Profile
Re: Text Mode under Linux
« Reply #4 on: May 19, 2010, 09:58:44 am »

The old 40d19 thread had some information on it...
I didn't find anything in the 40d19 thread, but I did find a solution thanks to your post, good sir!  OP edited with soln.
Logged

datalurkur

  • Escaped Lunatic
    • View Profile
Re: Text Mode under Linux
« Reply #5 on: May 19, 2010, 12:53:44 pm »

I'm still having one small problem -
Many of the characters are black.  For example, all of the menu items (unless highlighted) blend in with DF's black background, making it very painful to deal with the menu system.   A good number of terrain characters also don't show up unless highlighted as well.
Logged

trousermonkey

  • Bay Watcher
    • View Profile
    • http://trousermonkey.dyndns.org
Re: Text Mode under Linux
« Reply #6 on: May 19, 2010, 01:45:17 pm »

Unfortunately this still doesn't work for me.  I seem to remember linking the ncurses library to the ncursesw library was enough to get 40d working in text mode on my old kubuntu 9.04 install but it isn't working on my 10.04 install.

Spoiler (click to show/hide)

Here's a screenshot of what my embark wagon and dwarves look like.  It looks like all animals, items, and dwarves are represented by the letter 'M'.  The window borders are messed up as well.

I've double checked I can view a UTF-8 demo http://www.w3.org/2001/06/utf-8-test/UTF-8-demo.html in konsole (both inside and outside my terminal multiplexer) and I've even gone as far as create some files named with unicode characters and verify I can view them in my curses based file manager.

I've also double checked I've got the following environment variables set:

export LANG=en_US.utf-8
export LC_ALL=en_US.utf-8

So everything here suggests the game is at fault - but if datalurkur can get it to work on Arch I must have something configured improperly...
Logged

datalurkur

  • Escaped Lunatic
    • View Profile
Re: Text Mode under Linux
« Reply #7 on: May 19, 2010, 01:59:15 pm »

So, I'm sitting at my machine physically now (as opposed to being SSH-ed in previously), and the problem with characters being display black is gone.  That problem is obviously related to the terminal I'm using to ssh in, so that's solved easily enough via terminal emulation or somesuch unix magic.

However!  The keyboard input is exceptionally wanky.  Sometimes DF will get into a state where it stops registering the input of certain characters (escape is an especially annoying one), to the point that it is unplayable.  I've given up at this point, until some more serious effort is devoted to making text mode what it should be. 

It took a gargantuan effort just to get things displaying properly, and I'm less and less inclined to fiddle with it the further I get.  Still, I'll keep my ears open to see if anyone has had similar problems or if there are easy solutions.  In the meantime, the best we can do is document our efforts and hope it will benefit the community.
Logged