Discussion:
Nethack screen saver...
(too old to reply)
Adman
2009-03-23 14:15:31 UTC
Permalink
Hi all...

I thought it might be a fun little project to develop a Nethack screen
saver. After some brief google searches, I don't think any such thing
exists. So I figured I'd throw something together.

I figured there were two main ways to go about this. This first would
be to create an automated Nethack player (bot). This seemed like way
too much work and beyond my capacity.

The second, and much easier way might be to create a player that
played back ttyrec files, like those retrieved from nethack.alt.org,
simulating a real player playing.

So that is what I've done.

I've only tested it with nethack files from nethack.alt.org, but if
there are other games that use the same ttyrec recordings, it may be
able to play those back as well.

I'm putting the finishing touches on this little project, and am about
ready to release it to the general public (if anyone wants it), but
had a few favors to ask first:

1) Does anyone have any ttyrec files that they would be willing to
volunteer to be included? I've pulled some of my own from
nethack.alt.org, but they're kind of boring. It would be fun to get
some variety (like a file that contained Medusa's island, the castle,
Fort Ludious, various quest nemesis, etc).

2) I'd like to do a limited beta test. If someone out there is
familiar with Windows screensavers and wouldn't mind helping me out,
go ahead and email me. (Windows platforms only, please).

Finally, if your're at least a little suspicious of someone wanting to
install software on your computer, good for you! I wouldn't trust me,
either. The only thing I can say is that if I really wanted to
release some virus to the wild, probably the last thing I'd choose is
such a niche product. :) That said, the source code is available
(Visual Studio 2005 C#).

If you have any questions/comments, go ahead and respond here.

Adman
Ferrone
2009-03-23 22:13:18 UTC
Permalink
Post by Adman
Hi all...
I thought it might be a fun little project to develop a Nethack screen
saver.  After some brief google searches, I don't think any such thing
exists.  So I figured I'd throw something together.
I figured there were two main ways to go about this.  This first would
be to create an automated Nethack player (bot).  This seemed like way
too much work and beyond my capacity.
The second, and much easier way might be to create a player that
played back ttyrec files, like those retrieved from nethack.alt.org,
simulating a real player playing.
So that is what I've done.
I've only tested it with nethack files from nethack.alt.org, but if
there are other games that use the same ttyrec recordings, it may be
able to play those back as well.
I'm putting the finishing touches on this little project, and am about
ready to release it to the general public (if anyone wants it), but
1)  Does anyone have any ttyrec files that they would be willing to
volunteer to be included?  I've pulled some of my own from
nethack.alt.org, but they're kind of boring.  It would be fun to get
some variety (like a file that contained Medusa's island, the castle,
Fort Ludious, various quest nemesis, etc).
2)  I'd like to do a limited beta test.  If someone out there is
familiar with Windows screensavers and wouldn't mind helping me out,
go ahead and email me.  (Windows platforms only, please).
Finally, if your're at least a little suspicious of someone wanting to
install software on your computer, good for you!  I wouldn't trust me,
either.  The only thing I can say is that if I really wanted to
release some virus to the wild, probably the last thing I'd choose is
such a niche product.  :)  That said, the source code is available
(Visual Studio 2005 C#).
If you have any questions/comments, go ahead and respond here.
Adman
I am somewhat familiar with windows screensavers, in that I've
installed a few in the past. :-)
I'd be interested in testing it - but unfortunately I have no decent
games on NAO to supply.
JoaoSantos
2009-03-24 10:19:27 UTC
Permalink
On Mar 23, 10:13 pm, Ferrone <***@gmail.com> wrote:
[...]
Post by Ferrone
I'd be interested in testing it - but unfortunately I have no decent
games on NAO to supply.
I think the ideal would be very quick games (ascensions or death with
the amulet). Namely games under 15K turns.
I must say I find it a pity it is a window$ only program, because I
would like very much to use that on my Linuxes, and since I am not the
least familiar with screensaver coding I probably will not be able to
port it.
Adman
2009-03-24 16:16:50 UTC
Permalink
Post by JoaoSantos
[...]
Post by Ferrone
I'd be interested in testing it - but unfortunately I have no decent
games on NAO to supply.
I think the ideal would be very quick games (ascensions or death with
the amulet). Namely games under 15K turns.
I must say I find it a pity it is a window$ only program, because I
would like very much to use that on my Linuxes, and since I am not the
least familiar with screensaver coding I probably will not be able to
port it.
Fast ascensions is a great idea.

I downloaded some, but found that they didn't render properly in my
own ttyplayer, probably because they were played via xterm or
something, and the encoding was different than what I expected (I used
my own games as sample data, and those were played under an ANSI
windows telnet terminal).

So, I've got a little more work to do.

Adam
Rachel Elizabeth Dillon
2009-03-24 16:27:35 UTC
Permalink
Post by Adman
Post by JoaoSantos
[...]
Post by Ferrone
I'd be interested in testing it - but unfortunately I have no decent
games on NAO to supply.
I think the ideal would be very quick games (ascensions or death with
the amulet). Namely games under 15K turns.
I must say I find it a pity it is a window$ only program, because I
would like very much to use that on my Linuxes, and since I am not the
least familiar with screensaver coding I probably will not be able to
port it.
Fast ascensions is a great idea.
I downloaded some, but found that they didn't render properly in my
own ttyplayer, probably because they were played via xterm or
something, and the encoding was different than what I expected (I used
my own games as sample data, and those were played under an ANSI
windows telnet terminal).
So, I've got a little more work to do.
They might have been encoded with IBMGraphics or DECGraphics. I know
someone out there has a de-DECification script, maybe Shawn Moore?
I thought I had it, but all I can find is an example of the output.
You might also be able to rip the relevant code out of dgamelaunch.
Though if you do it at display-time, you're still left with the problem
of how to detect the character set. Dgamelaunch (at least the version
I'm still running) solves this by making the viewer press a key. This
probably works less well for a screensaver. :)

Hope this helps,

-r.
Adman
2009-03-24 18:11:53 UTC
Permalink
Post by Rachel Elizabeth Dillon
Post by Adman
Post by JoaoSantos
[...]
Post by Ferrone
I'd be interested in testing it - but unfortunately I have no decent
games on NAO to supply.
I think the ideal would be very quick games (ascensions or death with
the amulet). Namely games under 15K turns.
I must say I find it a pity it is a window$ only program, because I
would like very much to use that on my Linuxes, and since I am not the
least familiar with screensaver coding I probably will not be able to
port it.
Fast ascensions is a great idea.
I downloaded some, but found that they didn't render properly in my
own ttyplayer, probably because they were played via xterm or
something, and the encoding was different than what I expected (I used
my own games as sample data, and those were played under an ANSI
windows telnet terminal).
So, I've got a little more work to do.
They might have been encoded with IBMGraphics or DECGraphics. I know
someone out there has a de-DECification script, maybe Shawn Moore?
I thought I had it, but all I can find is an example of the output.
You might also be able to rip the relevant code out of dgamelaunch.
Though if you do it at display-time, you're still left with the problem
of how to detect the character set. Dgamelaunch (at least the version
I'm still running) solves this by making the viewer press a key. This
probably works less well for a screensaver. :)
Hope this helps,
-r.
Thanks. I think you're on the right track, but I don't think it's IBM
vs DEC graphics that's the problem.

The TTYREC files are basically just ASCII text ("You feel like someone
is helping you"), combined with embedded cursor control codes, which
move the cursor on the screen, set colors, erase text, etc. Pretty
straightforward.

I'm basically translating these cursor control characters into my own
language so I can recreate the screen. But if someone is playing from
a Windows telnet window, they'll generate different control codes than
those playing from xterms or some other terminal (putty?).

I've done a bangup job translating the cursor control codes that are
generated when I play from my Windows telnet window (which I prefer,
because it exactly mimics how the game looks when I play locally).
But now that I've expanded my testing to other users games (recorded
with some other terminal), not all the codes are recognized and things
are corrupted.

So, either I spend some additional time doing more translations, or
just punt and say "Not all games will work!" For the purposes of a
screensaver (which isn't really meant to be the center of attention
anyways), I'm leaning towards the latter. :)

Adman
Pasi Kallinen
2009-03-24 19:36:53 UTC
Permalink
Post by Adman
The TTYREC files are basically just ASCII text ("You feel like someone
is helping you"), combined with embedded cursor control codes, which
move the cursor on the screen, set colors, erase text, etc. Pretty
straightforward.
I'm basically translating these cursor control characters into my own
language so I can recreate the screen. But if someone is playing from
a Windows telnet window, they'll generate different control codes than
those playing from xterms or some other terminal (putty?).
AFAIK, supporting the following escape codes is enough:
-set text color and attribute
-move cursor (up/down/forward/backward)
-set cursor position
-erase screen (whole screen/from cursor down/from cursor up)
-erase line (whole line/eol/bol)

That is what I did for http://alt.org/nethack/ttyrecscreen.php
and it seems to work for almost all of the ttyrecs.
The escape codes I looked up on the console_codes man-page.
--
Pasi Kallinen
***@alt.org
http://bilious.homelinux.org/ -- NetHack Patch Database
Adman
2009-03-25 03:26:08 UTC
Permalink
Post by Pasi Kallinen
Post by Adman
The TTYREC files are basically just ASCII text ("You feel like someone
is helping you"), combined with embedded cursor control codes, which
move the cursor on the screen, set colors, erase text, etc.  Pretty
straightforward.
I'm basically translating these cursor control characters into my own
language so I can recreate the screen.  But if someone is playing from
a Windows telnet window, they'll generate different control codes than
those playing from xterms or some other terminal (putty?).
-set text color and attribute
-move cursor (up/down/forward/backward)
-set cursor position
-erase screen (whole screen/from cursor down/from cursor up)
-erase line (whole line/eol/bol)
That is what I did forhttp://alt.org/nethack/ttyrecscreen.php
and it seems to work for almost all of the ttyrecs.
The escape codes I looked up on the console_codes man-page.
--
Pasi Kallinen
Yup, I've got all those. But I just found that the occasional '\r' is
thrown in (carriage return), as well as a '\b' (backspace, different
from cursor left). I think I've got it down for IBMGraphics and non-
DEC graphics games. Terminal sizes greater than 25x80 don't render
too well, but work OK...

I think I'm pretty much all set (but that's what I thought last night,
and still found this last bug)...

Final release coming soon!
Jorgen Grahn
2009-04-05 22:13:56 UTC
Permalink
On Tue, 24 Mar 2009 11:11:53 -0700 (PDT), Adman <***@yahoo.com> wrote:
...
Post by Adman
The TTYREC files are basically just ASCII text ("You feel like someone
is helping you"), combined with embedded cursor control codes, which
move the cursor on the screen, set colors, erase text, etc. Pretty
straightforward.
I'm basically translating these cursor control characters into my own
language so I can recreate the screen. But if someone is playing from
a Windows telnet window, they'll generate different control codes than
those playing from xterms or some other terminal (putty?).
I have never used TTYREC files, but all this sounds suspiciously like
a normal Unix typescript, as produced by script(1) -- a utility which
has existed since the late 1970s.

With that knowledge, maybe you can google around and find that some
bearded hacker solved this problem or a similar problem thirty years
ago.

(There is Joey Hess's scriptreplay(1), but it states that it only
supports replay on the same terminal type.)

/Jorgen
--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.se> R'lyeh wgah'nagl fhtagn!
Loading...