Progress report on long-term plan [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Mon 2005-12-12 15:17
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.

LinkReply
[identity profile] senji.livejournal.comMon 2005-12-12 15:30
Umm, might it be easier for helpful people to send you patches if you linked to the code? :)
Link Reply to this | Thread
[personal profile] simontMon 2005-12-12 15:32
That's a good point. (I've been pretty sleepy all day.)

http://www.chiark.greenend.org.uk/~sgtatham/ipbt/
Link Reply to this | Parent
[identity profile] crazyscot.livejournal.comMon 2005-12-12 15:37
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...)
Link Reply to this | Thread
[personal profile] simontMon 2005-12-12 15:43
Oops. Blame [livejournal.com profile] xanna. Honest. Er.

(I'm also finding that routinely recording my own games seems to be helping, simply because it permits me to retrospectively analyse my errors without the analysis being distorted by poor memory... Of course, the ulterior motive for that is that if when I actually manage to ascend I'll have a record of my first success :-)
Link Reply to this | Parent
[personal profile] pvaneyndMon 2005-12-12 15:40
and here I was ignoring Civ IV as hard as I can, getting pushed into nethack again. ;-)
Link Reply to this | Thread
[personal profile] aldabraMon 2005-12-12 15:45
Civ IV, you say? [innocent look]
Link Reply to this | Parent | Thread
[personal profile] aldabraMon 2005-12-12 15:48
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-)
Link Reply to this | Parent | Thread
[personal profile] simontMon 2005-12-12 16:12
Heh :-) Probably fortunately, I've never played any of the Civ games, apart from five minutes prodding Freeciv and deciding I couldn't quite cope with the user interface. So sorry, but no, even if I weren't theoretically not-coding at the moment...

I'm interested in principle by the general idea of adding scripting to strategy games, though. My strategy game of choice is Starcraft; I keep thinking it would be interesting to allow Starcraft players to provide scripts which kept track of background jobs while the player concentrated on something else, and which automated some of the tedious micro-management during battle by doing things like intelligent target selection. (Of course a script-enabled player would have to compete against other script-users; using scripts against an unaided human would certainly count as cheating.) The general idea is that computers are good at performing simple and boring tasks very quickly and not missing things by accident, whereas humans are good at long-range strategic planning, emergency response and improvisation, and ideally a good Starcraft player needs to be a fusion of both, so you let the computer do what it's good at while the human does what they're good at.

Advanced Chess is probably relevant to this theme as well.
Link Reply to this | Parent | Thread
[personal profile] aldabraMon 2005-12-12 16:38
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...
Link Reply to this | Parent
[identity profile] pjc50.livejournal.comMon 2005-12-12 16:44
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.
Link Reply to this | Parent
[identity profile] ex-robhu.livejournal.comMon 2005-12-12 15:51
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!
Link Reply to this
[identity profile] ex-lark-asc.livejournal.comMon 2005-12-12 15:56
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 ;)
Link Reply to this | Thread
[personal profile] simontMon 2005-12-12 16:34
Well, there are worse things to be. Rather that than a smoker, for example!

My first thought about "Dead Again" was that it would rather aptly describe my NetHack play as well :-)
Link Reply to this | Parent
[identity profile] crazyscot.livejournal.comMon 2005-12-12 17:10
Nethack players and non-nethack players?
Link Reply to this | Parent
[identity profile] ex-robhu.livejournal.comMon 2005-12-12 16:23
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.
Link Reply to this | Thread
[personal profile] simontMon 2005-12-12 16:29
Yeah, unfortunately it's not really feasible to parallelise the loading process. If you'd been loading lots of separate files end-to-end it might have been doable with some trickery, but with just one file I'm afraid this is inherently going to be a computation which can only use half of a dual-CPU machine.

6 minutes is roughly consistent with the results I've been seeing on my 2GHz P4 (about 10 seconds per input megabyte). It is a pain, but I find lack of rewind to be an incomparably greater pain. (And anyone who doesn't knows where to find a lower-tech player :-)
Link Reply to this | Parent | Thread
[identity profile] ex-robhu.livejournal.comMon 2005-12-12 16:56
Did you find any good Nethack recordings? The ones I'm coming across are already deep in the dungeon :-(
Link Reply to this | Parent | Thread
[personal profile] simontMon 2005-12-12 17:05
My current practice is to check alt.org's list of recent ascensions, pick one involving a character class I like (I'm currently playing Valks, so finding a competent Monk ascension is interesting but not immediately useful), and then look up the username on the ttyrecs page to find the ttyrecs corresponding to that ascension. There'll typically be a whole bunch of them as the game was saved and reloaded repeatedly during play. If you find the record which ends in ascension and it starts with "Restoring save file", then look at the immediately previous one and it'll generally be the previous instalment of the same game.

For example, on 29th November "firemonkey" ascended a Valkyrie. So we look up their ttyrecs, and we find that 2005-11-29.18:48:31.ttyrec is the end of that game - and the previous twelve files before that are also parts of the same game, so that the very start is 2005-10-26.16:41:42.ttyrec. (In fact there are a few thousand turns missing in the middle of this game, which is a bit annoying; I assume some sort of recording glitch, since one of the files cuts off without the usual "Really save?" / "Be seeing you" business.)
Link Reply to this | Parent
[identity profile] crazyscot.livejournal.comMon 2005-12-12 21:15
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!
Link Reply to this | Thread
[personal profile] simontMon 2005-12-12 22:48
Thank you :-)

Floating eyes I don't have a problem with any more (except that they keep not leaving corpses, grr). What got me this evening was that the Minetown altar wasn't my alignment. That wouldn't have been a problem in itself - there was a random coaligned altar just above the Mines entrance - but being half asleep I managed to forget the Minetown altar was cross-aligned and sacrificed at it anyway. Cue one extremely upset priest and one messily dead Valkyrie. And it was going so well.
Link Reply to this | Parent
[identity profile] ex-robhu.livejournal.comTue 2005-12-13 01:06
Fastest Ascension ever... http://alt.org/nethack/ttyrec/Rast/2005-10-22.12:41:21.ttyrec.bz2
Link Reply to this | Thread
[identity profile] ex-robhu.livejournal.comTue 2005-12-13 02:10
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
Link Reply to this | Parent | Thread
[personal profile] simontTue 2005-12-13 09:17
Ah, is that what happened? I found that post last week and discovered that it was the wrong ttyrec, but wasn't sure what had happened. Shame.
Link Reply to this | Parent
navigation
[ go | Previous Entry | Next Entry ]
[ add | to Memories ]