Scrolling and screen tearing

Started by ervin, 08:25, 04 December 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ervin

Hi folks.

Just wondering... do games like Robocop, Dragon Ninja, Batman the Movie, Shinobi etc use a double buffer?
There reason I ask is that none of them have screen tearing despite scrolling a good-sized screen area.

The memory limitations imposed by a double buffer are severe on 64K machines, and all of these games have a lot of graphics to store during gameplay (even taking multi-load into account). Maybe some sort of compression is used.

OR... is the screen redraw highly optimised, and carefully timed to coincide with vsync?

Axelay


They're hardware double buffered.  But bear in mind, they have also I think in all the cases you mentioned reduced the visible screen to specrtum dimensions, so they're using two 12kb screens, and using the spare or unused 4kb from each of those screen banks for other things as well, so they're using 40kb after screens.


Screen tearing comes from trying to use a software buffer that you copy, usually with LDI strings.  On the spectrum I understand the typical 32x16 character scrolled area can be copied within a frame to avoid tearing with timing, because it's half the number of bytes as the same number of characters on CPC.  You can do the maths to see that tearing is inevitable with that approach on CPC.  32x16 characters is 8192 bytes x5 nops for LDIs, ignoring overhead for the loop comes to around 40000 nops alone.  That's two whole screen refreshes just to copy that buffer to the visible screen.  Software copied buffers didn't just produce tearing, they significantly reduced frame rates.

ervin

Thanks Axelay.
That's really useful info.

roudoudou

Quote from: ervin on 08:25, 04 December 21
Just wondering... do games like Robocop, Dragon Ninja, Batman the Movie, Shinobi etc use a double buffer?
There reason I ask is that none of them have screen tearing despite scrolling a good-sized screen area.

The memory limitations imposed by a double buffer are severe on 64K machines, and all of these games have a lot of graphics to store during gameplay (even taking multi-load into account). Maybe some sort of compression is used.
OR... is the screen redraw highly optimised, and carefully timed to coincide with vsync?
Dragon Ninja is heavily optimised for speed AND for memory usage, this game is a piece of art  8)
Most of games using double buffer optimise their memory usage (with some conversion table to flip sprite, change sprites colors, ...)
And i disagree about "lot of graphics" for the games you mentionned. Just take a look at the Truck and the helicopter in Dragon Ninja, they reuse the same tiles. All the levels are very simples
use RASM, the best assembler ever made :p

I will survive

Axelay

Quote from: ervin on 12:47, 04 December 21
Thanks Axelay.
That's really useful info.



No problem!  I don't know if you use WinAPE, but if you do, in most cases you can easily check any game you want is using hardware or software buffer by hitting f8 to open the debugger, clicking on the yellow & blue 'find graphics' icon at the bottom, and from the Find Graphics form, select 'Screen' type encoding at the top.   That will automatically select the address of the current display, which will usually have an address of &c000, &8000 or &4000.  You can manually enter the address to see if the game has a another buffer in the format for screen memory, which would usually mean it's hardware double buffered, but not always.  You'd need to verify it's actually changing the CRTC registers to be sure.


If the game is software copying a buffer, it will tend to be from a linear buffer and to see that you would need to change the encoding to 'CPC' and set the width to 64 bytes, or however many bytes wide the play area is and look through memory to find if there's a second version of the screen visible in that format.  But bear in mind that with a software buffer like that, it's not unusual for it to be a bit wider than the play area, so you might need to play around with the width value.

ervin

Oh wow I didn't know that could be done with WinAPE!!!
Thanks again!

Powered by SMFPacks Menu Editor Mod