Castle Quest - some random musings

reminisce about classic bbc micro and acorn electron games here
Related forum: adventures


Post Reply
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Castle Quest - some random musings

Post by bob147 »

So Castle Quest is my favourite classic BBC micro game. Back in the day I loved the smooth scrolling and the clever puzzles (the first time you work out how to escape from the jail for example!), but I never finished it. The wicked witch always got the better of me and I could never work out how to beat her, no matter how many times I threw my sword at her and it passed straight through.


EDIT 13/04/2022 - So this thread exploded in a way I never saw coming back in October last year, here are some interesting links

A real time run in BeebEm which skips the sword by @Bob147
viewtopic.php?p=339436#p339436

A casual playthrough using BeebJit's 'replay' feature to demonstrate one possible intended route through the game by @Bob147
viewtopic.php?p=339757#p339757

The beginnings of a disassembly by @Diminished
viewtopic.php?p=339391#p339391

A rare death message uncovered thanks to the disassembly
viewtopic.php?p=339916#p339916

An improved version of the BeebEm run above using BeebJit, first attempt at something vaguely like a TAS by @Bob147
viewtopic.php?p=340285#p340285

Glitch video by @JC229 featuring a crazy prison break/fire sword glitch plus loads of other stuff
viewtopic.php?p=353474#p353474

First proper tool assisted speedrun using BeebJit trying to incorporate all the findings in the thread so far by @Bob147
viewtopic.php?p=354056#p354056

Python script to convert BeebJit replays to an editable csv by @gfoot
viewtopic.php?p=354486#p354486

@JC229 blows my run out of the water and creates a new heavily optimised BeebJit TAS
viewtopic.php?p=354618#p354618

The current iteration by @JC229, if you watch nothing else, watch this!!
viewtopic.php?p=355245#p355245

Plus many many glitches, speed run routes and amusing asides along the way. It's been a fun ride!


Yes it's from 1985 but just in case someone is planning a very late playthrough, there are some gigantic spoilers about the ending below :D

I came back to it recently armed with save states and a solution and was surprised by how obtuse the ending actually is (and how close I was to it). Defeat the witch Wizard of Oz style by lobbing a bucket of water at her, take the wand that she was guarding then inexplicably touch a random wall with it to 'find the treasure' and end the game.

This got me thinking, 'how on earth were you meant to deduce that without help?'. Well I think the wizard who ominously pops up from time to time to the sound of thunder is trying to give you clues as to how to do it.
wizard1.png
First he appears touching the bottom left of a cross (the treasure is found in the bottom left block of a cross. X marks the spot after all!)
wizard2.png
wizard3.png
Then he appears holding a wand, which you need to access it, and finally he appears touching a wall. Admittedly, still pretty vague. So what do you reckon? Seeing what I want to see, or the developers leaving a subtle trail of breadcrumbs to follow?

Also, a sneaky shortcut. Tired of having to climb ladders, fight knights and jump over things to get the treasure? Just take a dip and chuck a wand into the air. Sure you'll soon drown, and you can't actually reach the treasure you've presumably spotted from a distance, but the game doesn't mind :D
shortcut.png
And finally, I'm baffled by the score. I'm assuming it must be time based or something as filling my rucksack with the extra bits of treasure lying around made the difference of about 20 points compared to just finishing the game giving you about 1700.
Last edited by bob147 on Wed Apr 13, 2022 3:30 pm, edited 1 time in total.
User avatar
Diminished
Posts: 1252
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Castle Quest - some random musings

Post by Diminished »

The cross theory is fairly compelling IMO.

This is one game that is ripe for a disassembly.
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

Given that time seems to be the dominant factor in giving you a score, I'm having fun working on a poor man's tool assisted speedrun (basically just save states rather than anything clever like frame by frame advancement). Shortcuts I've found so far:

-You can jump over the troll with a very well timed jump rather find the ruby
-You can manipulate the red knights by running backwards and forwards to get the aqualung, means you can skip the sword/spiders puzzle
-You can get the bucket by jumping off the ledge with the torch rather than dropping down after escaping jail.

The tricky bit at the moment is the witch, attacking from the back saves a ton of backtracking and there's just enough time to get off the ladder to get into water chucking position, but so far the witch is always quick enough to dodge my attack. Maybe the developer was onto that particular trick!

I also have a bad feeling that the stool from jail is required to escape the pit where the wand is held, meaning I can't get away with not going to jail.

Experimentation continues!
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

Speediest route I've found so far

-Go straight to jail, escape and save the stool
-When you drop down to the pink bricks area, jump so you land on the bridge, not in the water
-Jump right to the red knights guarding the aqualung, run around a bit until they get out the way, quickly grab the aqualung and dive into the water
-Go back up the ladder to the left, jump onto the ledge with the torch, jump and grab the bucket in midair, save and quickly switch to aqualung
-Fill up bucket using the ladder on right hand side, then climb it, go past the coin and down into the witch's lair!
-This is the horrible bit, drop off the ladder immediately, turn around immediately and blast the witch with the water. Took me lots of trys.
-Grab wand, use stool to escape, back up ladder, back into water
-Use the ending shortcut above, throw the wand up from the water to end the game.

2250 points, skips the sword/spiders puzzle, the ruby, the troll, having to backtrack past the troll/spiders to fight the witch the 'correct' way.
quick.png
VectorEyes
Posts: 574
Joined: Fri Apr 13, 2018 2:48 pm
Contact:

Re: Castle Quest - some random musings

Post by VectorEyes »

I just wanted to say that I'm absolutely amazed by these options. You can jump over the troll???

I always thought there was 'one way only' to solve the game, or at the very least considerably less variability than I've just seen discussed.
User avatar
Diminished
Posts: 1252
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Castle Quest - some random musings

Post by Diminished »

This recovering former speed runner approves of these discoveries. Games that can be solved "one way only" are a vanishingly small minority ...

(EDIT: inevitably I ended up tossing a RAM dump into a disassembler)
Last edited by Diminished on Wed Oct 27, 2021 11:02 pm, edited 1 time in total.
User avatar
Lardo Boffin
Posts: 2979
Joined: Thu Aug 06, 2015 7:47 am
Contact:

Re: Castle Quest - some random musings

Post by Lardo Boffin »

Great post! I had defeated the witch and got the wand in the past but don’t think I ever got the treasure. :shock:
Adventure Language on GitHub
Atom, issue 5, YARRB + video noise killer
Elk
A number of econetted (is that a word?) Beebs
BBC Master, Datacentre + HDD, pi co-proc, econet, NULA
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

I mean, you're right @VectorEyes. There's basically one solution to 'safely' finish the game. But when you're not trying to hang onto lives you can try stupid things and see what happens.

I'd say the timing to jump over the troll isn't practical in real time, it needs to be pretty much frame perfect. The knights as well, sometimes I find it easy to give them the run around, others they corner me and smash me like you'd expect. Whereas the alternate route to the bucket is quite easy to pull off.

@Diminished I'd love to see a disassembly some day, not just for scoring criteria but also whether the items have any extra uses/interactivity we don't know about or maybe unused parts of the map. If it's anything like your fine work on Citadel, we're in for a treat!
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

I've managed to record a BeebEm avi of my speedrun route, by far the biggest pain was manipulating the red knights to get out of the way. Turns out I was rather lucky the first few times I did that, 19 times out of 20 I get wiped out. I took advantage of a newly discovered bug where they miss you if you face the right hand wall at the top level (but only the first time, so be quick!).

It's 100mb so I won't put it here, at some point I'll work out how to upload to youtube.
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Castle Quest - some random musings

Post by lurkio »

bob147 wrote: Thu Oct 28, 2021 10:45 am I've managed to record a BeebEm avi of my speedrun route … It's 100mb so I won't put it here, at some point I'll work out how to upload to youtube.
I’ve sent you a Private Message with a Dropbox upload link so you can upload the video to me and I can share it via YouTube, if you want.

:idea:
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Castle Quest - some random musings

Post by lurkio »

Last edited by lurkio on Fri Oct 29, 2021 10:08 am, edited 1 time in total.
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

Thanks Lurkio! Now the whole world can watch an intrepid adventurer spend 30 seconds running away from some red knights :D
fuzzel
Posts: 1193
Joined: Sun Jan 02, 2005 1:16 pm
Location: Cullercoats, North Tyneside
Contact:

Re: Castle Quest - some random musings

Post by fuzzel »

Wow Bob! I’m seriously impressed. =D>
User avatar
Dave Footitt
Posts: 998
Joined: Thu Jun 22, 2006 10:31 am
Location: Abandoned Uranium Workings
Contact:

Re: Castle Quest - some random musings

Post by Dave Footitt »

Brilliant, I always wondered what that wizard holding the X was all about - it makes sense now :lol:
User avatar
ChrisB
Posts: 551
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Castle Quest - some random musings

Post by ChrisB »

Brilliant stuff. Obviously some room for improvement (red knights and a missed jump on exit from jail). Looking forward to you breaking the two minute barrier ;). I like that it feels like a proper speedrun using a glitch to avoid the red knights as well - just needs a clock in the top right (and a donate now button!).
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

Thanks for the kind words everyone. I was as amazed as anyone that a recorded run went that well but there are definitely things to improve.

Yes, I fell off the ladder at the jail, oops!

The awkward pause before I jump to the red knights is to let them shift from their starting positions which is basically on top of you if you jump straight away.

There's got to be a faster way to get past them. The glitch opens up new possibilities to try at least.

If I'm being hyper critical, there's nothing stopping you doing inventory on the move. I'm just easily confused with my hands crossing over the keyboard so I stop.

I'm also a bit paranoid about that glitch. I'd love to try it on real hardware using an original disk (or one of @scarybeasts dumps). Would hate for it to turn out to be emulator only. I'm doing all this using the bbcmicro.co.uk disk on beebem.
User avatar
scarybeasts
Posts: 1052
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Castle Quest - some random musings

Post by scarybeasts »

bob147 wrote: Thu Oct 28, 2021 10:45 am I've managed to record a BeebEm avi of my speedrun route, by far the biggest pain was manipulating the red knights to get out of the way. Turns out I was rather lucky the first few times I did that, 19 times out of 20 I get wiped out. I took advantage of a newly discovered bug where they miss you if you face the right hand wall at the top level (but only the first time, so be quick!).
This is fantastic work! I've been wanting to play Castle Quest through for a long time now (never completed in back in the day).

Would you be interested in making an input-level recording of a run through at all? This is a recording of key input events with timings. It can be played back deterministically. It's a bit like a video (with the emulator being the player), but with the powerful bonus that the recording can be exited, and control returned to the player, at any point in the playback. This gives CQ noobs like me the ability to experience arbitrary stages of the game.


Cheers
Chris
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

I know the kind of thing, like a tas (minus the frame perfect play). I would be happy to throw together a 'standard route' input recording, gives me an excuse to keep playing the game! :-D I assume BeebJit is capable of producing those? I've never done one before
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

@ScaryBeasts I had a go at making one of these. It's not a speed run at all, in fact play is quite poor. It finishes the game via the route I believe the dev intended it to be done, so a fair bit of backtracking and item management. It's also technically a 100% run as it finishes the game with all 3 pieces of treasure in the rucksack which is entirely optional.

I used rewind a bunch of times to fix mistakes. One time a rewind caused a key to get stuck down until I mashed the keys to get back control. That's why I'm running around in the water seemingly at random!

Also, is there a way to switch the PC's # key with the ' key (I think BeebEm calls it 'logical layout)? The main reason I had trouble is because the up key isn't above the down key! Maybe it's a keyboard layout thing, but there's no way I could try to recreate that speed run with the up key so far away :)

The settings are stock except I enabled interpreter on the command line. I also used the HFE of the original protected disk from your archive for a teeny bit more authenticity :D

\beebjit.exe -mode interp -0 Castle_Quest_FSD0072_1.hfe -replay quest.cap

It was fun to do, especially rewinding time to fix blunders. A very nice feature indeed.
Attachments
quest.zip
(5.57 KiB) Downloaded 64 times
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Castle Quest - some random musings

Post by lurkio »

bob147 wrote: Mon Nov 01, 2021 9:04 am It was fun to do, especially rewinding time to fix blunders. A very nice feature indeed.
That was a great playthrough, and "-replay" is a very neat feature of Beebjit.

I presume the rewinds don't get captured in the .cap file, then..?

:?:
User avatar
scarybeasts
Posts: 1052
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Castle Quest - some random musings

Post by scarybeasts »

bob147 wrote: Mon Nov 01, 2021 9:04 am \beebjit.exe -mode interp -0 Castle_Quest_FSD0072_1.hfe -replay quest.cap

It was fun to do, especially rewinding time to fix blunders. A very nice feature indeed.
Wow wow wow! It was such a treat to watch that, it made my train ride very enjoyable! Having never completed the game, I had no idea that a smooth run through doesn't take so long.

I love the way the replay file is just 5KB. On my reasonably fast laptop, -mode interp can do the replay in fast mode in about 1 second. It's quite a trip.

It replays correctly on my in-development branch of beebjit. So it does suggest the timings are reasonably stable these days, even with an exotic things like a copy protected disc.
In fact, I think beebjit timings are pretty stable these days, so any future timing changes might be infrequent enough to make them switchable. At the cost of a bit of code complexity, I could maintain compatibility with current replay files.

Thanks for using -mode interp! I did notice that -mode jit does _not_ replay correctly -- argh! This was my fear, and why I recommended the simpler -mode interp for recording. At first I was :cryface: about this but on reflection, I'm :happyface:. beebjit has a ton of timing tests but something about this Castle Quest replay is exposing an untested corner case. I'll track it down, add a test and fix it :)

I'm surprised the rewind mode worked; I think I had problems with it when I was trying to get an insane Arcadians score. I'll look in to it again and make sure the stuck key bug is addressed.
I'll also look at supporting better keyboard mapping options. That's a longstanding missing feature. Thanks for the feedback.


Cheers
Chris
User avatar
scarybeasts
Posts: 1052
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Castle Quest - some random musings

Post by scarybeasts »

lurkio wrote: Mon Nov 01, 2021 10:13 pm I presume the rewinds don't get captured in the .cap file, then..?

:?:
That's correct. Longer term, perhaps that could be an option. And if excessive rewinds are used in a short time period, the Benny Hill theme music could automatically play :D


Cheers
Chris
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Castle Quest - some random musings

Post by lurkio »

scarybeasts wrote: Tue Nov 02, 2021 5:07 am At the cost of a bit of code complexity, I could maintain compatibility with current replay file ... I'll track it down, add a test and fix it ... I'll look in to it again and make sure the stuck key bug is addressed ... I'll also look at supporting better keyboard mapping options
While you're at it, how about a native Apple Silicon version? :wink:

I'm currently running Beebjit under CrossOver (a WINE wrapper) which is itself running under Rosetta 2! It's fairly performant nevertheless, but a native version would be great.

:?:
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

Glad you guys enjoyed it. I like the idea of some day being able to create a true TAS using rewind to correct even the smallest mistake and get that time down to the absolute minimum. Another possibility is a '100% tas', though I have a feeling that the extra time needed to grab all the gems will cancel out the time bonus and the score will be pretty much the same. Maybe after that, I can finally put this game down and play something else! :wink:

I agree that the ending cut off is quite arbitrary. I was convinced when I was a kid that if I could just defeat the witch and get that wand, its magical powers would surely allow access to whole new parts of the castle. I guess 32kb of RAM put a stop to that! :lol: Perhaps it's time to try and learn some 6502 assembly and create the expansion pack that never was.

EDIT - I meant to say @ScaryBeasts, thanks for pointing out you can replay in turbo mode, that 1 second playthrough was hillarious! :lol:
User avatar
Diminished
Posts: 1252
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Castle Quest - some random musings

Post by Diminished »

bob147 wrote: Tue Nov 02, 2021 10:55 amexpansion pack
In my very brief look at the game's code, I have two observations about this:

1. This game is actually quite commendable in a sense for using the entire MODE 2 screen (20K), which means that all of the game's code, data and variables have to fit into 12K. Contrast this with Citadel, which reprogrammed the CRTC to letterbox the screen down to 16K, freeing up an extra 4K for the game. You could gain some extra memory if you chose to do some letterboxing.

2. Sprites in Castle Quest aren't compressed. You can see this by taking a RAM dump of the game in an emulator (0 -> &2FFF) and just *LOADing it as a MODE 2 screen, whereupon the game's sprites are clearly visible amongst the machine code noise. Meanwhile, Citadel used a sprite compression algorithm. I'm not sure precisely how much memory this saves, but probably a lot.
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

Just had a peek at your disassembly @Diminished. In particular the strings (being the only thing I can understand as assembly is a foreign language to me!). No unused items sadly, even all four torches in the game have separate entries.

But there is an unused death message 'YOU STARVED'. There is as far as I know, no food mechanic at all in the game. But I am going to run it in BeebJit turbo mode to see if it's a timeout which can be triggered after an obscene amount of time.

EDIT - ahah, it's specifically in prison, if you spend an unusually long time stuck in prison, you get this!
starve.png
User avatar
Diminished
Posts: 1252
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Castle Quest - some random musings

Post by Diminished »

bob147 wrote: Tue Nov 02, 2021 2:56 pm Just had a peek at your disassembly @Diminished. In particular the strings (being the only thing I can understand as assembly is a foreign language to me!). No unused items sadly, even all four torches in the game have separate entries.
I would like to do some more work on that, but there is another retro project taking up my time right now ...
But there is an unused death message 'YOU STARVED'. There is as far as I know, no food mechanic at all in the game. But I am going to run it in BeebJit turbo mode to see if it's a timeout which can be triggered after an obscene amount of time.

EDIT - ahah, it's specifically in prison, if you spend an unusually long time stuck in prison, you get this!
starve.png
I actually meant to ask about this, since I never saw that message BITD either. I think most people just hit ESCAPE once they were trapped in there!

Do the item name strings actually appear in-game? I don't remember seeing them.
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

Great minds and all that :D what's odd about it is that you can just run into the guard and die if you get stuck and it restarts you outside the prison.

Meanwhile, if you drop into the witch's pit where the wand is without the stool, you're stuffed. No starvation to save you there!

Yes, if you press i whilst holding an item, the game pauses and its name appears on the status bar (or 'EMPTY' if you're holding nothing). Press i again to get the score. Press i a 3rd time to resume the game.
User avatar
scarybeasts
Posts: 1052
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Castle Quest - some random musings

Post by scarybeasts »

bob147 wrote: Tue Nov 02, 2021 10:55 am Glad you guys enjoyed it.
One more confession: I just ran the reply right up until the point where the witch appears, then exited the replay. And I gave her a good bucket full of water! Take that! Very cathartic.


Cheers
Chris
bob147
Posts: 342
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Castle Quest - some random musings

Post by bob147 »

@ScaryBeasts she can dodge it if you throw the water too early, nice touch by the developer I thought!
Post Reply

Return to “8-bit acorn software: classic games”