simont: A picture of me in 2016 (Default)
simont ([personal profile] simont) wrote2005-12-12 03:17 pm

Progress report on long-term plan

My long-term plan, at present, is to take a longish break from writing free software and to relax and do nothing much. I am here to report that in the past week I have written one (1) new piece of free software, and thus my progress on the long-term plan is actually negative.

In pursuit of the general idea of doing nothing much, [livejournal.com profile] xanna helpfully suggested last week that now might be a good time to take up NetHack again. I periodically attempt not to suck at it, but with little success so far. This time it occurred to me that what I could really do with was to watch a couple of games being played by more competent people, just so I could get a general idea of what kinds of things they were doing differently from me but without completely spoiling the fun of working out for myself when it was a good idea to do what.

alt.org contains a large number of ttyrec recordings of NetHack games, many of which ended in ascension and can therefore be safely assumed to be performed by far better players than me. So I downloaded a couple of these plus a player application, and got about half way through watching one before completely losing my temper with the fact that the player didn't permit me to rewind when something interesting flashed up on the screen and I didn't manage to press Pause fast enough. The trouble is that ttyrecs are fundamentally not designed for easy random access; the normal player application simply alternates between sleep(2) and write(2), with only minor changes to support speed adjustment and pausing.

In order to support rewinding, you'd have to actually run the entire file through a terminal emulator and read off the resulting screen states in such a way as to be able to randomly access them thereafter. This involves considerably more high technology than the average programmer is conveniently able to get their hands on, so it's not surprising that it hadn't already been done; but fortunately I was the right person for the job, since I just happen to have sufficiently intimate knowledge of a piece of terminal emulation software to be able to adapt it quickly into this sort of application, and also a sufficiently good feel for random-access data structures to be able to store the resulting data reasonably efficiently. So, in only a couple of hours, my new ttyrec player sputtered into life, and within the first ten minutes of use it had more than paid off the coding time in lack of massive annoyance.

It's at about this point that my conscience reasserted itself and pointed out that I was doing a very bad job of not writing software. So I've left the job half-finished: the current state of the program is that it works provided you build it against ncurses on Linux, but completely lacks a sensible build system and portability framework to adapt it to other Unices and/or curses implementations. Therefore, I'm kind of hoping someone else will send me some patches that do things with autoconf, ‘make install’ and other such amenities. To say nothing of a few more configurable options and features, and definitely some documentation as well.

Still, on the plus side, my NetHack has definitely improved. Last week I got a couple of characters all the way down to the bottom of the Gnomish Mines and back up in one piece, and although both of them subsequently died avoidably, I'm certainly playing better NetHack right now than I ever have before.

[identity profile] senji.livejournal.com 2005-12-12 03:30 pm (UTC)(link)
Umm, might it be easier for helpful people to send you patches if you linked to the code? :)

[identity profile] crazyscot.livejournal.com 2005-12-12 03:37 pm (UTC)(link)
Argh! No, dammit, no! The fates seem to be trying to induce me back to the dark side nethack! (ipbt and some decent recordings seem to be *exactly* what I didn't know I needed in order to get better...)
pvaneynd: (Default)

[personal profile] pvaneynd 2005-12-12 03:40 pm (UTC)(link)
and here I was ignoring Civ IV as hard as I can, getting pushed into nethack again. ;-)
aldabra: (Default)

[personal profile] aldabra 2005-12-12 03:45 pm (UTC)(link)
Civ IV, you say? [innocent look]
aldabra: (Default)

[personal profile] aldabra 2005-12-12 03:48 pm (UTC)(link)
Oh buggerit, I don't *want* gorgeous 3D graphics and in-games movies and brilliant audio and music. I want Civ I with a scripting language. How many times do I have to say this?

Er, [livejournal.com profile] simont, how do you feel about writing a scripting language for Civ I, in your time off? 8-)
aldabra: (Default)

[personal profile] aldabra 2005-12-12 04:38 pm (UTC)(link)
Mmm. What I want to do in Civ is define my strategy, and then go to bed, and get up in the morning and see if it worked, and tweak it if not. Thereby homing in unerringly on an optimal strategy without wasting weekends at a time actually playing the damn game...

[identity profile] pjc50.livejournal.com 2005-12-12 04:44 pm (UTC)(link)
Have you looked at FreeCiv? It doesn't have such a thing, but it's basically Civ II (or Civ I if you load the other ruleset) with automation that's actually useful. You can set build queues, and production goals for cities ("optimise for maximum production but at least 2 spare food"). You can put settlers and engineers on 'automatic' or 'build railway from here to X'. It saves a lot of micromanagement.

[identity profile] ex-robhu.livejournal.com 2005-12-12 03:51 pm (UTC)(link)
Recent LJ Nethack talk has pushed me into starting to play again too ... I've not played it very much though, and so far my greatest achievement is lvl 8 of the dungeon!

[identity profile] ex-lark-asc.livejournal.com 2005-12-12 03:56 pm (UTC)(link)
There's a wonderful line in the film 'Dead Again': "There's no such thing as 'trying to quit'. There are two kinds of people in the world, smokers and non-smokers. Find out which one you are and be that."

I think you might have just discovered you're a free software author ;)

[identity profile] crazyscot.livejournal.com 2005-12-12 05:10 pm (UTC)(link)
Nethack players and non-nethack players?

[identity profile] ex-robhu.livejournal.com 2005-12-12 04:23 pm (UTC)(link)
It compiled and ran on my OS X 10.4.3 box... I use Fink so I probably have ncurses and a few other things already installed though...

It took about 6 minutes to load a 22MB file on my Dual 2Ghz G5 (although I note its single threaded).

I've friended you btw - although I don't expect you to friend me back, but I thought I'd mention it. I'm a friend of [livejournal.com profile] atreic's.

[identity profile] ex-robhu.livejournal.com 2005-12-12 04:56 pm (UTC)(link)
Did you find any good Nethack recordings? The ones I'm coming across are already deep in the dungeon :-(

[identity profile] crazyscot.livejournal.com 2005-12-12 09:15 pm (UTC)(link)
Now I'm at home and have had a chance to nosey at the code, I am in awe at the beautiful simplicity involved. I really wish I had your nous for data structures :-)

PS. Watch out for that floating eye!

[identity profile] ex-robhu.livejournal.com 2005-12-13 01:06 am (UTC)(link)
Fastest Ascension ever... http://alt.org/nethack/ttyrec/Rast/2005-10-22.12:41:21.ttyrec.bz2

[identity profile] ex-robhu.livejournal.com 2005-12-13 02:10 am (UTC)(link)
an hour later I read the whole discussion... http://groups.google.com/group/rec.games.roguelike.nethack/browse_thread/thread/0f71e860e51107f2/36126a9912a215ae#36126a9912a215ae Turns out that game wasn't actually saved :-O