Slowdown: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
Line 1: Line 1:
Slowdowns are perceived during gameplay as slow picture updates (frameskip), this is only caused by the [[68k|CPU]] not being able to update [[VRAM]] often enough to animate sprites smoothly.
Slowdowns are perceived during gameplay as slow picture updates (frameskip). On the NeoGeo, this happens when the [[68k|CPU]] is not able to update the [[VRAM]] often enough to animate sprites smoothly.


If a game wants to run at a constant [[framerate|60 FPS]] (no frameskip), the calculations for a frame need to last less than 1/60 = 16.7ms. For 30 FPS (1/2 frameskip), they need to last less than 1/30 = 33.3ms.
If a game wants to run at a constant [[framerate|60 FPS]] (no frameskip), the calculations for a frame need to last less than 1/60 = 16.7ms. For 30 FPS (1/2 frameskip), they need to last less than 1/30 = 33.3ms.


If calculations are too long and "overflow" to the next frame, the frame will be skipped. For example, if calculations last 16.8ms, a whole frame will be skipped because the CPU was 0.1ms late.
If calculations are too long and continue into the next frame, that frame will be skipped. For example, if calculations last 16.8ms, a whole frame will be skipped because the CPU was 0.1ms late.


Games known for having slowdowns are:
Games known for having slowdowns are:
Line 9: Line 9:
*[[Blazing Star]]
*[[Blazing Star]]
*[[Metal_Slug_2_-_Super_Vehicle-001/II|Metal Slug 2]]
*[[Metal_Slug_2_-_Super_Vehicle-001/II|Metal Slug 2]]
*[[Shock Troopers]]...
*[[Shock Troopers]]
*[[Twinkle Star Sprites]]
*[[Twinkle Star Sprites]]...


In the following graphs:
In the following graphs:
*The vertical lines are frame ticks given by the GPU, they always occur every 16.7ms (60Hz)
*The vertical lines are frame ticks ([[68k interrupts|interrupts]]) given by the video controller, they always occur every 16.7ms (60Hz)
**'''Black lines''' are updated frames (different from the last one)
**'''Black lines''' are updated frames (different from the last one)
**<span style="color:#7F0000">'''Red lines'''</span> are skipped frames (same as the last one)
**<span style="color:#7F0000">'''Red lines'''</span> are skipped frames (same as the last one)
*<span style="color:#007F7F">'''Cyan areas'''</span> are the [[vertical blank interrupt|vblank]] periods, during which the CPU updates VRAM
*<span style="color:#007F7F">'''Cyan areas'''</span> are the v-blank periods, during which the CPU updates VRAM
*<span style="color:#007F00">'''Green zones'''</span> are CPU calculations not causing frameskip
*<span style="color:#007F00">'''Green zones'''</span> are CPU calculations not causing frameskip
*<span style="color:#7F7F00">'''Yellow zones'''</span> are CPU calculations causing unwanted frameskip
*<span style="color:#7F7F00">'''Yellow zones'''</span> are CPU calculations causing unwanted frameskip
Line 30: Line 30:
[[File:Lag60fs.png]]
[[File:Lag60fs.png]]


If CPU calculations are longer than 16.7ms, the next frame is skipped. Multiple consecutive frames can be skipped (see [[overclocking#perceived slowdown|Perceived slowdown]]).
If CPU calculations are longer than 16.7ms, the next frame is skipped. Multiple consecutive frames may be skipped (see below).


=30 FPS engine=
=30 FPS engine=


The game's engine voluntarily updates one frame out of two, making the game run at 30 FPS at best. Note that the GPU '''always''' runs at 60.  
The game's engine voluntarily updates one frame out of two, making the game run at 30 FPS at best. The video controller '''always''' runs at 60 FPS.  


Has the advantage of giving a more consistent framerate if the game tends to often exceed the 16.7ms limit, at the expense of more pronounced slowdown if it occurs.
This has the advantage of giving a more consistent framerate if the game tends to often exceed the 16.7ms limit, at the expense of animation which is less smooth overall.


==No slowdown==
==No slowdown==
[[File:Lag30.png]]
[[File:Lag30.png]]


If CPU calculations are always shorter than 33.3ms, one frame out of two is updated.
If CPU calculations are always shorter than 33.3ms, one frame out of two is updated, as expected.


==Slowdowns==
==Slowdowns==
[[File:Lag30fs.png]]
[[File:Lag30fs.png]]


If CPU calculations are longer than 33.3ms, two or more frames are skipped. Multiple groups of frames can be skipped (see [[overclocking#perceived slowdown|Perceived slowdown]]).
If CPU calculations are longer than 33.3ms, two or more frames are skipped. Multiple groups of frames can be skipped (see below).


Some game engines might be smart enough to "resync" and skip only one frame if they detect one was already accidentally skipped (doesn't rely on the LSB of a frame counter).
Some game engines are smart enough to "resync" and skip only one frame if they detect that one was already accidentally skipped (doesn't rely on the LSB of a frame counter).


=Perceived slowdown=
=Perceived slowdown=

Latest revision as of 06:17, 24 November 2018

Slowdowns are perceived during gameplay as slow picture updates (frameskip). On the NeoGeo, this happens when the CPU is not able to update the VRAM often enough to animate sprites smoothly.

If a game wants to run at a constant 60 FPS (no frameskip), the calculations for a frame need to last less than 1/60 = 16.7ms. For 30 FPS (1/2 frameskip), they need to last less than 1/30 = 33.3ms.

If calculations are too long and continue into the next frame, that frame will be skipped. For example, if calculations last 16.8ms, a whole frame will be skipped because the CPU was 0.1ms late.

Games known for having slowdowns are:

In the following graphs:

  • The vertical lines are frame ticks (interrupts) given by the video controller, they always occur every 16.7ms (60Hz)
    • Black lines are updated frames (different from the last one)
    • Red lines are skipped frames (same as the last one)
  • Cyan areas are the v-blank periods, during which the CPU updates VRAM
  • Green zones are CPU calculations not causing frameskip
  • Yellow zones are CPU calculations causing unwanted frameskip

60 FPS engine

No slowdown

If CPU calculations are always shorter than 16.7ms, each and every frame is updated.

Slowdowns

If CPU calculations are longer than 16.7ms, the next frame is skipped. Multiple consecutive frames may be skipped (see below).

30 FPS engine

The game's engine voluntarily updates one frame out of two, making the game run at 30 FPS at best. The video controller always runs at 60 FPS.

This has the advantage of giving a more consistent framerate if the game tends to often exceed the 16.7ms limit, at the expense of animation which is less smooth overall.

No slowdown

If CPU calculations are always shorter than 33.3ms, one frame out of two is updated, as expected.

Slowdowns

If CPU calculations are longer than 33.3ms, two or more frames are skipped. Multiple groups of frames can be skipped (see below).

Some game engines are smart enough to "resync" and skip only one frame if they detect that one was already accidentally skipped (doesn't rely on the LSB of a frame counter).

Perceived slowdown

Skipping one or two frames from time to time is rarely perceived or felt by the player. Annoying slowdowns occur when the video appears to stall.

Perception of slowdowns depends on the spreading of updates:

  • #-#-#-#-#-#-#-#- is 30 FPS, acceptable.
  • ########-------- is also 30 FPS, but very bothering.

Game engine logic

Are there game engines stupid enough to try catching up on each and every frame, instead of skipping some ?