fengb / fundude

Gameboy emulator: Zig -> wasm
https://fengb.github.io/fundude/
MIT License
181 stars 8 forks source link

More consistent render performance #34

Open fengb opened 4 years ago

fengb commented 4 years ago

Gameboy renders the picture at a consistent 59.7275 Hz. This is a hardware limitation and cannot be delayed.

Monitors will never use this refresh rate, meaning we are unable to exactly match the “native” framerate. With the best monitors at tight tolerances, there's an extra frame every ~4s.

A notable manifestation of this waggle is ZAS, which requires consistent frame performance or the video has major artifacts. It exploits a hardware quirk by alternating every frame, creating a "transparent" background.

fengb commented 4 years ago

Idea:

  1. Introduce "frame number". This is always incrementing / wraps around.
  2. Render only when the frame number changes.
  3. (???) maybe only blend for incremental frames
fengb commented 3 years ago

Another idea:

  1. Core steps by single frame
  2. Loop may advance multiple frames
  3. Blend all the generated frames together