Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Dwarf Fortress over SSH/Telnet  (Read 20243 times)

FaeDine

  • Escaped Lunatic
    • View Profile
Dwarf Fortress over SSH/Telnet
« on: March 25, 2009, 10:29:11 pm »

Hey All,

I love Dwarf Fortress (only being playing a few days, but have been loving it thus far)!

I have a great PC at home and get good frame rates, but whenever I toss the game on older, crappier computers it goes to hell (which is perfectly understandable).

Does anyone know if it's possible to play this game over Telnet or SSH? It seems like it'd be an awesome candidate for it since it's all ASCII, and then you could login and get the benefits of a powerful PC. Man, I'd almost love to hijack some of my work computers and play from a 486...! :D

But anyways...

tl;dr - Dwarf Fortress? Possible over Telnet or SSH?
Logged

pokute

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #1 on: March 25, 2009, 10:49:20 pm »

it's not actually askie tho right?

i can definitely see someone playing it remotely though
Logged
If history wasn't written by the victors, humanity's failures would be self-evident.

FaeDine

  • Escaped Lunatic
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #2 on: March 25, 2009, 10:52:02 pm »

Errr, yeah.. Isn't is a modified ASCII character set or something? Even still, the amount of data going through would be minimal, and totally ideal.
Logged

JoRo

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #3 on: March 25, 2009, 10:53:32 pm »

BEHOLD: http://www.bay12games.com/forum/index.php?topic=22167.0
Unfortunately, it hasn't been updated since August.
Logged
You have been struck down.
The giant cave spider spits out your head.

Jifodus

  • Bay Watcher
  • Resident Lurker
    • View Profile
    • Dwarf Fortress Projects
Re: Dwarf Fortress over SSH/Telnet
« Reply #4 on: March 25, 2009, 10:59:12 pm »

BEHOLD: http://www.bay12games.com/forum/index.php?topic=22167.0
Unfortunately, it hasn't been updated since August.
Yes, but thanks to ANSI, I can't embed control characters into the stream, hence, no dwarves can be seen.

Btw, if you want to take a peek at the code, it may be found at http://75.127.91.201/phg/df/file/113e60aafa5f/DwarfFortress/TelnetFortress
Logged

Random832

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #5 on: March 26, 2009, 11:07:29 am »

BEHOLD: http://www.bay12games.com/forum/index.php?topic=22167.0
Unfortunately, it hasn't been updated since August.
Yes, but thanks to ANSI, I can't embed control characters into the stream, hence, no dwarves can be seen.

How hard would it be to implement a simple mapping table? Just an array of 256 characters - feed every value into an array lookup to get the character to send the client, " @%vGTT*OO*MFdH$><T!T$_T^v><L%V^ !\"#$%&'()*+,-./0123"etc - load it from a file, then if people want to use ANSI instead of the terminal font they could replace the mapping table to fix all the accented letters and line drawing characters (they'd have to make walls look like # but it's better than nothing)
Logged

FaeDine

  • Escaped Lunatic
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #6 on: March 26, 2009, 11:22:00 am »

T!T$

Sorry, I just can't unsee that  ;D

But yeah... It strikes me that it would be a relatively simple thing to do. Anyone that's used SSH at all can attest it would run quite well as well. The amount data going back and forth would be relatively small, and a lot of games like NetHack or Rogue have a similar function.

Of course, I could totally be speaking out of my ass here as my programming experience is pretty limited (VB6 for the win!..... sorry :P). I'm not asking anyone to do it, was just more curious if it's already been done, and I guess with the exception of JiFodus' headway into it, it hasn't.
Logged

Random832

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #7 on: March 26, 2009, 11:40:44 am »

T!T$

Sorry, I just can't unsee that  ;D


heh - that's for ↕‼¶§, which are a tree, the ! for being on fire, another tree, and the § mark ($ chosen for appearance)
Logged

Core Xii

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #8 on: March 26, 2009, 02:06:50 pm »

Dwarf Fortress is not ASCII, it's code page 437. Moreover, it's not a console application, it uses OpenGL for rendering.
Logged
Reality is for people who lack imagination

FaeDine

  • Escaped Lunatic
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #9 on: March 26, 2009, 02:13:09 pm »

Not being ASCII seems to be a bit nit-picky... However, the fact it's OpenGL and not console based certainly does change the matter quite a bit. If it was console based though, I probably wouldn't be asking this question  :D
Logged

Random832

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #10 on: March 26, 2009, 02:21:38 pm »

Moreover, it's not a console application, it uses OpenGL for rendering.

But that doesn't change the fact that it uses an 80x25 grid of character cells in only (other than dyes) 16 colors.

What about defining a new format/protocol instead of using telnet directly?
Logged

Core Xii

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #11 on: March 26, 2009, 03:29:23 pm »

But that doesn't change the fact that it uses an 80x25 grid of character cells in only (other than dyes) 16 colors.

What about defining a new format/protocol instead of using telnet directly?

Definitely. The point I'm making is that it's not as easy as the OP thinks... And given Toady's position I highly doubt we're going to see something like this supported anytime soon.
Logged
Reality is for people who lack imagination

Random832

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #12 on: March 26, 2009, 03:59:02 pm »

I've worked out a primitive binary protocol for forwarding console updates over the net. Anyone who wants to write something to scrape DF / inject key events and provide a server for this protocol; i'll write the client (for windows). It's a relatively general-purpose protocol, not DF-specific at all, though i need to add codepage support to be able to allow other thna 437


SETCURS - set where next char is going to be written
01 4F 18 [79, 24]
SETATTR - set attribute for writing
02 07 [0,7 = light gray on black]
PUTCHAR - write a byte at the current cursor position and advance the cursor [except at the end of the screen]
03 21 ["!"]
PUTXYCHAR - move the cursor and put a char there
04 4F 18 21
PUTACHR - set the attribute and put a char at the cursor
05 07 21
PUTSTR - repeat PUTCHAR until a zero byte is reached
06 21 21 21 00
PUTXYSTR
07 00 00 21 21 21 00 [!!! at the top left]
PUTXYASTR
08 00 00 07 21 21 21 00 [!!! in gray on black at top left]
PUTXYASTREX - Arguments are X, Y, character count, attribute buffer (attribute of each character followed by zero byte),
09 - CMD
00 00 - X, Y
07 - Seven chars
09 00 0B 00 0A 00 0E 00 0C 00 0D 00 09 00 - Attributes
52 41 49 4E 42 4F 57 - Characters
RAINBOW at top left
CHWINSZ - set window size. Widths other than 80 may break horribly. Clears the window.
0A 50 19 [80x25]
WHOLEFRAME - next 3*W*H bytes contain a full update of the screen. Attributes first (each attribute byte is to be followed by a zero byte), followed by characters. This format is optimized to allow Windows Console applications to quickly paint the update. Note for 80x25 this is 6000 bytes, so optimizing things down with some form of partial print would probably be ideal.
0B 07 00 07 00 ... 21 21 ...
KPLAIN - from client - sends a key code without modifiers
81 44 - d
KSHFT - sends key code with shift
82 44 - shift-D
KCTRL - sends key code with ctrl
83 44 - ctrl-D
KMOD - from client - sends a key code with modifiers
84 44 06 - Shift-Ctrl-d
« Last Edit: March 26, 2009, 04:34:27 pm by Random832 »
Logged

brainfire

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress over SSH/Telnet
« Reply #13 on: March 26, 2009, 05:47:18 pm »

X11 forwarding with SSH seems to work for me, although it's kind of laggy.

I was going to post this a couple of minutes ago but I accidentally shut down my desktop instead of my laptop (because I was still SSH'd in) :P
Logged
You can allow or stop your dwarves from eating these mushrooms, but it's entirely optional and doesn't turn Dwarf Fortress into Dwarf hookah-smoking pad.

Jifodus

  • Bay Watcher
  • Resident Lurker
    • View Profile
    • Dwarf Fortress Projects
Re: Dwarf Fortress over SSH/Telnet
« Reply #14 on: March 26, 2009, 11:58:17 pm »

How hard would it be to implement a simple mapping table? Just an array of 256 characters - feed every value into an array lookup to get the character to send the client, " @%vGTT*OO*MFdH$><T!T$_T^v><L%V^ !\"#$%&'()*+,-./0123"etc - load it from a file, then if people want to use ANSI instead of the terminal font they could replace the mapping table to fix all the accented letters and line drawing characters (they'd have to make walls look like # but it's better than nothing)
A mapping table wouldn't be hard to implement, however, it's kind of pointless because DF squeezes too much information into the various tiles and mapping more tiles on to already heavily used tiles will make the game much more interesting to play (currently all control codes are mapped to ' ').

Not being ASCII seems to be a bit nit-picky... However, the fact it's OpenGL and not console based certainly does change the matter quite a bit. If it was console based though, I probably wouldn't be asking this question  :D
ASCII really doesn't have anything to do with it.  However, the existance of my program definitely proves that even though it is OpenGL, it can be routed through telnet.

I've worked out a primitive binary protocol for forwarding console updates over the net. Anyone who wants to write something to scrape DF / inject key events and provide a server for this protocol; i'll write the client (for windows). It's a relatively general-purpose protocol, not DF-specific at all, though i need to add codepage support to be able to allow other thna 437

...
This kind of defeats the purpose of using Telnet, which at the time was to make DF more convenient to use under Unix.

Besides if the client you're writing is going to be Windows only, there's vtnt which is a terminal type that Windows Telnet client supports and it makes transfering updates much better.

Under Unix telnet terminals there's other terminal types available, most also support extended ANSI commands that the default Windows Telnet doesn't support that will allow me to send full CP437.

The only reason why it's limited to the basic ANSI is because I really only use the default telnet client windows comes with.  I also haven't taken the time to implement the other telnet modes.
Logged
Pages: [1] 2