New: fully documented source code for Lander

subjects relating to classic games for the archimedes and risc pc
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

sirbod wrote: Wed Feb 21, 2024 1:10 pm
MarkMoxon wrote: Wed Feb 21, 2024 12:57 pm And thank you for your super-detailed analysis of all that amazing optimisation work you've done for Zarch. Absolutely incredible stuff, very inspirational. It's all well beyond my coding skills - I think I'm better at documenting the mess than fixing it!
I just wish I could release it.

Given your documentation skills, perhaps you could figure out how to up the frame rate and keep everything in sync...its eluded me so far as there's so many hard-coded values for time and rotation.
Yeah, it's not really built for being able to vary the speed - I guess Braben was aiming for "go as fast as possible", much like Elite (which is why the latter is all but unplayable on a Master co-pro). I'll see what I can spot as I document things.

I know it's been discussed, but is there any chance your work could be released as a patch? Then at least you could get it out - people would really like to see the results, though I guess you know that already...

Mark
sirbod
Posts: 1624
Joined: Mon Apr 09, 2012 9:44 am
Location: Essex
Contact:

Re: New: fully documented source code for Lander

Post by sirbod »

MarkMoxon wrote: Wed Feb 21, 2024 1:23 pm Yeah, it's not really built for being able to vary the speed - I guess Braben was aiming for "go as fast as possible", much like Elite (which is why the latter is all but unplayable on a Master co-pro). I'll see what I can spot as I document things.
Thanks
MarkMoxon wrote: Wed Feb 21, 2024 1:23 pm I know it's been discussed, but is there any chance your work could be released as a patch? Then at least you could get it out - people would really like to see the results, though I guess you know that already...
That's the plan, although there's no easy way to diff it without releasing the whole thing. Then there's the issue of the original using obfuscated code and everything else being a pirated copy. As the aim of JASPP is to legally release games, I really should gain approval from Superior Software.

Every Superior Software developer except DB has granted approval for their game(s) to be released, although I can't get a response from Superior to see if they're willing to allow them. DB hasn't responded to date.
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

sirbod wrote: Wed Feb 21, 2024 1:39 pm As the aim of JASPP is to legally release games, I really should gain approval from Superior Software.
Absolutely. Can't argue with that position!

We can hope, I guess...

Mark
User avatar
spanners
Posts: 178
Joined: Fri Mar 23, 2018 2:37 pm
Location: Glasgow
Contact:

Re: New: fully documented source code for Lander

Post by spanners »

I'm hunting around my server and I can't find it right now, but there's a patch for Zarch (not Lander) to make it run in the desktop. It's *not* WimpZarch <http://www.bass-software.com/wimpzarch/> but it's the patch that WimpZarch was based on and is mentioned in its !Help as coming from Arcade.

Now the interesting thing about it is that it's a RISC OS 2 desktop app, but the source predates RISC OS 2, so it must have been developed in Acorn while RO2 was in production.

It was definitely on a PD disc somewhere...

D.
User avatar
IanJeffray
Posts: 5963
Joined: Sat Jun 06, 2020 3:50 pm
Contact:

Re: New: fully documented source code for Lander

Post by IanJeffray »

spanners wrote: Wed Feb 21, 2024 2:28 pm I'm hunting around my server and I can't find it right now, but there's a patch for Zarch (not Lander) to make it run in the desktop.
Really "run in" - or launch from the iconbar? ... https://arcarc.nl/archive/Games/Z/Zarch/
User avatar
spanners
Posts: 178
Joined: Fri Mar 23, 2018 2:37 pm
Location: Glasgow
Contact:

Re: New: fully documented source code for Lander

Post by spanners »

IanJeffray wrote: Wed Feb 21, 2024 4:39 pm Really "run in" - or launch from the iconbar? ... https://arcarc.nl/archive/Games/Z/Zarch/
Ooh that's a different one by Richard K. Lloyd and his comments within suggest that the desktop Zarch I'm trying to dig out was an 'official', but sluggish, one.

Edit: There's a landscape hack by Rob Davison in there too.

D.
User avatar
spanners
Posts: 178
Joined: Fri Mar 23, 2018 2:37 pm
Location: Glasgow
Contact:

Re: New: fully documented source code for Lander

Post by spanners »

Found it! Attached.

Editfest:

This makes Zarch run in a window. Of course it's dead slow, and you can't play the game unless I've missed something. It's interesting in its own right that it's Acorn aasm code and predates RISC OS 2's release. The source is also funny because swearing and various of things called "poo".

RKL's patch turns Zarch into an iconbar resident, but it won't make it run in a window. It makes the game desktop friendlier and patches out the system font meddling and the smashing up of the sound system. There's an interesting looking patch from Rob Davison living inside the app which claims to change the landscape (it locked up for me when run).

joty's WimpZarch will make it run in a window, but I can't yet get it to work (trying on Arculator) since it demands an original protected version of the game.

D.
Attachments
AcornDesktopZarch.zip
(6.42 KiB) Downloaded 16 times
mike12f
Posts: 77
Joined: Wed Nov 03, 2021 9:40 am
Contact:

Re: New: fully documented source code for Lander

Post by mike12f »

Wow, great work, Mark. Thank you!

I found the commentaries on the triangle plotter and horizontal line routines very helpful - I'd always wondered about those. I didn't realise people managed to pack so much logic into single ARM instructions productively, but Braben seems to do it with every single line of code - e.g. lines like "LDR R6, [R10, R9, LSL #2] ", I'd have probably naively coded in multiple ARM statements. That must be why my old game-programming attempts always ran so slow!

I would love to go though your commentary and port the whole Lander game into a high-level language like Python or even MatrixBrandy basic. It would make the whole Lander logic very accessible. Then also the game would run in higher resolution and frame rate than was possible on the original ARM1. I guess in Python the landscape mesh could be built as a single Numpy array, and the Fourier-series method to generate the landscape could probably be written concisely in just a few Numpy operations. So the whole volume of code would drop hugely. It would be fun to do (But I don't have time right now. I wonder if anyone would be interested in open-sourcing that project?)
Sophira
Posts: 113
Joined: Mon Sep 26, 2022 9:45 am
Contact:

Re: New: fully documented source code for Lander

Post by Sophira »

I've actually had thoughts about porting it myself, though I was thinking of using DragonRuby. It's a very nice engine that's small and doesn't get in your way, and is Ruby-based. (You'd be surprised at how viable Ruby is for games!)
dpsharp
Posts: 68
Joined: Fri Sep 07, 2018 2:05 pm
Location: Lincolnshire
Contact:

Re: New: fully documented source code for Lander

Post by dpsharp »

MarkMoxon wrote: Wed Feb 21, 2024 12:57 pm
sirbod wrote: Wed Feb 21, 2024 12:15 pm Regards running Lander quicker, provided you've fixed the STM^ bug if it exists, it should run on a modern machine (Pi etc) under ADFFS at 1000+fps.
Thank you Jon! I'll be giving that a go. Lander doesn't contain any ^ instructions, so hopefully that bug is unique to Zarch.

I wanted to see if I could get the big landscape mode running on something faster than arculator. I couldn't get the ADFFS command to get it going (probably my issue rather than ADFFS) but it didn't take much editing to fix it up the code.

There's a 'memory check' that attempts to write to the zero page and some hard coded screen addresses and that's about it before I could happily run it on a Raspberry Pi, StrongARM RiscPC with ROS4.39 and an A7000+ on ROS3.71. It's silky smooth on a StrongARM RiscPC and doesn't run too fast, to my eyes at least.
photo running on RiscPC on AKF18
photo running on RiscPC on AKF18
Also see video:
landervideoplayback.mp4
(907.88 KiB) Downloaded 26 times
The only other issue I had was not having 320x256 (Mode 13) modes defined in my monitor definition files on modern monitors so it would sometimes default to a 640x480 mode and incorrectly render spread across the display so looking like two squashed Lander displays next to each other but that's probably easily identified and solved.
running on a Raspberry Pi without a 320x256 mode defined
running on a Raspberry Pi without a 320x256 mode defined
It's built from Mark's big-landscape branch https://github.com/markmoxon/archimedes ... -landscape with the attached git patch applied

Final thing to note is that I had a hard time running it under rpcemu on MacOS - it runs great but with with mouse pointer set to 'Follow Host Mouse' you immediately blow up on the launch pad and with it turned off I found the emulated machine uncontrollable so YMMV.
Attachments
modernmachine.txt
git patch for big-landscape branch to make Lander run on modern machines should still work on RISC OS 2/Arthur
(7.17 KiB) Downloaded 6 times
Last edited by dpsharp on Tue Feb 27, 2024 11:48 am, edited 1 time in total.
paulb
Posts: 1767
Joined: Mon Jan 20, 2014 9:02 pm
Contact:

Re: New: fully documented source code for Lander

Post by paulb »

dpsharp wrote: Mon Feb 26, 2024 11:22 pm The only other issue I had was not having 320x256 (Mode 13) modes defined in my monitor definition files on modern monitors so it would sometimes default to a 640x480 mode and incorrectly render spread across the display so looking like two squashed Lander displays next to each other but that's probably easily identified and solved.
This merely raises the possibility of an anaglyph mode for an immersive 3D experience!
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

dpsharp wrote: Mon Feb 26, 2024 11:22 pm
MarkMoxon wrote: Wed Feb 21, 2024 12:57 pm
sirbod wrote: Wed Feb 21, 2024 12:15 pm Regards running Lander quicker, provided you've fixed the STM^ bug if it exists, it should run on a modern machine (Pi etc) under ADFFS at 1000+fps.
Thank you Jon! I'll be giving that a go. Lander doesn't contain any ^ instructions, so hopefully that bug is unique to Zarch.
I wanted to see if I could get the big landscape mode running on something faster than arculator. I couldn't get the ADFFS command to get it going (probably my issue rather than ADFFS) but it didn't take much editing to fix it up the code.
Fantastic! I'll add your fix to the branch when I get a moment, if that's OK with you. I've since removed the need to manually update the entry address when editing the code (that was a pain!), and I'll wrap your changes in Mod headers so they'll be easier to find, but this looks really easy to drop in. Thank you!

Mark
dpsharp
Posts: 68
Joined: Fri Sep 07, 2018 2:05 pm
Location: Lincolnshire
Contact:

Re: New: fully documented source code for Lander

Post by dpsharp »

MarkMoxon wrote: Tue Feb 27, 2024 9:53 am Fantastic! I'll add your fix to the branch when I get a moment, if that's OK with you. I've since removed the need to manually update the entry address when editing the code (that was a pain!), and I'll wrap your changes in Mod headers so they'll be easier to find, but this looks really easy to drop in. Thank you!
Yes, please do add it to the branch and tidy up as you see fit to match your coding standards. I've updated the patch in my previous post so it should all still work under pre-RISC OS 3 machines falling back to the hardcoded screen addresses if OS_ReadVduVariables isn't available (though I haven't tested it - oh I wish I could get my MacOS build of Arculator working).

I saw late last night you'd made some changes to make it easier to modify without updating the offset manually though I haven't played with it yet, I've just been running the GameCode binary directly for simplicity. The self-modifying code in !RunImage will break on a StrongARM so you'll need to call OS_SynchroniseCodeAreas i.e. SWI &6E + &20000 (for the X bit in case SWI not defined on earlier machines) after the modification has taken place so that it'll run.
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

dpsharp wrote: Tue Feb 27, 2024 12:00 pm
MarkMoxon wrote: Tue Feb 27, 2024 9:53 am Fantastic! I'll add your fix to the branch when I get a moment, if that's OK with you. I've since removed the need to manually update the entry address when editing the code (that was a pain!), and I'll wrap your changes in Mod headers so they'll be easier to find, but this looks really easy to drop in. Thank you!
Yes, please do add it to the branch and tidy up as you see fit to match your coding standards. I've updated the patch in my previous post so it should all still work under pre-RISC OS 3 machines falling back to the hardcoded screen addresses if OS_ReadVduVariables isn't available (though I haven't tested it - oh I wish I could get my MacOS build of Arculator working).

I saw late last night you'd made some changes to make it easier to modify without updating the offset manually though I haven't played with it yet, I've just been running the GameCode binary directly for simplicity. The self-modifying code in !RunImage will break on a StrongARM so you'll need to call OS_SynchroniseCodeAreas i.e. SWI &6E + &20000 (for the X bit in case SWI not defined on earlier machines) after the modification has taken place so that it'll run.
Thank you! I have rolled your changes, and a call to XOS_SynchroniseCodeAreas, into the branch. It seems to work fine for me on all the main CPUs (including StrongARM) and RISC OS up to 3.7. Haven't tried my Pi yet yet, but that's next on the list.

I've also renamed this version to !BigLander and have added a small !Help file just to distinguish it from the original (and the help file also includes the build date). I've also credited you - thanks! (Let me know if you'd rather I remove the credit or change the name.)

If anyone fancies having a play, you can build this from the big-landscape branch of the repository, or you can download a zip of the latest version from here:

https://lander.bbcelite.com/deploy/big- ... Lander.zip

If anyone runs into difficulties, do let me know! I will probably have a play with improving the colour depth next, as that can definitely be improved, but at least it's running ridiculously fast now. Amazing. :D

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

Re: New: fully documented source code for Lander

Post by MarkMoxon »

So I'm getting the same issue on RISC OS 5 on my Pi, with 320x256 not working and BigLander showing as a tiny duplicated screen. Runs very fast, though! And when I quit the game with Escape, the screen goes blank and I don't get back to the desktop.

If anyone has any suggestions on getting this working properly on a Pi, that would be great. It's not a platform I don't know much about...

Mark
User avatar
spanners
Posts: 178
Joined: Fri Mar 23, 2018 2:37 pm
Location: Glasgow
Contact:

Re: New: fully documented source code for Lander

Post by spanners »

You could give AnyMode a go <http://www.pi-star.co.uk/anymode/>.

I was just trying BigLander on my Pi but its attached monitor won't display any of the ancient modes.

I got it into RPCEmu (emulated ARM710 + RISC OS 3.6) but it's not 100% happy, with a few weird bomb outs along the lines of this:

Screenshot 2024-02-27 at 17.54.05.png
D.
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

spanners wrote: Tue Feb 27, 2024 6:01 pm You could give AnyMode a go <http://www.pi-star.co.uk/anymode/>.
I did try that, but just loading the module via PreDesk made no difference at all. I then found a thread saying I had to do something else in the Pi’s SD card configuration, which I didn’t really follow, and then I wondered it I should upgrade to the latest RISC OS 5… and then I ran out of time. One for a rainy day, I think!
spanners wrote: Tue Feb 27, 2024 6:01 pm I got it into RPCEmu (emulated ARM710 + RISC OS 3.6) but it's not 100% happy, with a few weird bomb outs along the lines of this:
Hmm, that isn’t good. I haven’t managed to crash it in RPCEmu yet, but I’ll see if I can replicate that. I’ve not tried debugging in RPCEmu before. Not even sure if there’s a debugger! It’ll be fun finding out.

Thanks for the report, anyway. Once these deep dives are done, looks like BigLander needs a bit more love…

Mark
mike12f
Posts: 77
Joined: Wed Nov 03, 2021 9:40 am
Contact:

Re: New: fully documented source code for Lander

Post by mike12f »

I've just run BigLander on RPCEmu, and it worked. I had to choose "full screen" mode though on RPCEmu to stop the lander exploding on the landing pad. Not sure why full-screen mode made a difference - something to do with RPCEmu grabbing the mouse pointer.

When running in RPCEmu at a high frame rate, the fuel bar decends rather fast. Not sure if the original game was like that? Does the high frame rate speed up the fuel usage rate?
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

mike12f wrote: Tue Feb 27, 2024 7:41 pm I've just run BigLander on RPCEmu, and it worked. I had to choose "full screen" mode though on RPCEmu to stop the lander exploding on the landing pad. Not sure why full-screen mode made a difference - something to do with RPCEmu grabbing the mouse pointer.
I think I might add a fix to prevent death until after you have started the engines. It is practically impossible to play Lander at high speed otherwise - that's one Zarch feature that's worth backporting!
mike12f wrote: Tue Feb 27, 2024 7:41 pm When running in RPCEmu at a high frame rate, the fuel bar decends rather fast. Not sure if the original game was like that? Does the high frame rate speed up the fuel usage rate?
It uses fuel at the same rate, it's just that everything runs at a much higher rate. Like Elite, Lander always runs as fast as it can, so each main loop iteration is the same as on the slower machines, they just take less time to complete.

It's a nice problem to have!

Mark
User avatar
jms2
Posts: 3765
Joined: Mon Jan 08, 2007 6:38 am
Location: Derby, UK
Contact:

Re: New: fully documented source code for Lander

Post by jms2 »

It works perfectly for me in RPCEmu - and it's spectacular! Mesmerising in fact.
dpsharp
Posts: 68
Joined: Fri Sep 07, 2018 2:05 pm
Location: Lincolnshire
Contact:

Re: New: fully documented source code for Lander

Post by dpsharp »

MarkMoxon wrote: Tue Feb 27, 2024 6:53 pm
spanners wrote: Tue Feb 27, 2024 6:01 pm I got it into RPCEmu (emulated ARM710 + RISC OS 3.6) but it's not 100% happy, with a few weird bomb outs along the lines of this:
I'm 99% sure it's a MacOS RPCEmu bug - I see something similar (branch through zero actually when the ship immediately explodes for me) on RPCEmu on MacOS but haven't been able to reproduce on real hardware or VirtualRPC or even RPCEmu 0.93 on Windows so have put it down to something odd with the MacOS RPCEmu setup.

I tried yesterday tracing it down with DDT debugger and it blows up somewhere in DrawLandscapeAndBuffers when that gets called from LoseLife after the 30 frame explosion animation has completed but I've not kept going especially after I couldn't repro in any other environment. I'm assuming some weird values for mouse pointer get produced by RPCEmu that don't match Mode 13 resolution and something goes out of bounds.

Note, I always use RPCEmu's 'Follow Host Mouse' setting turned on which the rpcemu manual says: "RPCEmu uses a hack to make the RISC OS mouse pointer follow the native pointer. In many games this does not work, so disable this to turn it off." (https://www.marutan.net/rpcemu/manual) but I'm not able to control the pointer at all without that setting on.

In other news, experimenting with TILES_X and TILES_Z values, setting both to 122 seems to be the max I've had any luck with before things blow up. It looks amazing running on VRPC at 700+ MIPS :)

Lander w TILES_X and _Z set to 122 on VirtualRPC
Lander w TILES_X and _Z set to 122 on VirtualRPC
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

dpsharp wrote: Tue Feb 27, 2024 10:25 pm
MarkMoxon wrote: Tue Feb 27, 2024 6:53 pm
spanners wrote: Tue Feb 27, 2024 6:01 pm I got it into RPCEmu (emulated ARM710 + RISC OS 3.6) but it's not 100% happy, with a few weird bomb outs along the lines of this:
I'm 99% sure it's a MacOS RPCEmu bug
Phew. I'll stop trying to make it crash on the Windows version, then. :-)
dpsharp wrote: Tue Feb 27, 2024 10:25 pm In other news, experimenting with TILES_X and TILES_Z values, setting both to 122 seems to be the max I've had any luck with before things blow up. It looks amazing running on VRPC at 700+ MIPS :)
That's interesting! I thought 118 was the highest possible value of TILES_Z, but I'm clearly wrong. I got 118 from the calculation of the z-coordinate of the back of the landscape, which is defined like this:

Code: Select all

LANDSCAPE_Z = (TILES_Z + 9) * TILE_SIZE
TILE_SIZE is defined as &01000000, so when TILES_Z = 118, we get

Code: Select all

LANDSCAPE_Z = (118 + 9) * &01000000 = &7F000000
which is positive. Any higher, and we get a negative value of LANDSCAPE_Z, and I'd have thought that would blow things up, as the coordinate system is signed. I wonder where that four-tile margin is coming from? Intriguing.

In short, though, I really don't think we can go higher than 122. It's amazing that we got there, frankly!

Mark
User avatar
wmd
Posts: 340
Joined: Wed Feb 03, 2021 10:16 pm
Contact:

Re: New: fully documented source code for Lander

Post by wmd »

Would be awesome to see this optimised so it runs nicely on an ARM3.
User avatar
spanners
Posts: 178
Joined: Fri Mar 23, 2018 2:37 pm
Location: Glasgow
Contact:

Re: New: fully documented source code for Lander

Post by spanners »

dpsharp wrote: Tue Feb 27, 2024 10:25 pm I'm 99% sure it's a MacOS RPCEmu bug
I agree, I've seen other weird stuff with that RPCEmu build now I've been playing around some more.

D.
User avatar
spanners
Posts: 178
Joined: Fri Mar 23, 2018 2:37 pm
Location: Glasgow
Contact:

Re: New: fully documented source code for Lander

Post by spanners »

wmd wrote: Wed Feb 28, 2024 11:47 am Would be awesome to see this optimised so it runs nicely on an ARM3.
It could use that fancy modern MUL instruction!

D.
User avatar
IanJeffray
Posts: 5963
Joined: Sat Jun 06, 2020 3:50 pm
Contact:

Re: New: fully documented source code for Lander

Post by IanJeffray »

spanners wrote: Wed Feb 28, 2024 12:56 pm
wmd wrote: Wed Feb 28, 2024 11:47 am Would be awesome to see this optimised so it runs nicely on an ARM3.
It could use that fancy modern MUL instruction!
MUL exists on ARM2, but it'd be interesting to see if using it had any impact at all on performance - I expect not.
sirbod
Posts: 1624
Joined: Mon Apr 09, 2012 9:44 am
Location: Essex
Contact:

Re: New: fully documented source code for Lander

Post by sirbod »

IanJeffray wrote: Wed Feb 28, 2024 7:02 pm MUL exists on ARM2, but it'd be interesting to see if using it had any impact at all on performance - I expect not.
I changed it in Zarch to MUL / MLA for completeness, but as you say it won't make the slightest difference to the speed of the game. Off the top of my head MUL / MLA were worst-case 1/2 the cycles and best case ~1/8th - I vaguely remember the calculations were quite low accuracy, 8 bit in many cases.

The CPU is sitting in the landscape and triangle routines for the majority of its cycles, which drown out any other optimizations.
MarkMoxon wrote: Wed Feb 28, 2024 11:35 am

Code: Select all

LANDSCAPE_Z = (TILES_Z + 9) * TILE_SIZE
That +9 has triggered something...is that the tile backoff value? ie the number of tiles it steps back from the ship position to start plotting the landscape?

I might just be misremembering though, as it's been quite a few years since I last looked at the Zarch source.
dpsharp
Posts: 68
Joined: Fri Sep 07, 2018 2:05 pm
Location: Lincolnshire
Contact:

Re: New: fully documented source code for Lander

Post by dpsharp »

MarkMoxon wrote: Tue Feb 27, 2024 2:02 pm If anyone has any suggestions on getting this working properly on a Pi, that would be great. It's not a platform I don't know much about...
It runs correctly on a Pi with just a little configuration... just needs a text file in !Boot.Loader folder called CMDLINE/TXT containing the word disable_mode_changes (and then reboot) and have !ADFFS loaded, all as per Jon's video at https://www.youtube.com/watch?v=HpQk1l7Rvu0

I suspect the image might look better (less blurred edges from scaling) with a space and then scaling_kernel=8 in the CMDLINE/TXT file too but haven't tried it yet, per https://forums.jaspp.org.uk/forum/viewt ... f3b8acca43

The explanation of why the Pi is behaving like this without this change and what this change does from this post:
https://www.riscosopen.org/forum/forums/11/topics/18923
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

sirbod wrote: Thu Feb 29, 2024 8:26 am
MarkMoxon wrote: Wed Feb 28, 2024 11:35 am

Code: Select all

LANDSCAPE_Z = (TILES_Z + 9) * TILE_SIZE
That +9 has triggered something...is that the tile backoff value? ie the number of tiles it steps back from the ship position to start plotting the landscape?
Yes, that sounds like the same thing - I've called it the "landscape offset", but "backoff value" is a good name.

Specifically, LANDSCAPE_Z controls the distance along the z-axis that the landscape gets pushed away from the viewer, so it ends up looking like a three-dimensional diorama on a distant table under a reading lamp, rather than with the viewer standing "in" the landscape. It's effectively the z-coordinate of the back of the landscape, so it will have a pretty big value in BigLander.

The equation above is the same as:

Code: Select all

LANDSCAPE_Z = (TILES_Z + 9) * TILE_SIZE
            = (TILES_Z - 1 + 10) * TILE_SIZE
            = LANDSCAPE_Z_DEPTH + (10 * TILE_SIZE)
where LANDSCAPE_Z_DEPTH is the depth of the landscape itself - this is a bit clearer than my original formulation, so I think I'll update the source. With this version, I think it's a bit clearer that the landscape gets pushed 10 tiles away from the viewer as part of the "backing off" process, which is a distance we want to maintain with a larger landscape.

I'm still not quite sure why a tile size of 122 doesn't blow things up by making the value of LANDSCAPE_Z negative, but presumably the arithmetic still works up to a point, even with the overflow.

Mark
Last edited by MarkMoxon on Thu Feb 29, 2024 1:36 pm, edited 1 time in total.
grannyg
Posts: 45
Joined: Tue Sep 10, 2013 4:06 pm
Contact:

Re: New: fully documented source code for Lander

Post by grannyg »

MarkMoxon wrote: Tue Feb 27, 2024 2:02 pm
If anyone has any suggestions on getting this working properly on a Pi, that would be great. It's not a platform I don't know much about...

Mark
Just to report it works fine on a Pi running RISC OS 5.29.

All I had to do was ensure the file !Boot.Loader.cmdline/txt contained disable_mode_changes. Also instead of using anymode I just ran !ADFFS before running !Lander. With anymode loaded the top of the screen flickered.

shoud be a single line with,

disable_gamma disable_mode_changes
Post Reply

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