Scrolling tricks

News,announcements,programming,fixes,game patches & discussions.

Moderator: troed

PeteW
Posts: 76
Joined: Wed Jul 25, 2018 8:09 pm

Scrolling tricks

Post by PeteW » Tue Aug 21, 2018 10:17 am

Some of you guys seem to be quite knowledgable on the software side of the ST, so I have a question about scrolling tricks used in games.

I've been doing some side by side ST/Amiga comparisons and where decent scrolling has been achieved on the STFM, it typically seems to involve reducing the size of the screen to scroll, or do things like Blood Money where the scrolling is on rails and there are fewer sprites on screen than the Amiga.

But - I've found an exception I'm hoping you can explain: Star ray. The scrolling is super smooth and fast and with the exception of a few more colours on the Amiga, you'd struggle to tell the difference between the 2. So what are the tricks used here? Is the repetitive nature of the scrolled background and the small sprite size a clue?

Petari
Trusted Guru
Trusted Guru
Posts: 558
Joined: Tue Nov 28, 2017 1:32 pm

Re: Scrolling tricks

Post by Petari » Tue Aug 21, 2018 10:49 am

In case of horizontal scrolling on ST without blitter main problem is that required shift operation is slow with 68000 CPU. Shift means moving all bits in word (16 bits) for certain count of bits left or right - what is basically the horizontal scroll.
Best way to avoid slow shift during game play is so called pre shifting. That means that SW will prepare all possible shift phases for all elements of background, and then no need to shift them, only to copy straight in screen buffer. Those elements are called usually tiles, and their number is not big on one level.
Here to add technical explanation: in ST low res we have 1 bit plane in 1 word, so 2 bytes, then next bitplane, up to fourth - so 8 bytes for 16 pixels.
It means that without shift, min. pixel skip is 8 pixels - if moving data 1 byte up or down - but that's slower than writing 2 bytes at once to even address.
Shifts need therefore to be in range 1-15 . If it is 16 or multiple of it, you just write 8 bytes higher or lower.

Example: Potsworth & Co. It uses 4px step in scrolling and about 70% of screen is scrolling. That gives good speed and works with only 512KB machines.
Scroll speed is always faster, so 4px step is not choppy.

Harlequin uses 2px step, and is slower in scrolling. And other system in background build. It's quite complex. Basically builds dynamically 8 backgrounds (size is about 70% too) with shift phases 0-2-4-6-8-10-12-14 and draws proper one with fast straight copy on screen regularly - depending of player movement. As it moves, new data is drawn to left or right end pos, and everything is shifted 16 px right or left - with fast copy, as explained above. For all 8 phases.

There are many other ST games with good and fast scroll, which may use different systems, but preshifting is what must be present in them .
Code for scroll may be pretty long.

Vertical shift may use some real tricks - so called sync scrolling for instance - will not go now in details about.
There is 2 kind of people: one thinking about moving to Mars after here becomes too bad, the others thinking about how to keep this planet habitable.

PeteW
Posts: 76
Joined: Wed Jul 25, 2018 8:09 pm

Re: Scrolling tricks

Post by PeteW » Tue Aug 21, 2018 11:31 am

Is pre shifting something I could likely try in stos or is it an assembler only thing?

Haven't coded for quite some time, but fancy having a play and I seem to remember stos being pretty straightforward

Gargoyle
Posts: 31
Joined: Mon Aug 28, 2017 12:04 am

Re: Scrolling tricks

Post by Gargoyle » Tue Aug 21, 2018 11:35 am

You would use the missing link extension for STOS, to achieve pre-shifted frames for bobs, joeys and world blocks for scrolling with. It is quite ram hungry though, so you have to plan carefully unless you are going to go for full blown 4mb STE specs for example.

Gargoyle
Posts: 31
Joined: Mon Aug 28, 2017 12:04 am

Re: Scrolling tricks

Post by Gargoyle » Tue Aug 21, 2018 11:37 am

I have also heard about the SCREEN$ technique being mentioned in the STOS Coders fb group, I haven't tried that but that is also used for pre-shifting if I remember correctly.

User avatar
exxos
Site Admin
Site Admin
Posts: 5021
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Scrolling tricks

Post by exxos » Tue Aug 21, 2018 12:06 pm

PeteW wrote:
Tue Aug 21, 2018 11:31 am
Is pre shifting something I could likely try in stos or is it an assembler only thing?
There is a util in TML somewhere which will pre-shift bobs for you, you can do 16 shifts per bob, but takes lot of ram, 8 shifts of course uses 50% less ram each bob, depends how fast/smooth vs ram you want. There are "joeys" as well, single bit plane graphics, so much faster. Ideal for anything which doesn't need colour.. of course no use drawing 16 colours for the bullet in all 4 bit planes, when can just use 1 colour and 1 bitplane to do the same job.

Look how fast VROOM goes on the ST, fast racer, make use of single bit plane graphics. You can do single bit plane screen copies with TML, if you use less colours, you can use less bitplanes and greatly speed up scrolling screens etc.
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

Gargoyle
Posts: 31
Joined: Mon Aug 28, 2017 12:04 am

Re: Scrolling tricks

Post by Gargoyle » Tue Aug 21, 2018 12:09 pm

If you use less colours with world map tiles, does that help speed up scrolling or does this only apply to screen copying commands?

User avatar
exxos
Site Admin
Site Admin
Posts: 5021
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Scrolling tricks

Post by exxos » Tue Aug 21, 2018 12:25 pm

Gargoyle wrote:
Tue Aug 21, 2018 12:09 pm
If you use less colours with world map tiles, does that help speed up scrolling or does this only apply to screen copying commands?
You would have to look at the TML docs.. been like 20 years for me... so can't remember if maps can use joeys or not.. would assume so.
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

Petari
Trusted Guru
Trusted Guru
Posts: 558
Joined: Tue Nov 28, 2017 1:32 pm

Re: Scrolling tricks

Post by Petari » Tue Aug 21, 2018 12:57 pm

Gargoyle wrote:
Tue Aug 21, 2018 12:09 pm
If you use less colours with world map tiles, does that help speed up scrolling or does this only apply to screen copying commands?
Less colors will surely make it faster. For instance Uridium uses only 2 bitplanes for background - and that's enough, since original was not with more colors. If screen copy is faster then scrolling is faster too - because actually that copy is what takes most time in all it.
Just need to not mix fast screen draw (update) with fast scroll self - if scroll step is small, screen will not scroll/move fast left-right, up-down.
Of course, to large step is not good, then it will be too jumpy .
There is 2 kind of people: one thinking about moving to Mars after here becomes too bad, the others thinking about how to keep this planet habitable.

PeteW
Posts: 76
Joined: Wed Jul 25, 2018 8:09 pm

Re: Scrolling tricks

Post by PeteW » Tue Aug 21, 2018 3:08 pm

Thanks for the info so far. I've got a 4meg STFM so I won't worry too much about code efficiency. I just want to understand the concepts and see what I can make work.

I'll get a version of stos once I'm back from holiday and give it a try!

No idea what bobs, joeys or world blocks are, so am interested to find out :)

Post Reply