Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: PRINT_MODE:TEXT  (Read 5864 times)

Lightman

  • Bay Watcher
  • The groboclones are looking for you.
    • View Profile
PRINT_MODE:TEXT
« on: August 03, 2014, 10:31:22 pm »

PuTTY & Dwarf Fortress
This is my experience with DF and PuTTY, using PRINT_MODE:TEXT.

I modified PuTTY to support the numeric keypad with DF.

TERM:Eterm-256color
Translation:UTF-8
Font:DF Tyrving (TTF)
Function Keys/Keypad:Xterm R6

Working:
  • Game-play
  • Numeric keypad
  • Arrow keys
  • Mouse, text-copying
Not working:
  • Mouse, game
  • Shift-arrow keys

Original Post
I'm really enjoying the text output mode (ncurses) and playing via Putty.  I'm using UTF-8 translation and it's working really well, for the most part.  However, there are a few things that aren't quite right, yet:

Shift-enter to select all of something doesn't work, for example, when building a wall.  Likewise, I can't do shift-arrow keys to skip around the map.  I am guessing the code being sent to the terminal is probably not what it should be.  I also want to look into using the mouse, which I believe is possible.

Anyone have experience with this?
« Last Edit: April 01, 2015, 03:03:43 am by Lightman »
Logged

King Mir

  • Bay Watcher
    • View Profile
Re: PRINT_MODE:TEXT
« Reply #1 on: August 03, 2014, 10:55:14 pm »

Shift+enter and similar are known not to work in text mode. You have to reassign those commands to something else. Likewise, if the mouse doesn't work, then you can't do anything to make it work (short of hacking DF).

Lightman

  • Bay Watcher
  • The groboclones are looking for you.
    • View Profile
Re: PRINT_MODE:TEXT
« Reply #2 on: August 03, 2014, 10:59:03 pm »

Ah, thanks.  Can you actually re-assign the shift-enter to select all the same material etc.?  I'll have to read up on ncurses and mouse input.
Logged

Lightman

  • Bay Watcher
  • The groboclones are looking for you.
    • View Profile
Re: PRINT_MODE:TEXT
« Reply #3 on: August 18, 2014, 04:30:58 pm »

If anyone is interested and wants to test SSH+DF, let me know (PM).  I have a server running and I'd be willing to open a port for a couple of people that want to try this and hopefully, help figure out the best setup.

If I can figure out what codes are supposed to be sent by shift-arrow keys, I can get that fixed.  Anyone?
Logged

eccentric

  • Bay Watcher
    • View Profile
Re: PRINT_MODE:TEXT
« Reply #4 on: August 19, 2014, 12:04:57 pm »

... I'll have to read up on ncurses and mouse input.
I would be interested in what you find/figure out. I've done some preliminary looking but haven't had time to do anything yet.
Logged

Lightman

  • Bay Watcher
  • The groboclones are looking for you.
    • View Profile
Re: PRINT_MODE:TEXT
« Reply #5 on: December 15, 2014, 02:32:26 am »

Dwarf Fortress doesn't seem to receive (presumably) multi-byte character codes.  Does anyone know if this is a bug?  Even with accurate codes being sent via SSH, DF interprets several key-combos as the same.
Logged

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: PRINT_MODE:TEXT
« Reply #6 on: December 16, 2014, 12:35:46 am »

The problem is not ncurses so much (You CAN capture mouse input to move a 1 character cursor around in ncurses mode on a local virtual terminal), the problem is that SSH is not intended to send mouse data. It emulates an old style terminal, like a VT-2000, over an encrypted data stream to prevent eavesdropping and system compromises. It supersedes the telnet protocol, which was created when the internet was still ARPANET, and when such considerations were not really given, since only authorized personnel was allowed on the terminal anyway-- Definitely before mice were a major fixture in computing.

To get mouse support, you need something like VNC, which then sends full graphics output in a compressed data stream.  I would be leery of giving out anonymous VNC access. (and likewise with SSH access.)

You would probably be better served with DFTerm3, which is a DFHack plugin. It claims to be able to permit remote control of a DF session over a special protocol using a remote host connected through a web browser. This limits the connection to the DF process itself (as opposed to SSH which gives terminal access to an account) or VNC (which gives a full remote desktop), and limits what connecting users are able to do. (Though I dont know how secure the protocol is, nor how secure DF itself is. It is possible hackers could exploit DFTerm3 in clever ways, since DFHack is able to modify system memory within the DF process, and thus could be used to do clever stack smashing if you know what you are doing. At the very least, I would suggest enabling execution protection features on the CPU. See your OS's documentation on how to do this.)


Logged

Lightman

  • Bay Watcher
  • The groboclones are looking for you.
    • View Profile
Re: PRINT_MODE:TEXT
« Reply #7 on: December 16, 2014, 06:49:43 am »

Hmm, okay.  That is interesting about mouse input.  However, I'd like to figure out the key-code issue, as described.

I remember having some issue with DFTerm3 but I may give it another shot.
Logged

ShadeJS

  • Bay Watcher
    • View Profile
Re: PRINT_MODE:TEXT
« Reply #8 on: December 16, 2014, 08:31:41 am »

To get mouse support, you need something like VNC, which then sends full graphics output in a compressed data stream.  I would be leery of giving out anonymous VNC access. (and likewise with SSH access.)

Just FYI, X forwarding with SSH and DF works fine. (ssh -X) I play DF this way via wifi on my home lan. The ssh command line options that might be of interest are -X to forward the X connection, -C to compress the connection, and -4 that specifies the use of ipv4 only (and generally seems to speed everything up). DF seems positively snappy when compared to even trivial GTK / Qt applications. I actually find it completely playable and less of a pain that PRINT_MODE:TEXT, and I'm not shy about using the command line. I haven't been quite brave enough to try that via an internet connection in the wild, but at home it's the only way I play.

So if you have a beefy home server (I do), and a bunch of decrepit things that can run XServers (I do) then this can be a great option as everything should just work as normal. There are free XServers for Windows that work with Putty, and OSX and any Linux tend to come bundled with XServers, so, uhh, try it if you want.
Logged

Lightman

  • Bay Watcher
  • The groboclones are looking for you.
    • View Profile
Re: PRINT_MODE:TEXT
« Reply #9 on: April 01, 2015, 03:02:45 am »

[...]
You would probably be better served with DFTerm3, which is a DFHack plugin. [...]

I am aware of it but I prefer a 'vanilla' solution that doesn't depend on a memory-hacking tool. Plus, there might be security issues, as you point out. SSH is less of a wild-card.

Just FYI, X forwarding with SSH and DF works fine. (ssh -X) I play DF this way via wifi on my home lan. The ssh command line options that might be of interest are -X to forward the X connection, -C to compress the connection, and -4 that specifies the use of ipv4 only (and generally seems to speed everything up). DF seems positively snappy when compared to even trivial GTK / Qt applications. I actually find it completely playable and less of a pain that PRINT_MODE:TEXT, and I'm not shy about using the command line. I haven't been quite brave enough to try that via an internet connection in the wild, but at home it's the only way I play.

So if you have a beefy home server (I do), and a bunch of decrepit things that can run XServers (I do) then this can be a great option as everything should just work as normal. There are free XServers for Windows that work with Putty, and OSX and any Linux tend to come bundled with XServers, so, uhh, try it if you want.

That's an interesting solution. Thanks for the input. I'd be curious about performance and such.

I patched PuTTY to fix issues with the numeric keypad but I'm still bothered by the shift-combo problem. I can always modified the key-combo and use Alt but I'd like to know why DF isn't handling multi-byte input.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: PRINT_MODE:TEXT
« Reply #10 on: April 03, 2015, 11:58:02 am »

Security wouldn't be much of an issue with DFTerm3 - the worst that could happen is a DF crash (unless you run DF with root/admin access, which you really shouldn't).
Of course, DFTerm3 hasn't actually been updated to work with DF 0.40.xx yet.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Lightman

  • Bay Watcher
  • The groboclones are looking for you.
    • View Profile
Re: PRINT_MODE:TEXT
« Reply #11 on: May 17, 2015, 04:42:58 pm »

Security wouldn't be much of an issue with DFTerm3 - the worst that could happen is a DF crash (unless you run DF with root/admin access, which you really shouldn't).
Of course, DFTerm3 hasn't actually been updated to work with DF 0.40.xx yet.

Ah, good to know.
Logged