Skip to navigation

Tubewalker: The Tube, on Foot

Contact Me: Guestbook

Author Message
Namor

Subject: Elite Moray ship
Posted: 16 Apr 2024 12:16 pm


Dear Mark,
thank you for the great job you've done on the Elite source code. The source with your commentaries was really easy to read.

I was wondering if you might remember a particular issue in the code: it looks to me as if Moray type spaceship is never spawned in any of the versions documented on your site (apart from Elite-A).

My theory is that a particular portion of the code where it is supposed to be spawned is the Main loop part 4 of 6 (see copypaste below), but the the carry flag is actually supposed to be 1 instead of 0, e.g. BCC instead of BCS should be used. That would make the potential list of bounty hounters: Asp Mk II, Python (pirate), Fer-de-lance or Moray. Somehow this misprint in the code was repeated in every single version of the game. Would you be able to confirm my suspicion?

CMP #100 \ If the random number in A >= 100 (61% chance), jump
BCS mt1 \ to mt1 to spawn pirates, otherwise keep going to
\ spawn a lone bounty hunter

INC EV \ Increase the extra vessels spawning counter, to
\ prevent the next attempt to spawn extra vessels

AND #3 \ Set A = random number in the range 0-3, which we
\ will now use to determine the type of ship

ADC #CYL2 \ Add A to #CYL2 (we know the C flag is clear as we
\ passed through the BCS above), so A is now one of the
\ lone bounty hunter ships, i.e. Cobra Mk III (pirate),
\ Asp Mk II, Python (pirate) or Fer-de-lance

Post a Reply

Namor

Subject: Elite Moray ship
Posted: 16 Apr 2024 12:42 pm


I am sorry, I have forgotten to include a link to the code.
There you go:
https://www.bbcelite.com/disc/flight/subroutine/main_game_loop_part_4_of_6.html

Post a Reply

Mark Moxon

Subject: The Moray does not spawn
Posted: 17 Apr 2024 8:58 am


Hello Namor.

You know what, I think you are right! I hadn't realised that the Moray never gets spawned, but your analysis looks totally correct to me. That's fascinating!

It could easily be added to the list of spawning pirate ships with the addition of a single LSR A instruction just before the AND #3, which would set the C flag randomly and increase the range of A to 0-4, thus including ship #28.

And as you say, Elite-A does spawn the Moray, as the ship files are organised differently.

Brilliant! I will add this to my commentary, and might even roll the fix into my Compendium versions - I think there might be room for one more byte of code. 😀

I will also credit you with this discovery on the acknowledgements page, if that's OK. Well spotted!

Mark

Post a Reply

Roman

Subject: Elite ramdom events
Posted: 17 Apr 2024 11:26 am


Hi, Mark!
Thank you for checking this.
(And sorry for using the anagram of the name in the previous post -- I always have some doubts about using the actual name on the web)

These little things are actually what partly makes digital archaeology interesting: given the asteroids bug in the released version and ships position problem, we certainly have the impression that random events where nightmarish to debug for Ian and David.

"LSR A" instruction certainly fixes the problem, but it gives ships #25-27 a higher probability of spawning. Looks fine to me though, since we will never know the original developer's intention. Most probably they won't remember this after 40 years.

Feel free to update the commentary with or without acknowledgement -- both options are completely fine with me. Roman is my actual name.

Post a Reply

Mark Moxon

Subject: Spawning code
Posted: 19 Apr 2024 11:13 am


Hi Roman!

Thank you so much, I have added your observation to the commentary and have given you a well-deserved credit on the acknowledgements page:

https://www.bbcelite.com/about_site/acknowledgements.html

Thank you!

A couple of interesting points spring to mind.

1. You said "LSR A instruction certainly fixes the problem, but it gives ships #25-27 a higher probability of spawning." I'm not sure this is true; an ASL A would indeed give #25-27 a higher probability of spawning, as bit #7 of A is more likely to be set following the CMP, but I don't think an LSR A would change the probability, as bits 0-3 of A are all still random at that point. I think this is right, anyway...

2. Looking at the code, I suspect that a SEC before the ADC might be my preferred solution, anyway.

* SEC would change the range to 25 to 28, which would cover the Asp Mk II, Python (pirate), Fer-de-lance and Moray.

* LSR A would give a range of 24 to 28, which would cover the Cobra Mk III (pirate), Asp Mk II, Python (pirate), Fer-de-lance and Moray.

It's hard to know what the authors' original intent was, but the Cobra Mk III (pirate) can already be spawned as part of a group of pirates, so I suspect the first fix might be the correct one, as then there is no overlap between pirates and bounty hunters. It's a guess, though! They might have wanted the iconic Cobra to be spawned as both a pirate and a bounty hunter, of course.

It's very interesting stuff - thanks for getting in touch!

Mark

Post a Reply

Roman

Subject: Probabilities
Posted: 19 Apr 2024 4:07 pm


Hi, Mark!
Thank you for the acknowledgements!

I would like to share some thoughts about options 1 and 2.

1) LSR A
I might be wrong, but I was thinking along the following lines:
The only way to spawn Cobra would be #%0000 in the bits 0-3 of the A register before the "LSR A". The only way to spawn Moray would be to have #%1111 . On the other hand ship#26 (Asp) is spawned by both #%0001 and #%0010 .

Or to put it the other way: carry bit has equal probabilities of 0 and 1 after the "LSR A", while the A register has equal probabilities of 0-3 after the "And #3" instruction. Thus the probability of their sum would be larger to be #1-3 than to be #0 or #4.

Anyway, that actually makes some sense. I looked up the "Dark wheel" novel that was published with the game and Moray ship is mentioned as being very rare. That may refer to the fact of Moray being present in a single blueprint file though. Having lower probability of Cobra III makes sense too -- since it is already spawned as pack hunter.

2)SEC might actually be a waste of a precious byte in my opinion.
Instead I would change these instructions:
CMP #100
BCS mt1

to the following:
CMP #145
BCC mt1

My guess is that this may be what actually happened during the development, it is very easy to erroneously print BCS instead of BCC.

3) As a side-note -- I want to mention that your reference to the Minsky cycles is very educative. It never occurred to me the the simplest way to draw a circle would result in a spiral instead. These tricks were probably not very relevant for a while -- we could calculate sin/cos instead without much trouble. But some of these are getting useful once again, since we are about to have a simple computer in every utensil today.

Post a Reply

Mark Moxon

Subject: Moray options
Posted: 21 Apr 2024 10:18 am


Hi Roman.

1. Good point! You are absolutely right, of course - and it's a great example of the complexity that comes from just one simple instruction. I really like the way this approach makes the Moray much rarer than the others, while still keeping the Cobra in the running, just like the original. Great explanation, thank you. 😀

2. Very nice, that would be a much more efficient way of doing it (and every byte counts in this game!). I still think I prefer option 1 for my bug fix version, but this is very neat.

3. I have to thank Rich Talbot-Watkins on Stardot for mentioning Minsky in this context, or I might not have spotted it! It's extremely clever stuff - it makes my mind bend, in a good way.

Thanks for sharing your thoughts, really appreciate it!

Mark

Post a Reply