Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?  (Read 3700 times)

mrpoopyface

  • Bay Watcher
    • View Profile
40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« on: February 24, 2010, 02:59:29 pm »

One of the things I got super excited about in the new 40d18 build was the addition of the TEXT/ncurses mode for Linux, which opens up a lot of possibilities for us Linux users. The most mind-blowing example being that, with DF/Text+screen+ssh+ssh app for Android, I can in theory play Dwarf Fortress ON MY PHONE.

I have in fact gotten this supply chain working. The only problem is that my distro (Arch) appears to be too progressive-minded in its support of Unicode instead of the old Code Page 437 extended-ascii character set that DF uses. What should be lines, statues, and happy dorfs are jumbles of regular characters along the lines of ~B~M. This makes it less than playable but oh so tantalizingly close.

I've tried to do some digging on the subject (setfont, locales, etc.), but now my brain hurts from trying to understand the arcane magic going on at that low level and I still haven't had any luck. Do any of you have TEXT mode showing the proper glyphs? Do you know enough about the console (or xterm) font settings that you can tell me what settings you have and how I might be able to duplicate them? If not, what distro are you using? It might be worth switching for.
Logged

Dedas

  • Bay Watcher
  • The dwarf next door
    • View Profile
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #1 on: February 24, 2010, 05:06:20 pm »

This sounds so cool! Wish I could try it but I don't own a smartphone that is capable. Wish I had the Nokia N900 (Maemo... true open source... drool)
Logged

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #2 on: February 24, 2010, 06:06:17 pm »

DF in facts outputs utf-8, not cp437. :P

Try it with urxvt. That's what I use; works great.
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

mrpoopyface

  • Bay Watcher
    • View Profile
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #3 on: March 01, 2010, 01:15:16 pm »

Baughn, thanks for replying. If df uses utf-8, then this is even weirder. Since I've spotten in another thread that you use the Arch distro too, we should have pretty much the same setup, yet I'm still experiencing the same problem, even with urxvt. My locale and LANG env variable are both set to en_US.UTF-8, and this uft-8 demo text file displays just fine. You can see the smiley and box-drawing characters at the bottom of the page. But still in DF I get the letter M in the correct color for dwarfs and most items, and sequences like -b~@M-" for line-drawing characters.

Do you have any ideas for where our configurations might be diverging, if not locale or LANG? Could it be a problem with ncurses?
Logged

bombcar

  • Bay Watcher
    • View Profile
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #4 on: March 01, 2010, 01:40:14 pm »

You need to extract -HEAD over the current Linux tarball; there was a bug that's only fixed in HEAD.
Logged

mrpoopyface

  • Bay Watcher
    • View Profile
FIXED
« Reply #5 on: March 01, 2010, 02:05:37 pm »

I've got it!

I found this thread in the Arch bug tracker that mentioned that some programs are linking to the version of ncurses without widechar support. I followed this suggestion of make libncurses.so.5 a link to libncursesw.so, and it works. The intro movie is still borked, but the gameplay works great, and at a much much faster framerate for me. This is freaking fantastic! Thanks toady and Baughn!

bombcar, thanks for the suggestion. I'll try that later in hopes that it fixes the solution more permanently in a way that doesn't involve screwing with my /usr/lib symlinks, but for now I'm too excited about this to not go play for a while.
Logged

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #6 on: March 02, 2010, 05:25:45 pm »

So, could someone give or link a summary or step--by-step guide on how to do this from Ubuntu by someone who is new to linux? no hurry thou, I wont need it until the new version is released.
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

Bluebell392

  • Escaped Lunatic
    • View Profile
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #7 on: March 02, 2010, 09:43:27 pm »

Simply run this command from a terminal: sudo ln -sf /usr/lib/libncursesw.so /usr/lib/libncurses.so.5
Logged

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #8 on: March 04, 2010, 02:37:38 pm »

There must be a misunderstanding somewhere, because I'm pretty sure it needs to be at least two steps, one on the stationary computer and one on the phone.
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

mrpoopyface

  • Bay Watcher
    • View Profile
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #9 on: March 04, 2010, 03:38:33 pm »

Ah I think there was a misunderstanding. Bluebell posted the command line for the Arch linux ncurses fix, but you were talking about a step-by-step guide to playing via phone. That's a little more involved, and it's more about having a working SSH setup and a way through your firewall than it is about DF. But the basic idea is now that you can run DF from the command line, you can play it from anywhere where you have SSH/command line access to your linux pc. And there's a good ssh app for Android phones called Connectbot. Which is what I use. I'll try to type out a more involved step-by-step when I have more time, but in the meantime there should be a million ssh tutorials out there. Give one of those a shot. Once you get SSH going, running DF is the easy part. Also check out GNU Screen, which lets you detach and reattach running console sessions, so you can connect and reconnect to your game anytime, and it won't be killed if you lose your connection.
Logged

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #10 on: March 04, 2010, 03:41:37 pm »

oh, ok. I hope I'll rememb er that once I need it, thanks!
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

trousermonkey

  • Bay Watcher
    • View Profile
    • http://trousermonkey.dyndns.org
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #11 on: March 04, 2010, 10:45:34 pm »

Just in case anyone's interested, I've got a n900 and I've gotten it partially working. 

* You need to change the font size in the x terminal app (monospace 12 seemed to work)
* I had to do poopy's trick of making libncurses.so.5 a link to libncursesw.so (so utf-8 characters showed up as something other than '-M-0'

The terminal can't handle utf-8.  Trying to display the utf-8 demo file with less tells me it thinks it a binary file. 

In game, things look almost ok, except every non-standard character is displayed as a '?' This includes boulders and dwarves.  Bit difficult to play...

I've played around with my locale settings (http://www.madboa.com/geek/utf8/) but haven't had any luck. 


Oh, and there's a bug with the x terminal's enter keycode, you can work around this by using ctrl+j or putting the following shortcut in your .screerc:

# Fix n900 keyboard
bindkey -a -k fe stuff ^M

« Last Edit: March 04, 2010, 11:24:51 pm by trousermonkey »
Logged

Mel_Vixen

  • Bay Watcher
  • Hobby: accidently thread derailment
    • View Profile
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #12 on: March 05, 2010, 12:18:38 am »

hmmmmm might be nice option for some adventuring - if adv gets a proper repair. Anyway what i would like to see would be a phone friendly tileset (Gah its late) a receiving app that replaces some of the tiles back into a graphic tileset. For full graphics on a Android-phone or the Iphone (i guess) you would need to transport much more data - data which df wouldnt hand out as long you dont do a memory hack.

Also with ssh a see a faint glimpse of multiplayer adv-mode on the not existing horizon XD.
Logged
[sarcasm] You know what? I love grammar Nazis! They give me that warm and fuzzy feeling. I am so ashamed of my bad english and that my first language is German. [/sarcasm]

Proud to be a Furry.

Dabi

  • Bay Watcher
    • View Profile
Re: 40d18 Linux TEXT mode. utf8 vs cp437. Any luck? Settings?
« Reply #13 on: March 05, 2010, 06:40:36 am »

hmmmmm might be nice option for some adventuring - if adv gets a proper repair. Anyway what i would like to see would be a phone friendly tileset (Gah its late) a receiving app that replaces some of the tiles back into a graphic tileset. For full graphics on a Android-phone or the Iphone (i guess) you would need to transport much more data - data which df wouldnt hand out as long you dont do a memory hack.

Also with ssh a see a faint glimpse of multiplayer adv-mode on the not existing horizon XD.
Sorry to sidetrack, but I had the same idea for a while where i thought just sending information on what is where, and not streaming the actual screen would make DF multiplayer possible
Example:
I connect to my friend, he connects to me.
It starts sending out what is currently displayed on my screen to him. He can control it from say his PC/phone and play while I say watch or I play while he watches.


I've been thinking about this far before you came with this topic :P but it does seem possible...and not hard either...I can imagine this happening sometime in the future  ;D(Third party)
Logged
If a elf dies in a forest and only dwarfs are around to see it does anyone care?