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

0 Members and 1 Guest are viewing this topic.

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.495
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1078
  • Likes Given: 591
FPS of scrolling in certain games.
« on: 18:51, 27 December 16 »
Not sure where to ask this so if this is in wrong place please move:

Can anyone tell me the frames per second speed that games such as RoboCop or Stormlord scroll at (when the player character is moving obviously).  They are pretty smooth compared to a lot of other CPC games and appear to scroll in 2 Mode 0 pixels (same size as 4 Mode 1 pixels).  I'm trying to make one of my Amstrad CPC-style PC games move the same way but I can't seem to get the speed right.  So how many times a second these games scroll when the player is moving.  That's what I'd like to know.  Thank you. :)
« Last Edit: 18:53, 27 December 16 by Carnivius »
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 585
  • Country: au
  • Liked: 383
  • Likes Given: 87
Re: FPS of scrolling in certain games.
« Reply #1 on: 03:54, 28 December 16 »
Robocop looks to be running at 12.5FPS.  Stormlord is 17FPS, although perhaps it may drop to 12.5 if the screen gets busy with the way it clears each frame with the stack and redraws the whole screen, so if there's areas with a lot more tiles than usual it may slow down.

Offline reidrac

  • Supporter
  • 6128 Plus
  • *
  • Posts: 905
  • Country: gb
  • Trying to gamedev!
    • index.php?action=treasury
    • usebox.net
  • Liked: 1667
  • Likes Given: 896
Re: FPS of scrolling in certain games.
« Reply #2 on: 10:36, 29 December 16 »
Not sure how difficult would be to fake that because as Axelay said, it is usually 50 FPS divided by a factor. For example I usually update at 16.6 FPS in my games (50/3), because I don't scroll.

Keeping in mind that PCs usually refresh at 60 FPS... I would say: don't bother and make it feel nice in the platform you're developing for.
Released The Return of Traxtor, Golden Tail, Magica, The Dawn of Kernel, Kitsune`s Curse and Brick Rick for the CPC.

If you like my games and want to show some appreciation, you can always buy me a coffee.

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.495
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1078
  • Likes Given: 591
Re: FPS of scrolling in certain games.
« Reply #3 on: 14:01, 29 December 16 »
Not sure how difficult would be to fake that because as Axelay said, it is usually 50 FPS divided by a factor. For example I usually update at 16.6 FPS in my games (50/3), because I don't scroll.

Keeping in mind that PCs usually refresh at 60 FPS... I would say: don't bother and make it feel nice in the platform you're developing for.

I dunno.  They feel wrong when going at 60fps with the Mode 0 graphics.  I've tried 30 and currently got them at 15fps and it feels... fine but when I try match the speed up with a true CPC game scrolling on WinApe it doesn't seem quite right no matter how much I tweak it.   I don't want people to play the Amstrad CPC-style version running smoothly on a PC and then find the eventual true CPC version to feel really different or wrong in some way. 
Favorite CPC games: SwitchBlade, Stryker in the Crypts of Trogan, Turrican II, UN Squadron, Oh Mummy

Offline reidrac

  • Supporter
  • 6128 Plus
  • *
  • Posts: 905
  • Country: gb
  • Trying to gamedev!
    • index.php?action=treasury
    • usebox.net
  • Liked: 1667
  • Likes Given: 896
Re: FPS of scrolling in certain games.
« Reply #4 on: 14:19, 29 December 16 »
I dunno.  They feel wrong when going at 60fps with the Mode 0 graphics.  I've tried 30 and currently got them at 15fps and it feels... fine but when I try match the speed up with a true CPC game scrolling on WinApe it doesn't seem quite right no matter how much I tweak it.   I don't want people to play the Amstrad CPC-style version running smoothly on a PC and then find the eventual true CPC version to feel really different or wrong in some way.

I think it would be reasonable to expect differences.

Also take into account that WinAPE is doing its best to emulate the CPC but the output is still 60 FPS!
Released The Return of Traxtor, Golden Tail, Magica, The Dawn of Kernel, Kitsune`s Curse and Brick Rick for the CPC.

If you like my games and want to show some appreciation, you can always buy me a coffee.

Offline RichTW

  • CPC464
  • **
  • Posts: 26
  • Country: es
  • Liked: 15
  • Likes Given: 13
Re: FPS of scrolling in certain games.
« Reply #5 on: 14:28, 01 January 17 »
I was very impressed with Stormlord on the CPC.  Does anyone know how it achieves such fast smooth scrolling?  Is it doing hardware scrolling (with rupture) using two screen banks offset at 2 pixels from each other?  Or is it doing a software scroll (effectively redrawing non-empty screen elements) with double buffering?  Or something else even more cunning?

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 585
  • Country: au
  • Liked: 383
  • Likes Given: 87
Re: FPS of scrolling in certain games.
« Reply #6 on: 03:02, 02 January 17 »
I was very impressed with Stormlord on the CPC.  Does anyone know how it achieves such fast smooth scrolling?  Is it doing hardware scrolling (with rupture) using two screen banks offset at 2 pixels from each other?  Or is it doing a software scroll (effectively redrawing non-empty screen elements) with double buffering?  Or something else even more cunning?

It's a software scroll, hardware double buffered.  It begins each frame with using the stack to clear the screen.  Then it prints the tiles over the freshly blanked screen.  I havent looked at the overall display loop, but presumably it's skipping the blank tiles.  Actually it must be, as those parallax stars are printed before the background.  The routine that prints the tiles is unrolled and uses the stack to read the tile data, interrupts are disabled.  It also appears to use separate routines for the partial edge tiles.

Offline RichTW

  • CPC464
  • **
  • Posts: 26
  • Country: es
  • Liked: 15
  • Likes Given: 13
Re: FPS of scrolling in certain games.
« Reply #7 on: 14:13, 02 January 17 »
I guess it would have been possible to do away with the 9k screen clear each update too, and only clear specific bits which need clearing, e.g. boundaries of scenery and moving sprites over blank background.  By my calculations, even a fully unrolled 9k screen clear using the stack takes around 200 scanlines.  Could at least have helped it run consistently in 3 frames, although it gets decidedly more complicated to actually implement once you need to keep track of all the moving boundaries.

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 585
  • Country: au
  • Liked: 383
  • Likes Given: 87
Re: FPS of scrolling in certain games.
« Reply #8 on: 08:01, 03 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.

Offline RichTW

  • CPC464
  • **
  • Posts: 26
  • Country: es
  • Liked: 15
  • Likes Given: 13
Re: FPS of scrolling in certain games.
« Reply #9 on: 12:12, 03 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).

So, yeah, in that case it's closer to 300 scanlines, basically 1 entire frame thrown away clearing the screen!  Shame that.  For sure, it will have been done entirely for simplicity reasons (I have a BBC Micro game which does exactly the same thing entirely out of laziness, which could be undoubtedly improved by only clearing what's necessary).

But I guess it paves the way for someone to do something Stormlord-esque at an even better frame rate! :)

Offline Carnivius

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.495
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1078
  • Likes Given: 591
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

  • CPC6128
  • ****
  • Posts: 166
  • Country: pl
  • Liked: 107
  • Likes Given: 0
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.495
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1078
  • Likes Given: 591
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.283
  • Liked: 576
  • Likes Given: 59
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: 585
  • Country: au
  • Liked: 383
  • Likes Given: 87
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.495
  • Country: gb
  • Mayhem Attack Squad
    • index.php?action=treasury
  • Liked: 1078
  • Likes Given: 591
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: 585
  • Country: au
  • Liked: 383
  • Likes Given: 87
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: 786
  • Country: gb
  • Liked: 288
  • Likes Given: 419
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: 26
  • Country: es
  • Liked: 15
  • Likes Given: 13
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: 585
  • Country: au
  • Liked: 383
  • Likes Given: 87
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.

Offline shaymanjohn

  • CPC464
  • **
  • Posts: 38
  • Country: gb
  • Liked: 100
  • Likes Given: 35
Re: FPS of scrolling in certain games.
« Reply #20 on: 22:41, 12 January 17 »
Is Zynaps using a software scroll? Always thought that looked really good from a technical point of view...