BBC Elite source, now fully documented and explained

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


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

Re: BBC Elite source, now fully documented and explained

Post by bob147 »

Interesting stuff, I'm glad the Master version is amenable to a fun strategy at least, I take it the two ships that are worth 5 points are too rare to be worth seeking out? (I'm an elite newbie, that might be a silly question!)

Also curious that Braben and Bell left in what is effectively a cheat code to instantly get to witch space. I imagine with space so tight that was a big decision, presumably that area needed heavy testing.
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

bob147 wrote: Tue Feb 21, 2023 8:12 am Interesting stuff, I'm glad the Master version is amenable to a fun strategy at least, I take it the two ships that are worth 5 points are too rare to be worth seeking out? (I'm an elite newbie, that might be a silly question!)
Yes, the Constrictor only appears in mission 1, so that's once in the entire game, and while the Cougar can appear throughout the game, it is super-rare. This article describes just how rare:

https://www.bbcelite.com/deep_dives/the ... ougar.html

Good luck tracking that down!
bob147 wrote: Tue Feb 21, 2023 8:12 am Also curious that Braben and Bell left in what is effectively a cheat code to instantly get to witch space. I imagine with space so tight that was a big decision, presumably that area needed heavy testing.
True, though the save file does record whether this cheat has ever been used, so you couldn't use it to cheat your way to winning their competition - at least they slammed that door shut. Check out bit 0 of the competition flags in this article for more info:

https://www.bbcelite.com/deep_dives/the ... _code.html

I'm glad they left it in, though, along with the author names on the title screen. I love a good easter egg!

Mark
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

For those following along, I have now released a version of the original 1984 BBC Micro Elite, with flicker-free ships and planets. It runs on a BBC Master, as there just isn't enough memory to squeeze the planet code into the original, but it's still the original, classic Beeb version.
Enjoy!

Mark
strawberrytau
Posts: 101
Joined: Sun Mar 11, 2018 8:58 am
Contact:

Re: BBC Elite source, now fully documented and explained

Post by strawberrytau »

Awesome stuff Mark! Any chance it could work on a Model B with sideways RAM?
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

Oops! I posted this update to the wrong thread, meant to post it to the flicker-free planet one. I guess it works in both places. :D
strawberrytau wrote: Wed Feb 22, 2023 6:27 pm Awesome stuff Mark! Any chance it could work on a Model B with sideways RAM?
Maybe! I’m thinking of trying to bundle the flicker-free code along with the music in a sideways RAM bonanza BBC Micro version. It should work…

Mark
strawberrytau
Posts: 101
Joined: Sun Mar 11, 2018 8:58 am
Contact:

Re: BBC Elite source, now fully documented and explained

Post by strawberrytau »

MarkMoxon wrote: Wed Feb 22, 2023 6:41 pm
Maybe! I’m thinking of trying to bundle the flicker-free code along with the music in a sideways RAM bonanza BBC Micro version. It should work…

Mark
Excellent news! Hope it works!
AJW
Posts: 984
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by AJW »

How hard would it have been to have implented a reward for achieving Elite? After all that was the purpose of the game and also the theme of the novel. Like an upgraded ship or immunity from vipers etc? That would be an incentive to carry on beyond mission 2.
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

AJW wrote: Wed Feb 22, 2023 9:00 pm How hard would it have been to have implented a reward for achieving Elite? After all that was the purpose of the game and also the theme of the novel. Like an upgraded ship or immunity from vipers etc? That would be an incentive to carry on beyond mission 2.
It would be pretty easy. This logic only runs the specified code if you are ranked Elite:

Code: Select all

 ...
 
 LDA TALLY+1
 CMP #25
 BCC skip

 <insert code for Elite-only feature>

.skip

 ...
Change the BCC to a BCS and you have code that only runs if you aren't yet Elite.

Given that the flight code has a few spare bytes, the authors could have wrapped a handful of features in this logic relatively easily, Viper immunity included!

Mark
AJW
Posts: 984
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by AJW »

:D you'd need a double byte for 6400 though? 😉
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

AJW wrote: Wed Feb 22, 2023 9:41 pm :D you'd need a double byte for 6400 though? 😉
Correct, the kill tally is stored in a double byte at TALLY and TALLY+1, but 6400 = &1900, so you only need to check the high byte in TALLY+1 to see if you are Elite. Same with all four higher ranks - they are all multiples of 256, so the high byte is the only one you need to check - it doesn’t matter what the value of the low byte is for this purpose.

See https://www.bbcelite.com/deep_dives/combat_rank.html for the low-down.

Mark
AJW
Posts: 984
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by AJW »

Do the space stations keep a hit tally like the ships?

Also can you jump out of hyperspace or to a new system?

Presumably Angus D. didn't add further missions?

Are there maximums for number of ships in local vicinity? (Apologies if I've missed that on the website).

One other question you might not have considered- how much of the planet names and details are preserved in Arcelite? Any plans to dissect that?
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

AJW wrote: Fri Feb 24, 2023 9:32 am Do the space stations keep a hit tally like the ships?
No, they just have an on/off flag that determines whether or not the station is hostile (in which case it sends out Vipers and closes its docking bay so you can't dock). You can hit the station as many times as you like, but nothing gets through the shields.
AJW wrote: Fri Feb 24, 2023 9:32 am Also can you jump out of hyperspace or to a new system?
You can force a mis-jump during hyperspace as mentioned above, taking you to a random spot in interstellar space, and you can then jump from there to a system, assuming you have enough fuel. Apart from that, you can only jump between systems.
AJW wrote: Fri Feb 24, 2023 9:32 am Presumably Angus D. didn't add further missions?
Correct, there are no new missions in Elite-A.
AJW wrote: Fri Feb 24, 2023 9:32 am Are there maximums for number of ships in local vicinity? (Apologies if I've missed that on the website).
There's always one slot for the planet and one slot for the sun or space station. Then there are 10 more slots for ships, unless you're on the 6502 Second Processor, in which case it's 18 more slots for ships (that's one of the reasons why this version is noticeably harder). See "Max. ships in the local bubble" here:

https://www.bbcelite.com/compare/featur ... rison.html

AJW wrote: Fri Feb 24, 2023 9:32 am One other question you might not have considered- how much of the planet names and details are preserved in Arcelite? Any plans to dissect that?
The exact same algorithm is used, so in theory the systems and details match exactly. This was one of the few things that got copied over from the original versions to the Archimedes version. This Acorn User article by co-author Clive Gringras is a great read if you want to know more:

http://elite.acornarcade.com/archive/inter.htm

I honestly don't understand the bit about having to make a 6502 emulator for the algorithm, as it's easy to replicate the procedural generation in modern languages (I've done it myself in Python, so they could have written it in C). But this is by one of the co-authors, so it's straight from the horse's mouth!

The same article talks about how most of the game is written in C, so I'm not sure I'm that interested in dissecting it. If I were going to jump ship to dissecting ARM code, I think I'd probably start with Lander, as that totally blew my mind, and is purely in ARM1 code... :shock:

Mark
AJW
Posts: 984
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by AJW »

MarkMoxon wrote: Fri Feb 24, 2023 12:04 pm
AJW wrote: Fri Feb 24, 2023 9:32 am Do the space stations keep a hit tally like the ships?
No, they just have an on/off flag that determines whether or not the station is hostile (in which case it sends out Vipers and closes its docking bay so you can't dock). You can hit the station as many times as you like, but nothing gets through the shields.
AJW wrote: Fri Feb 24, 2023 9:32 am Also can you jump out of hyperspace or to a new system?
You can force a mis-jump during hyperspace as mentioned above, taking you to a random spot in interstellar space, and you can then jump from there to a system, assuming you have enough fuel. Apart from that, you can only jump between systems.
I meant can you jump out of "witch space" or more unlikely jump from one system to another if done long enough?
AJW wrote: Fri Feb 24, 2023 9:32 am Presumably Angus D. didn't add further missions?
Correct, there are no new missions in Elite-A.
AJW wrote: Fri Feb 24, 2023 9:32 am Are there maximums for number of ships in local vicinity? (Apologies if I've missed that on the website).
There's always one slot for the planet and one slot for the sun or space station. Then there are 10 more slots for ships, unless you're on the 6502 Second Processor, in which case it's 18 more slots for ships (that's one of the reasons why this version is noticeably harder). See "Max. ships in the local bubble" here:

https://www.bbcelite.com/compare/featur ... rison.html
I did miss it thanks.
AJW wrote: Fri Feb 24, 2023 9:32 am One other question you might not have considered- how much of the planet names and details are preserved in Arcelite? Any plans to dissect that?
The exact same algorithm is used, so in theory the systems and details match exactly. This was one of the few things that got copied over from the original versions to the Archimedes version. This Acorn User article by co-author Clive Gringras is a great read if you want to know more:

http://elite.acornarcade.com/archive/inter.htm
I'll have a read thanks, must have read it a long time ago.
I honestly don't understand the bit about having to make a 6502 emulator for the algorithm, as it's easy to replicate the procedural generation in modern languages (I've done it myself in Python, so they could have written it in C). But this is by one of the co-authors, so it's straight from the horse's mouth!

The same article talks about how most of the game is written in C, so I'm not sure I'm that interested in dissecting it. If I were going to jump ship to dissecting ARM code, I think I'd probably start with Lander, as that totally blew my mind, and is purely in ARM1 code... :shock:

Mark
I agree 6502 and ARM code are more appealing somehow.

One more thing, did the energy unit or naval energy unit actually do anything? I could never tell.
User avatar
davidb
Posts: 3395
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by davidb »

MarkMoxon wrote: Fri Feb 24, 2023 12:04 pm There's always one slot for the planet and one slot for the sun or space station. Then there are 10 more slots for ships, unless you're on the 6502 Second Processor, in which case it's 18 more slots for ships (that's one of the reasons why this version is noticeably harder). See "Max. ships in the local bubble" here:

https://www.bbcelite.com/compare/featur ... rison.html
What happens to the slots for the planet and sun/station in witchspace? Are they reserved, or do they get used for ships?

An Electron asks because we didn't have witchspace... :(
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

AJW wrote: Fri Feb 24, 2023 9:41 pm
MarkMoxon wrote: Fri Feb 24, 2023 12:04 pm
AJW wrote: Fri Feb 24, 2023 9:32 am Also can you jump out of hyperspace or to a new system?
You can force a mis-jump during hyperspace as mentioned above, taking you to a random spot in interstellar space, and you can then jump from there to a system, assuming you have enough fuel. Apart from that, you can only jump between systems.
I meant can you jump out of "witch space" or more unlikely jump from one system to another if done long enough?
Not 100% sure what you mean, but there are only two ways of moving between systems.

1. Normal hyperspace. You select a destination system, you hyperspace jump, and you arrive there.

2. Mis-jump. Rarely, hyperspace jumps go wrong, and you end up stranded in witchspace with a bunch of Thargoids. There are fewer particles of stardust in witchspace, so it's really obvious when this happens, and on the galactic chart you will find yourself at a random spot between systems, lost in interstellar space. You can escape witchspace by hyperspacing to a nearby system if one is close enough (and assuming the Thargoids don't get you).

That's it for travel between systems. You can also jump within a system, using "J", but you never leave the system that way.
AJW wrote: Fri Feb 24, 2023 9:41 pm One more thing, did the energy unit or naval energy unit actually do anything? I could never tell.
They increase the rate at which your energy banks recharge, which really helps in the heat of battle.

No energy unit = recharge by 1 unit on each iteration of the main loop

Standard energy unit = recharge by 2 units on each iteration

Navy extra energy unit = recharge by 3 units on each iteration

Definitely worth having!

Mark
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

davidb wrote: Fri Feb 24, 2023 10:25 pm
MarkMoxon wrote: Fri Feb 24, 2023 12:04 pm There's always one slot for the planet and one slot for the sun or space station. Then there are 10 more slots for ships, unless you're on the 6502 Second Processor, in which case it's 18 more slots for ships (that's one of the reasons why this version is noticeably harder). See "Max. ships in the local bubble" here:

https://www.bbcelite.com/compare/featur ... rison.html
What happens to the slots for the planet and sun/station in witchspace? Are they reserved, or do they get used for ships?

An Electron asks because we didn't have witchspace... :(
Good question! I had to check, and it turns out they are used to store ships (i.e. Thargoids and Thargoids) instead of the planet and sun.

The routines to spawn the planet and sun, which are normally called on arrival in a new system, are not called on arrival in witchspace, and instead Thargoids are spawned, starting with the first free slot (which is normally used by the planet). You always get four Thargoids and four Thargons on arrival in witchspace, so there is space for each Thargoid to release one more Thargon (which they do when their energy reserves drop, up to a maximum of 6 Thargons dropped by each Thargoid).

In witchspace, there are literally no suns or planets... just aliens.

Mark
User avatar
trixster
Posts: 1173
Joined: Wed May 06, 2015 12:45 pm
Location: York
Contact:

Re: BBC Elite source, now fully documented and explained

Post by trixster »

So, any Space Dregers or Generation Ships ?! :) :D
cjpinder
Posts: 31
Joined: Fri Jul 03, 2020 6:00 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by cjpinder »

MarkMoxon wrote: Fri Feb 24, 2023 12:04 pm
The exact same algorithm is used, so in theory the systems and details match exactly. This was one of the few things that got copied over from the original versions to the Archimedes version. This Acorn User article by co-author Clive Gringras is a great read if you want to know more:

http://elite.acornarcade.com/archive/inter.htm

I honestly don't understand the bit about having to make a 6502 emulator for the algorithm, as it's easy to replicate the procedural generation in modern languages (I've done it myself in Python, so they could have written it in C). But this is by one of the co-authors, so it's straight from the horse's mouth!
That article isn't actually correct. ArcElite uses a C implementation of of the galaxy generation, not the 6502 code running under an emulator. It's also not exactly the same as the BBC code, there are a few minor bits it does differently.

Thanks,
Christian.
AJW
Posts: 984
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by AJW »

trixster wrote: Fri Feb 24, 2023 11:34 pm So, any Space Dregers or Generation Ships ?! :) :D
No sorry.
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

cjpinder wrote: Sat Feb 25, 2023 12:03 am
MarkMoxon wrote: Fri Feb 24, 2023 12:04 pm
The exact same algorithm is used, so in theory the systems and details match exactly. This was one of the few things that got copied over from the original versions to the Archimedes version. This Acorn User article by co-author Clive Gringras is a great read if you want to know more:

http://elite.acornarcade.com/archive/inter.htm

I honestly don't understand the bit about having to make a 6502 emulator for the algorithm, as it's easy to replicate the procedural generation in modern languages (I've done it myself in Python, so they could have written it in C). But this is by one of the co-authors, so it's straight from the horse's mouth!
That article isn't actually correct. ArcElite uses a C implementation of of the galaxy generation, not the 6502 code running under an emulator. It's also not exactly the same as the BBC code, there are a few minor bits it does differently.
Thank you Christian, that’s interesting. I wonder where Clive got that memory from? Perhaps an early version used the 6502 emulator as part of a simple lift-and-shift of the original source, and later they realised it wasn’t that complex and could be easily recoded in C. Remembering code history from the days before ubiquitous source control is always a tricky business!

Mark
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

:-({|=
AJW wrote: Sat Feb 25, 2023 8:05 am
trixster wrote: Fri Feb 24, 2023 11:34 pm So, any Space Dregers or Generation Ships ?! :) :D
No sorry.
And no Raxxla, either. Ah, well… :cry:

Mark
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: BBC Elite source, now fully documented and explained

Post by BigEd »

MarkMoxon wrote: Fri Feb 24, 2023 10:30 pm Rarely, hyperspace jumps go wrong, and you end up stranded in witchspace with a bunch of Thargoids. There are fewer particles of stardust in witchspace, so it's really obvious when this happens, and on the galactic chart you will find yourself at a random spot between systems, lost in interstellar space. You can escape witchspace by hyperspacing to a nearby system if one is close enough (and assuming the Thargoids don't get you).
Is the code for this described anywhere? I had a poke around bbcelite.com and didn't find anything...
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

BigEd wrote: Sat Feb 25, 2023 12:19 pm
MarkMoxon wrote: Fri Feb 24, 2023 10:30 pm Rarely, hyperspace jumps go wrong, and you end up stranded in witchspace with a bunch of Thargoids. There are fewer particles of stardust in witchspace, so it's really obvious when this happens, and on the galactic chart you will find yourself at a random spot between systems, lost in interstellar space. You can escape witchspace by hyperspacing to a nearby system if one is close enough (and assuming the Thargoids don't get you).
Is the code for this described anywhere? I had a poke around bbcelite.com and didn't find anything...
It is - here are the relevant parts of the code.

Hyperspace jumps are handled by the TT18 routine, which is called when the hyperspace counter runs down:

https://www.bbcelite.com/cassette/main/ ... /tt18.html

In the middle of this routine you can see a random number check that produces a mis-jump around 1% of the time, in which case the code jumps to MJP to show a second hyperspace tunnel and process a mis-jump into witchspace:

https://www.bbcelite.com/cassette/main/ ... e/mjp.html

It also jumps to MJP if CTRL is held down and the "pause and press X" cheat is enabled, in which case ptg is non-zero.

Hope this helps!

Mark
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: BBC Elite source, now fully documented and explained

Post by BigEd »

Excellent thanks!
AJW
Posts: 984
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by AJW »

Just noticed that you, Mark, were the editor in the Acorn User Elite special from 1995 which I still have. So one more thing to thank you for. It also mentions Starfighter 3000 for the 3D0 which Nathan Atkinson was kind enough to let me do the title screen for when it was later ported for RISC OS.
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by MarkMoxon »

AJW wrote: Sun Feb 26, 2023 9:02 pm Just noticed that you, Mark, were the editor in the Acorn User Elite special from 1995 which I still have. So one more thing to thank you for. It also mentions Starfighter 3000 for the 3D0 which Nathan Atkinson was kind enough to let me do the title screen for when it was later ported for RISC OS.
Such happy memories! I was so pleased to be able to put Arc Elite on the cover disc back then; I mean, the cover discs were generally OK, but the full version of Archimedes Elite? That was a real result! I was thrilled. Whoever negotiated that deal deserves an award (I think it came via the ad team - my memory is a bit unreliable here, but I don't think I can take any credit). I insisted on writing the articles about it myself, though; I couldn't believe that this was my job. :-)

And Starfighter 3000 is absolutely another seminal Arc title. Respect is due for the title screen! =D>

Mark
AJW
Posts: 984
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by AJW »

It'd be really interesting to add a column in your version features table for ArcElite. Hope I can find time to do some research and fill some of the entries in.
AJW
Posts: 984
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by AJW »

Have noticed that Arcelite doesn't seem to go beyond 13 craft maximum in range. Also the space station can be destroyed with cheat module. And there are 25 stated ships I think.
gfoot
Posts: 987
Joined: Tue Apr 14, 2020 9:05 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by gfoot »

I've been wondering how much of the Second Processor version of Elite could run on my Supershadow add-on to a regular Beeb. The add-on provides all the RAM and general environment of the 6502 Second Processor, but without the CPU itself.

So anything constrained by memory would now be unconstrained, but things constrained by CPU power would still need to be limited. I'm interested in where this balance would fall.

It should be possible for example to run in MODE 1/MODE 2 to get the extra colours, so long as its not too expensive in processor time to draw with more colours. More ship blueprints would also fit in memory, but there may not be enough CPU time to animate as many active ships as on the Second Processor.

Recently I saw a comment about flicker-free planet drawing not fitting in a regular Beeb due to lack of memory, so that should also be possible with my add-on.

Do you guys have a general feel for how much the Second Processor version benefits from either the parallelisation of having two CPUs, or the faster speed and instruction set of the 65C02?
B3_B3_B3
Posts: 404
Joined: Sat Apr 08, 2017 10:42 pm
Contact:

Re: BBC Elite source, now fully documented and explained

Post by B3_B3_B3 »

Just try it?
Post Reply

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