Dialog port of Advent 430 (Adventure 2.5)

I have ported Advent 430 also known as Adventure 2.5 by Woods/Crowther into Dialog. Woods’s original code is in Fortran and machine translated C. I couldn’t bring myself to unravel hundreds of goto jumps to figure that code out, luckily Open-Adventure by Eric S. Raymond exists. It is a forward port of Adventure 2.5 into a more traditional, structured C program, much easier to work with.

Open Adventure has quite a faithful reproduction of the original’s gameplay. Most notable differences from the original are the i/inventory, l/look, z/nothing synonyms and seed and waste debug commands. Also the dragon question’s answer is mandatory in OA, which kinda gives away the puzzle. Therefore I changed it back into a silent implicit action like in Woods version.

This port has some other differences in behaviour and responses wrt OA:

  • grate won’t try to go from the grate room into the below grate, I believe this
    is concidental in OA and I have chosen to follow Woods’s behaviour. Here it will say What do you want to do with the grate?
  • pour bottle while the bottle is empty will respond with Bottle what? in OA and Woods version, this seems to be a bug. Here it will say Pour what?
  • When the game closing message is shown, the troll is destroyed, but it comes back if the player tries to cross the bridge a second time (OA has this, I am not sure about Woods version). Here it is gone for good.
  • say command works in weird ways if used implicitly, I haven’t tried to cover every combination of inputs in this case. OA and Woods differ here too, and their responses are too randomly weird to be called a feature in my opinion.
  • waste debug command can be used with negative numbers to actually add to lamp battery life in OA, I didn’t implement this behaviour. Also in this port waste command’s parameter is limited by Dialog’s numbers(14 bits unsigned), unlike the seed command (which accepts both big numbers and negatives, and behaves the same way as in OA).
  • save doesn’t close the game here. Saving penalties to the score still apply, but in a moment of weakness I have added a save mercy command to turn them off for the playthrough.
  • restart and undo works with this program. Restart is a synonym for resume in the original and OA versions, here it restarts the game proper.
  • about command was added.

I am sure there many other discrepancies, but those are the ones I know of and remember at this time.

In this port same seed numbers for the RNG should lead to same gameplay as in OA. For example the perfect score walkthroughs by Ryan Sarson should work with this port.

This is not a modernization attempt, but building a game that follows the original (well, the OA version of it) as close as possible. @ifste has an excellent port of Advent 350 here, that modernizes the original Colossal Cave and showcases some nice features of Dialog’s library (like links). My purpose here was to demonstrate what the language itself is capable of and add to the available source codes in the wild, for people who may desire to peruse it.

The z-code file was built with Compiler 0m/03-Library 0.46. If you want to build it yourself, please note that you have to increase heap memory sizes when compiling for z-code (random number generator uses heavy recursion with some hefty lists carried up and down the recursion). I would not advise trying to play this on a retro machine, at some turns a trace log in the debugger can be as long as 1000 pages(about 50 lines long each).

dialogc -t z5 -H 6500 -A 2000 advent430.dg stdlib.dg

advent430.dg.zip (55.1 KB)
advent430.z5.zip (100.7 KB)

Any kind of feedback or questions are welcome.


Does this apply to the aa build as well?


Yes, that figure is eyeballed in the debugger. It’s due to the randrange and its usage of big division algorithm. One query to that rule generates more than 100 pages of trace log, and in one turn there can be up to 6 dwarves moving, some of them attacking, player attacking, “plugh” can be heard if the player is in Y2 etc. All of these roll the dice separately and the log lines can add up to more than 1000 pages actually. It is still snappy in Bocfel running on a 2012 I7 processor.

1 Like

Very interesting. Thanks for making this and sharing it!

I had to try running this on a MEGA65, an 8-bit computer running at 40 MHz. It’s quite playable so far, but with noticable delays between moves (like 2-3 seconds).

Wouldn’t it be nice to support an alternate PRNG which gives the same or just about the same results, but much cheaper, to make the game playable on a wider range of hardware?


thanks for posting! the more (competent than my own) dialog code out there the better.

1 Like

Good idea, I will post a new release implementing that.

Thanks for the kind words. I have great respect for authors who build original content as opposed to my reproduction work. Also thank you for the games you have authored/will author in the future, they are what makes working on this worth it.

Yeah, reproducing the PRNG well enough that the same seeds give the same results is an awe-inspiring effort, but a build that calls the built-in Dialog RNG instead should have a much smaller memory footprint for old hardware!

I admit part of the reason for choosing to do it that way was vanity on my part, but believe it or not the idea to go about it in this way was born from a desire to be able to use the code coverage tests of the Open Adventure suite. I wanted the resulting game as faithful to the original as I want it to be; being able to use those tests helped greatly with that goal.

1 Like

Release 2 changes:

  • some code changes without changing functionality
    • added @(reset feefiefoe sequnce) (feefiefoe @fum), for code readability
    • changed (set found) rule into an access predicate
    • the artificial #mercy object for save mercy command is eliminated
  • gameplay changes
    • save mercy doesn’t break feefiefoe sequence anymore
    • save doesn’t break feefiefoe sequence if merciful save is on
    • now the game starts with platform PRNG in use instead of custom LCG
    • seed <bignumber> activates custom LCG, seed platform turns it off again

advent430rel2.dg.zip (55.4 KB)
advent430rel2.z5.zip (100.9 KB)