Author Topic: FPS of scrolling in certain games.  (Read 2008 times)

0 Members and 1 Guest are viewing this topic.

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.321
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 862
Re: FPS of scrolling in certain games.
« Reply #10 on: 12:39, 03 January 17 »
I'm always somewhat amused when a topic I start evolves into tech talk I cannot understand. :P

It's very interesting though even if I can't make sense of it myself. :)
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline Docent

  • CPC664
  • ***
  • Posts: 86
  • Country: pl
  • Liked: 65
Re: FPS of scrolling in certain games.
« Reply #11 on: 23:11, 04 January 17 »
Yeah, I was doing it naively (11 T-states at 4MHz), but hadn't remembered the obscure way the cycles are stretched in order to share the bus with the video hardware (still not entirely sure how 3 memory cycles becomes 4us but I assume it's been measured/analysed).

Here you can find the explanation of this process:
http://www.cpcwiki.eu/forum/programming/cpc-z80-commands-and-how-long-they-take/msg136331/#msg136331

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.321
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 862
Re: FPS of scrolling in certain games.
« Reply #12 on: 13:03, 07 January 17 »
@Axelay
How do your games scroll smooth?  Edge grinder appears to scroll just 1 mode 0 pixel a time and is fast and smooth?  Are there any drawbacks?  Only suitable for a shoot em up or maybe a simple platformer along the lines of Turbo the Tortoise but all smooth?
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.100
  • Liked: 347
Re: FPS of scrolling in certain games.
« Reply #13 on: 20:18, 07 January 17 »
I was a bit surprised myself to find the game was using a complete screen clear to start each frame as well considering it's moving reasonably fast for a software scroll, as it's hard to imagine that approach being optimal on the CPC.

I made the clear timing estimate closer to 300 scan lines though, I suspect your time has been based on T-states or a 3 microsecond push, while push actually takes 4 microseconds on the CPC.  I went and timed the clear routine in use in stormlord and it works out to 335 scan lines in all.

But yeah it's hard not to think that surely keeping track of trailing edges & sprites to clear would be faster, without doing any code on it at least, but I guess it's one of those cases of presumably it was something like 100 scan lines on the spectrum and that could seem like a small price to pay for a much simpler approach.

So in regards to Dynamite Dux which is also using a software scroll and a smaller screen (I think) while scrolling quite smoothly, are they replacing the whole screen, or are they just replacing the bits that are needed?

I've always been very impressed by the speed of that game, but I'm guessing this has a lot to do with the frame rate being quite consistent from what I remember.
« Last Edit: 20:19, 07 January 17 by sigh »

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 519
  • Country: au
  • Liked: 315
Re: FPS of scrolling in certain games.
« Reply #14 on: 05:02, 08 January 17 »
@Axelay
How do your games scroll smooth?  Edge grinder appears to scroll just 1 mode 0 pixel a time and is fast and smooth?  Are there any drawbacks?  Only suitable for a shoot em up or maybe a simple platformer along the lines of Turbo the Tortoise but all smooth?

All but Sub Hunter are hardware scrolls.  Edge Grinder is 1 mode 0 pixel per frame at 25FPS.  The technique used has a couple of drawbacks.  From a hardware point of view, it uses manipulating CRTC register 3, the monitor H-sync, which generally only works on analogue CRTs like the amstrad monitors.

The other drawback is that the R3 technique only gets you down to a two mode 0 pixel scroll, so in order to get a one mode 0 pixel scroll, the background graphics on one of the double buffered screens are offset by one mode 0 pixel, so a mode 0 pixel scroll can be achieved.  The problem that creates is you cant really *stop* scrolling without ceasing to use the double buffer.

The way the scrolling stopped at the end of Super Edge Grinder for the boss was to copy one buffer to the other, the lack of on screen action at that point hid the cpu time used by that process.  So in general the scrolling method used in Edge Grinder is best suited to continuous scrolling shooters, though it's always conceivable that someone could come up with a game design that might just work it into some other genre.

So in regards to Dynamite Dux which is also using a software scroll and a smaller screen (I think) while scrolling quite smoothly, are they replacing the whole screen, or are they just replacing the bits that are needed?

I've always been very impressed by the speed of that game, but I'm guessing this has a lot to do with the frame rate being quite consistent from what I remember.

It uses a tile system similar in principal to that used in stormlord, save it's an 8 way scroll, and skips the screen clear that used and instead redraws the entire screen with the tiles, then places the sprites on top.   But yeah, the play area is quite small too, just 24 chars wide and 16 high.

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.321
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 862
Re: FPS of scrolling in certain games.
« Reply #15 on: 13:27, 09 January 17 »
All but Sub Hunter are hardware scrolls.  Edge Grinder is 1 mode 0 pixel per frame at 25FPS.  The technique used has a couple of drawbacks.  From a hardware point of view, it uses manipulating CRTC register 3, the monitor H-sync, which generally only works on analogue CRTs like the amstrad monitors.

The other drawback is that the R3 technique only gets you down to a two mode 0 pixel scroll, so in order to get a one mode 0 pixel scroll, the background graphics on one of the double buffered screens are offset by one mode 0 pixel, so a mode 0 pixel scroll can be achieved.  The problem that creates is you cant really *stop* scrolling without ceasing to use the double buffer.

The way the scrolling stopped at the end of Super Edge Grinder for the boss was to copy one buffer to the other, the lack of on screen action at that point hid the cpu time used by that process.  So in general the scrolling method used in Edge Grinder is best suited to continuous scrolling shooters, though it's always conceivable that someone could come up with a game design that might just work it into some other genre.

It uses a tile system similar in principal to that used in stormlord, save it's an 8 way scroll, and skips the screen clear that used and instead redraws the entire screen with the tiles, then places the sprites on top.   But yeah, the play area is quite small too, just 24 chars wide and 16 high.




Is it possible (and hopefully faster) to just scroll part of the game area.  For example the bottom 64 pixels (ground with 16x16 tiles with a depth of 64, 48, 32, 16) scroll while the top area (a backdrop image) stays static with the added bonus of it looking like parallax scrolling?  With the player character able to move up and down normally between the two?
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 519
  • Country: au
  • Liked: 315
Re: FPS of scrolling in certain games.
« Reply #16 on: 05:39, 10 January 17 »



Is it possible (and hopefully faster) to just scroll part of the game area.  For example the bottom 64 pixels (ground with 16x16 tiles with a depth of 64, 48, 32, 16) scroll while the top area (a backdrop image) stays static with the added bonus of it looking like parallax scrolling?  With the player character able to move up and down normally between the two?

For a software scroll, potentially faster, yes, and certainly possible.  You'd only be updating all the tiles in the scrolled area, so it would be much less cpu time for updating that compared to a full screen scroll.  Though you then need to do something to restore the background of the static part after sprites have passed over it, which is where the 'potentially' comes in.  You might use a dirty tile system to restore the areas that sprites have been on the static image, but if you have a game with a lot of sprites so that a large proportion of the tiles are 'dirtied' and need restoring, then you could lose much of any speed benefit.  I am guessing you just mean scrolling left and right with such an idea, rather than something multi-directional?

For a hardware scroll, it's also possible, it would enable you to do a 'normal' scroll following player movement in 2 mode 0 pixel steps without using register 3, so overcoming display compatibility issues, by allowing you to use 4 screens for the scrolling area.  That would take quite a bit of memory though, perhaps enough to only be a serious consideration for 128k, and add more complexity to the sprite routines, so the hardware scroll would lose a little of it's speed advantage over a software scroll, as they'd be needing to cross multiple screens with different base addresses.  Still an interesting possibility for the right game design though.

Offline Sykobee (Briggsy)

  • 6128 Plus
  • ******
  • Posts: 613
  • Country: gb
  • Liked: 192
Re: FPS of scrolling in certain games.
« Reply #17 on: 23:13, 11 January 17 »
I wonder if Stormlord would have been faster skipping the full 9KB frame clear, and instead having a 'fast black tile' rendering method when rendering the screen? I guess the screens were mostly blank tiles (over 50% I guess looking at a video), but even so a 1/2 frame method suitable for the Spectrum might not be the best option on the CPC if it uses a full frame. I think the game scrolls 2 mode 0 pixels at a time, but i guess it doesn't do dodgy R3 tricks.


Parallax stars could be post processed onto the frame - only draw onto black pixels (you would need two blacks though) - alternatively it could be part of the fast black tile rendering method. The brighter stars are actually sub-tiles as they scroll with the map.


Clearly the game hit a frame rate target that played well regardless of such an optimisation and they went with that.

Offline RichTW

  • CPC464
  • **
  • Posts: 13
  • Country: es
  • Liked: 9
Re: FPS of scrolling in certain games.
« Reply #18 on: 00:27, 12 January 17 »
Yep, I suspect it would claw back some time.  I actually sped up a software scroll by one frame by doing exactly that - it makes sense as, otherwise, you're actually writing screen bytes twice per frame for non-blank areas.  Apparently there's occasional slowdown to 4 frames, so it might've been worth their while.

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 519
  • Country: au
  • Liked: 315
Re: FPS of scrolling in certain games.
« Reply #19 on: 10:05, 12 January 17 »
I suspect Stormlord would not have been faster with a 'fast blank tile' and skipping the 9kb screen clear, but I do think it would likely have reduced the peak cpu load and helped stabilise the frame rate a bit higher.  More consistently at 17fps rather than dropping to 12.5 at times where there's lots of tiles quite as often.

I'm not saying the game really suffered from a lack of optimisation for the CPC though, but the sequel used the same approach and really did suffer with slowdown at times.  That one was quite disappointing to me.