My Adventure-Writing Self-Challenge

General chit-chat, ramblings, odds and ends.

Moderator: Alastair

Post Reply
Message
Author
User avatar
pippa
Posts: 57
Joined: Sun Jan 16, 2005 3:28 am
Location: London

My Adventure-Writing Self-Challenge

#1 Post by pippa » Sun Aug 17, 2014 6:28 pm

Back in the eighties, I bought GAC for the ZX Spectrum, but utterly failed to get to grips with it. Despite my best efforts, I just couldn't get the hang of it, and my amazing adventure epic remained tragically unwritten. (With hindsight, the fact that I tried to jump straight into writing a stupidly big epic was the problem.)

OK, OK, it would've been just another pointless, plotless treasure hunt even if it had been completed, so the world probably isn't missing much. But even after all these years, I'm still disappointed with myself for giving up on it so easily.

And so, I'm going to try again. I'll be attempting once again to master GAC. (Yes, yes, of course there are much better adventure writing systems out there, but it's a matter of personal pride.)

But this time, I won't be attempting to run before I can walk. No trying to start off with a big sprawling epic straight away. Instead I'll be setting myself a series of small programming challenges, just until I've the hang of GAC. And, if the forum moderators don't think it's too boring, I'll be posting my progress in this thread.

My first challenge is to write a version of the old "gas-mask/cheese/mouse/elephant" puzzle. It's a corny cliche, but it does have a good variation of different tricks (must be wearing the right object at the right time, then must drop the right object in the right place, etc.) to test my programming muscles. And I'm giving myself one week to do it. That should be more than enough.

Anyone who wants to join in, feel free to give it a go. You don't have to use GAC - any system will do. And we can all compare our results in a week's time.
[b]~~[i] Pippa [/i]~~[/b]

User avatar
Richard Bos
Posts: 44
Joined: Tue Apr 20, 2010 9:43 am
Location: The Netherlands
Contact:

Re: My Adventure-Writing Self-Challenge

#2 Post by Richard Bos » Mon Aug 18, 2014 8:56 am

pippa wrote:Anyone who wants to join in, feel free to give it a go. You don't have to use GAC - any system will do. And we can all compare our results in a week's time.
Bags me the PAW - which I still have in the box, and the manuals beside me on my desk, even if my physical Spectrum died to an edge connector burnout (stupid Richard - I know, I know...). I may even add one in MC-adorned Basic.
I tried my hand at implementing Roger Firth's Cloak of Darkness in a few Spectrum IF systems (it's on my website if you want to know more). Like you, I just can't get the feel for GAC; it seems a bit rough around the edges to me. The PAW is much more finished, and at least as powerful.
Richard Bos
The Netherlands
Spectrum nut and T/SAL "expert". And very amateur chess player.

User avatar
Richard Bos
Posts: 44
Joined: Tue Apr 20, 2010 9:43 am
Location: The Netherlands
Contact:

Re: My Adventure-Writing Self-Challenge

#3 Post by Richard Bos » Tue Aug 19, 2014 3:35 pm

pippa wrote:My first challenge is to write a version of the old "gas-mask/cheese/mouse/elephant" puzzle.
By the way, are you using pictures as well? The one I have now does not. I'm using a severely cut-down part of the Philosopher's Quest map, but not, as yet, pictures. (I'm bad at pictures.)
Richard Bos
The Netherlands
Spectrum nut and T/SAL "expert". And very amateur chess player.

User avatar
pippa
Posts: 57
Joined: Sun Jan 16, 2005 3:28 am
Location: London

Re: My Adventure-Writing Self-Challenge

#4 Post by pippa » Sun Aug 24, 2014 3:36 pm

OK. Here it is. It's not based directly on any existing games, but rather my own personal interpretation of the puzzle, with a couple of unusual touches. Hope you enjoy it.

Graphics? I had hoped to add some, but just getting the code finished and working took longer than planned, so I had to skip them in order to meet my self-imposed deadline.

(Oh, and the file's a snapshot of the GAC system, so press Enter to run the game. I've never quite got the hang of saving to virtual tape files, though I'll probably have to learn do that if I ever write a full game.)
Attachments
GAC-elephant.z80.zip
My own version of the elephant puzzle
(17.16 KiB) Downloaded 161 times
[b]~~[i] Pippa [/i]~~[/b]

User avatar
pippa
Posts: 57
Joined: Sun Jan 16, 2005 3:28 am
Location: London

Re: My Adventure-Writing Self-Challenge

#5 Post by pippa » Sun Aug 24, 2014 3:52 pm

Richard Bos wrote: I tried my hand at implementing Roger Firth's Cloak of Darkness in a few Spectrum IF systems (it's on my website if you want to know more). Like you, I just can't get the feel for GAC; it seems a bit rough around the edges to me. The PAW is much more finished, and at least as powerful.
Sounds interesting. What's the address of your site?

You're right that PAW is more powerful (it allows "ALL", and can put spaces after the commas in its lists) but that wasn't available when I bought GAC. But I don't think it was GAC's limitations that caused me problems.

You see, I read source code with the same part of my brain that reads poetry, getting a feel for the overall sense of what's being said. (Really beautiful source code even makes me weep tears of joy the same way a beautiful poem does!) But it makes it hard to think of programs in terms of flowcharts or logic diagrams or all the other things that are needed to actually write code.
[b]~~[i] Pippa [/i]~~[/b]

User avatar
Richard Bos
Posts: 44
Joined: Tue Apr 20, 2010 9:43 am
Location: The Netherlands
Contact:

Re: My Adventure-Writing Self-Challenge

#6 Post by Richard Bos » Sun Aug 24, 2014 4:20 pm

pippa wrote:
Richard Bos wrote: I tried my hand at implementing Roger Firth's Cloak of Darkness in a few Spectrum IF systems (it's on my website if you want to know more). Like you, I just can't get the feel for GAC; it seems a bit rough around the edges to me. The PAW is much more finished, and at least as powerful.
Sounds interesting. What's the address of your site?
In this case, http://rlbos.home.xs4all.nl/IF/index.en.html is probably the easiest way to get it; it's near the bottom of the page. There's also a link there to Roger's Cloak of Darkness page.
pippa wrote:But it makes it hard to think of programs in terms of flowcharts or logic diagrams or all the other things that are needed to actually write code.
You don't need flowcharts to write (or read) code, you need to understand the logic. This may involve flowcharts for some people, but it doesn't have to. An overview of the entire logic is usually more important; the details are, well, details, that can be worked on and fiddled with, but if you don't have the main idea of the program in your mind it's never going to work.
Richard Bos
The Netherlands
Spectrum nut and T/SAL "expert". And very amateur chess player.

User avatar
Richard Bos
Posts: 44
Joined: Tue Apr 20, 2010 9:43 am
Location: The Netherlands
Contact:

Re: My Adventure-Writing Self-Challenge

#7 Post by Richard Bos » Sun Aug 24, 2014 4:24 pm

pippa wrote:OK. Here it is. It's not based directly on any existing games, but rather my own personal interpretation of the puzzle, with a couple of unusual touches. Hope you enjoy it.
And here's mine, based on the original. I did manage to get a GAC version cobbled together after all (well, I did already have the logic done for the others), but I'm not that happy with it.
pippa wrote:(Oh, and the file's a snapshot of the GAC system, so press Enter to run the game. I've never quite got the hang of saving to virtual tape files, though I'll probably have to learn do that if I ever write a full game.)
Well, that depends on the emulator you're using. I can tell you how to do it using Spin; any others I'd have to investigate.
Attachments
Cheese.zip
Cheese in three systems.
(52.59 KiB) Downloaded 186 times
Richard Bos
The Netherlands
Spectrum nut and T/SAL "expert". And very amateur chess player.

User avatar
pippa
Posts: 57
Joined: Sun Jan 16, 2005 3:28 am
Location: London

Re: My Adventure-Writing Self-Challenge

#8 Post by pippa » Sun Aug 24, 2014 6:12 pm

Richard Bos wrote:
pippa wrote: Sounds interesting. What's the address of your site?
In this case, http://rlbos.home.xs4all.nl/IF/index.en.html is probably the easiest way to get it; it's near the bottom of the page. There's also a link there to Roger's Cloak of Darkness page.
Thanks for the link.
Richard Bos wrote:You don't need flowcharts to write (or read) code, you need to understand the logic. This may involve flowcharts for some people, but it doesn't have to. An overview of the entire logic is usually more important; the details are, well, details, that can be worked on and fiddled with, but if you don't have the main idea of the program in your mind it's never going to work.
That's the trouble. I don't think of code in terms of logic, but in terms of beauty and poetry. Makes it very hard to write!

(For example, the "GIVE CHEESE" and "FEED MOUSE" responses in my GAC program, were the last things I rushed to complete before the deadline was up. So although they seem to just about work and obey the logic, there's no beauty to the code. I really want to re-write them from scratch to make them much more beautiful.)
Richard Bos wrote: And here's mine, based on the original. I did manage to get a GAC version cobbled together after all (well, I did already have the logic done for the others), but I'm not that happy with it.
I've tried the PAW version, and there's a strange bug. I can't do an inventory while carrying the cheese. (And without the cheese, it begins, "You have with me.")

Apart from that, it seems every bit as irritating as the Philosopher's Quest original. That's good, right?
[b]~~[i] Pippa [/i]~~[/b]

User avatar
Richard Bos
Posts: 44
Joined: Tue Apr 20, 2010 9:43 am
Location: The Netherlands
Contact:

Re: My Adventure-Writing Self-Challenge

#9 Post by Richard Bos » Sun Aug 24, 2014 7:19 pm

pippa wrote:(For example, the "GIVE CHEESE" and "FEED MOUSE" responses in my GAC program, were the last things I rushed to complete before the deadline was up. So although they seem to just about work and obey the logic, there's no beauty to the code. I really want to re-write them from scratch to make them much more beautiful.)
Hmmm... I don't see what you think is so ugly about that code. In fact, I see no way of changing it very much without also drastically changing the behaviour. For example, it could certainly be made simpler, by swapping mouse and mouse-eating-cheese as soon as you drop the cheese. But that changes the puzzle: you don't then have to leave and come back.
In the PAW (but not in the Quill) you could at least change the code for GIVE to re-route it to use the command FEED instead, by changing the flags that hold the current command. That way, you only need the same code once. But that's hacky in its own way, and in any case, the GAC doesn't hold the current command in user-changable flags.
pippa wrote:I've tried the PAW version, and there's a strange bug. I can't do an inventory while carrying the cheese. (And without the cheese, it begins, "You have with me.")
Ah. Yes, you've found one genuine bug. Because of the different ways the PAW handles directions and normal commands (in common with both GAC and Quill, but the PAW at least allows the program to react before consulting the connection table) I had to make it think nothing, not even printing a message, had happened when the cheese is present. If I didn't do that, it wouldn't allow movement with the cheese present at all, which is of course Wrong. But instead of doing so for all verbs lower than 13 (current movement verbs) or lower than 14 (potential movement verbs), I erroneously did so for verbs lower than 15 (all of the above, plus INVEN). If I change the 15 to 14 in both cases, it works correctly.
As for "You have with me", that's because the PAW by default uses the second person; I changed this to first, because that's what BrandX uses, and apparently didn't do so thoroughly enough.
pippa wrote:Apart from that, it seems every bit as irritating as the Philosopher's Quest original. That's good, right?
That's exactly what I aimed for :twisted:.
Richard Bos
The Netherlands
Spectrum nut and T/SAL "expert". And very amateur chess player.

User avatar
pippa
Posts: 57
Joined: Sun Jan 16, 2005 3:28 am
Location: London

Re: My Adventure-Writing Self-Challenge

#10 Post by pippa » Sun Aug 24, 2014 9:54 pm

Richard Bos wrote: Hmmm... I don't see what you think is so ugly about that code. In fact, I see no way of changing it very much without also drastically changing the behaviour. For example, it could certainly be made simpler, by swapping mouse and mouse-eating-cheese as soon as you drop the cheese. But that changes the puzzle: you don't then have to leave and come back.
In the PAW (but not in the Quill) you could at least change the code for GIVE to re-route it to use the command FEED instead, by changing the flags that hold the current command. That way, you only need the same code once. But that's hacky in its own way, and in any case, the GAC doesn't hold the current command in user-changable flags.
The ugliness comes in the duplication of code. If I decide to give the player yet another command for doing this, or make a even a slight change to what happens as the cheese gets given, it'll mean a lot of work.

With hindsight, it would've been better to make the player's commands just set one of the unused flags then exit. The high level conditions test that flag and do the "putting cheese in front of mouse" routine if it's set.

Oh well, we learn from experience. :roll:
Richard Bos wrote:Ah. Yes, you've found one genuine bug. Because of the different ways the PAW handles directions and normal commands (in common with both GAC and Quill, but the PAW at least allows the program to react before consulting the connection table) I had to make it think nothing, not even printing a message, had happened when the cheese is present. If I didn't do that, it wouldn't allow movement with the cheese present at all, which is of course Wrong. But instead of doing so for all verbs lower than 13 (current movement verbs) or lower than 14 (potential movement verbs), I erroneously did so for verbs lower than 15 (all of the above, plus INVEN). If I change the 15 to 14 in both cases, it works correctly.
Hmmm... What if you tried putting all the "reactions before doing the player's command" conditions in a separate process table? Make sure it always ends with a NOTDONE, and have an unconditional call to it as the first entry in the response table. Would PAW still remember the NOTDONE after control has passed back to the response table? And if so, would that make the movements work properly after going through all the response entries?

That might be more elegant than all that brute force testing of the parser flags, especially if you expand the game later, with new "reacting before" conditions that would all need their own need parser flag tests.
Richard Bos wrote:
pippa wrote:Apart from that, it seems every bit as irritating as the Philosopher's Quest original. That's good, right?
That's exactly what I aimed for :twisted:.
And what did you make of mine? Based on it, do you think I should try writing a full length game?
[b]~~[i] Pippa [/i]~~[/b]

User avatar
Richard Bos
Posts: 44
Joined: Tue Apr 20, 2010 9:43 am
Location: The Netherlands
Contact:

Re: My Adventure-Writing Self-Challenge

#11 Post by Richard Bos » Mon Aug 25, 2014 1:46 pm

pippa wrote:The ugliness comes in the duplication of code. If I decide to give the player yet another command for doing this, or make a even a slight change to what happens as the cheese gets given, it'll mean a lot of work.

With hindsight, it would've been better to make the player's commands just set one of the unused flags then exit. The high level conditions test that flag and do the "putting cheese in front of mouse" routine if it's set.
True, but that has its own ugliness: it means that the direct results of that action are now spread over two, distant parts of the code. And you already have a second part of code which reacts to it indirectly. Which is uglier is a matter of taste.

The PAW way, in which you can munge the entered command while it is being processed, makes this easier; it allows you to parse "GIVE CHEESE", change the verb flag to the value for FEED and the noun flag for that to MOUSE, and the FEED MOUSE code will be triggered. This presumes that GIVE is lower than FEED, but if it isn't you just do it the other way 'round, of course. That, too, is ugly from a certain point of view, but it does at least have the advantage of being most easily legible in an annotated version of the code, such as the DOS port of PAW.
pippa wrote:
Richard Bos wrote:But instead of doing so for all verbs lower than 13 (current movement verbs) or lower than 14 (potential movement verbs), I erroneously did so for verbs lower than 15 (all of the above, plus INVEN). If I change the 15 to 14 in both cases, it works correctly.
Hmmm... What if you tried putting all the "reactions before doing the player's command" conditions in a separate process table? Make sure it always ends with a NOTDONE, and have an unconditional call to it as the first entry in the response table. Would PAW still remember the NOTDONE after control has passed back to the response table? And if so, would that make the movements work properly after going through all the response entries?
I don't know, and I'm not going to try. In a normal game, I'd never do it this way. Instead, I'd put all that code in Process 2, which gets executed after each command and is already used to start and stop the cheese counter. But in this case I wanted to imitate the T/SAL code exactly, which required reacting before the command is executed (but after it's entered). This is not a nice thing to do to your player anyway, and if I hadn't wanted to be just as nasty as Messrs. Killworth and Mestel I'd have chosen a different solution in the first place.
pippa wrote:And what did you make of mine? Based on it, do you think I should try writing a full length game?
I think so. But judging by what you say about yourself, I'd strongly recommend planning it all out on paper first and only starting coding when you have the design all written down. That's a good idea anyway, but if you easily get lost in code details it's imperative.
Richard Bos
The Netherlands
Spectrum nut and T/SAL "expert". And very amateur chess player.

User avatar
pippa
Posts: 57
Joined: Sun Jan 16, 2005 3:28 am
Location: London

Re: My Adventure-Writing Self-Challenge

#12 Post by pippa » Tue Aug 26, 2014 10:05 am

Richard Bos wrote:
pippa wrote:And what did you make of mine? Based on it, do you think I should try writing a full length game?
I think so. But judging by what you say about yourself, I'd strongly recommend planning it all out on paper first and only starting coding when you have the design all written down. That's a good idea anyway, but if you easily get lost in code details it's imperative.
OK. But I should warn you, it'll be the same plotless treasure hunt I tried to write in the eighties. Well, more or less. I can't remember all the details, but I know it included:
  • a Sherlock Holmes-inspired puzzle involving a bust of Napoleon
  • an Escher-like room with confusing exits
  • floating coloured spheres that you have to say magic words to
  • an astrology-based puzzle
  • waving a trident to summon Neptune
  • lots of cryptic-crossword-style clues to magic words
  • and a Zork-like echo chamber with a very different solution
[b]~~[i] Pippa [/i]~~[/b]

User avatar
Richard Bos
Posts: 44
Joined: Tue Apr 20, 2010 9:43 am
Location: The Netherlands
Contact:

Re: My Adventure-Writing Self-Challenge

#13 Post by Richard Bos » Wed Dec 10, 2014 9:58 pm

pippa wrote:OK. But I should warn you, it'll be the same plotless treasure hunt I tried to write in the eighties.
So... how's it going? Is it going at all? Does it need testing? I'll be happy to tear into it... or heap praise on it, as may be!
Richard Bos
The Netherlands
Spectrum nut and T/SAL "expert". And very amateur chess player.

User avatar
Gunness
Site Admin
Posts: 1826
Joined: Tue Dec 07, 2004 7:04 pm
Location: Copenhagen, Denmark
Contact:

Re: My Adventure-Writing Self-Challenge

#14 Post by Gunness » Tue Dec 16, 2014 3:25 pm

Yes, please by all means - would love to playtest and give feedback (in a constructive manner!)

Post Reply