UPDATE: This post contains some misinformation based on assumptions. These suggested settings in MAME seem to cause lag similar to all "vsync" implementations, and while I haven't tested it yet, I wouldn't be surprised if the same goes for all of these emulators. That being said, these settings/suggestions still lead to the smoothest image possible, so if you're playing a game where a frame or two of lag is acceptable, I would still follow them.
UPDATE #2: Nvidia's newly-announced G-SYNC looks to solve these issues. Using an emulator with vsync off (meaning Aero off for those emulators that don't have true fullscreen) on a G-SYNC setup should lead to a lag-free, tear-free, and stutter-free visual experience. I look forward to updating when I get my hands on it.
--------------------------------------------------------------------------------
Ever get the impression that something emulated just isn't running as smooth as the real thing, but you can't quite put your finger on why? There just might be some useful information in here, then!
What's the point of this thread?
Some emulators synchronize "the right way". Many do not. I've been curious about this for a while now, and this thread is a place for me to explain what I've learned and ask a few questions of my own.
What's this stuff about synchronizing? Isn't everything 60hz anyway?
Hell nah. When it comes to emulation, there's often a slight difference in video frequencies. Your monitor, at its native resolution, might run at 60.021hz, but that Famicom game you're trying to play is made for a machine that ALWAYS outputs 60.098hz.
Many emulators, when left to defaults, will simply let the screen tearing fly in the above situation. The game is generating images at a different rate than your monitor is displaying them, which means that you'll never see a solid single image. Instead, you'll see a state between two frames, with a distinct line between the generated portion of the new frame and the old frame that's getting overwritten (assuming there's enough motion going on). Of course, this is ugly. If the difference in frequencies is small enough, the line can slowly creep along. If the difference is great enough (57hz games emulated in a 60hz resolution), the line can slam across the screen rapidly, creating a very annoying stutter effect.
How do we deal with this? Surely we can use VSync to eliminate screen tearing!
Yes, we can. The problem is, VSync doesn't mean the same thing across the board. Different emulators have options labeled "VSync" that actually do different things. Some emulators don't use the term at all for their sync options.
The way VSync works in most modern games is to delay the display of the screen until there's a full image present. In other words, WAIT until there is no visible tear, then show the image. This can lead to lower framerates and input delay. Certain emulators offer this option, and it can similarly lead to dropped frames (even consistently dropped frames, like x frames per second of stutter) or noticeable input lag. This is bad.
The way VSync (or other sync options) works in other emulators, however, is much more logical. Instead of futzing with the display timing, the emulator instead changes the timing of the HARDWARE IT IS EMULATING. By making that Famicom game output at 60.02hz instead of 60.098hz, you are removing the frequency difference entirely. Are you altering the game's speed? Yes. Are you honestly going to notice such a minute difference? No. Is this change in speed a better option than introducing stuttering or lag? Absolutely. This is good, and this is usually the right way to handle frequency differences in hardware. I usually refer to this as "syncing to monitor refresh", as that's what MAME calls it. Generally, the only downside to this approach is that it can cause very slight audio hiccups in some emulators and games. Finally, this approach will NOT work if your hardware's display frequency is LOWER than the hardware you wish to emulate.
Now, to talk about some emulators and platforms.
MAME, thankfully, allows for altering the game's original speed properly. If you turn on "Sync to Monitor Refresh" and turn OFF "Throttle", it will raise a game's display frequency to match that of your screen and run perfectly. One thing to watch out for, though, are the games that have refresh rates far removed from 60; stuff like R-Type (55hz) will play significantly faster with this method. In these cases, I suggest finding a resolution that your screen supports with a closer frequency and telling MAME to use that resolution.
SNES emulators were disappointing to me for some time. ZSNES and SNES9x both had sync options that did things the wrong way, and MESS, while offering the same features as MAME, simply didn't have the compatibility. Then I found lovely little SNESGT. SNESGT is a Japanese SNES/SFC emulator that, while slightly lacking in the video options department, has a sync option (called "Synchronous Update") that does things the right way. Many Japanese emulators seem to.
NES is a tricky spot for me, too. I love Nestopia, but Nestopia's VSync is the lag-introducing kind, and its Sync to Monitor Refresh option doesn't sync the frequencies completely; it always leaves a VERY slowly creeping line. I'd rather have this than a fast flickering line, though, so I still tend to use it. MESS doesn't look as good, even if it handles the timing better. I haven't looked into other emulators enough. Update: VirtuaNES, another Japanese emulator, seems excellent and has proper sync. Thanks hikarutilmitt!
For Genesis and SMS, you have the excellent Kega Fusion. I'm 99% sure that Fusion's "VSync" option does things the right way.
TG16 has Ootake, which, like other Japanese emulators, does VSync right. Should be all you need.
For Saturn I use SSF, but I honestly haven't been able to confirm how the emulator's VSync option behaves. On one hand, it seems good to me, on the other, I've heard mentions of lag. Can anyone confirm or deny how it behaves?
PSX has pSX Emulator and the ever-so-famous ePSXe. pSX Emulator, sadly, does things the laggy way. With ePSXe, it all depends on the display plugin. Last I checked, Pete's hardware-accelerated plugins actually do things the wrong way, where "VSync" on his Software plugin does things the right way. Funny!
This may all seem overkill, but, hey, to me it's the difference between a practically perfect experience and a tear-ridden jerky mess.
UPDATE #2: Nvidia's newly-announced G-SYNC looks to solve these issues. Using an emulator with vsync off (meaning Aero off for those emulators that don't have true fullscreen) on a G-SYNC setup should lead to a lag-free, tear-free, and stutter-free visual experience. I look forward to updating when I get my hands on it.
--------------------------------------------------------------------------------
Ever get the impression that something emulated just isn't running as smooth as the real thing, but you can't quite put your finger on why? There just might be some useful information in here, then!
What's the point of this thread?
Some emulators synchronize "the right way". Many do not. I've been curious about this for a while now, and this thread is a place for me to explain what I've learned and ask a few questions of my own.
What's this stuff about synchronizing? Isn't everything 60hz anyway?
Hell nah. When it comes to emulation, there's often a slight difference in video frequencies. Your monitor, at its native resolution, might run at 60.021hz, but that Famicom game you're trying to play is made for a machine that ALWAYS outputs 60.098hz.
Many emulators, when left to defaults, will simply let the screen tearing fly in the above situation. The game is generating images at a different rate than your monitor is displaying them, which means that you'll never see a solid single image. Instead, you'll see a state between two frames, with a distinct line between the generated portion of the new frame and the old frame that's getting overwritten (assuming there's enough motion going on). Of course, this is ugly. If the difference in frequencies is small enough, the line can slowly creep along. If the difference is great enough (57hz games emulated in a 60hz resolution), the line can slam across the screen rapidly, creating a very annoying stutter effect.
How do we deal with this? Surely we can use VSync to eliminate screen tearing!
Yes, we can. The problem is, VSync doesn't mean the same thing across the board. Different emulators have options labeled "VSync" that actually do different things. Some emulators don't use the term at all for their sync options.
The way VSync works in most modern games is to delay the display of the screen until there's a full image present. In other words, WAIT until there is no visible tear, then show the image. This can lead to lower framerates and input delay. Certain emulators offer this option, and it can similarly lead to dropped frames (even consistently dropped frames, like x frames per second of stutter) or noticeable input lag. This is bad.
The way VSync (or other sync options) works in other emulators, however, is much more logical. Instead of futzing with the display timing, the emulator instead changes the timing of the HARDWARE IT IS EMULATING. By making that Famicom game output at 60.02hz instead of 60.098hz, you are removing the frequency difference entirely. Are you altering the game's speed? Yes. Are you honestly going to notice such a minute difference? No. Is this change in speed a better option than introducing stuttering or lag? Absolutely. This is good, and this is usually the right way to handle frequency differences in hardware. I usually refer to this as "syncing to monitor refresh", as that's what MAME calls it. Generally, the only downside to this approach is that it can cause very slight audio hiccups in some emulators and games. Finally, this approach will NOT work if your hardware's display frequency is LOWER than the hardware you wish to emulate.
Now, to talk about some emulators and platforms.
MAME, thankfully, allows for altering the game's original speed properly. If you turn on "Sync to Monitor Refresh" and turn OFF "Throttle", it will raise a game's display frequency to match that of your screen and run perfectly. One thing to watch out for, though, are the games that have refresh rates far removed from 60; stuff like R-Type (55hz) will play significantly faster with this method. In these cases, I suggest finding a resolution that your screen supports with a closer frequency and telling MAME to use that resolution.
SNES emulators were disappointing to me for some time. ZSNES and SNES9x both had sync options that did things the wrong way, and MESS, while offering the same features as MAME, simply didn't have the compatibility. Then I found lovely little SNESGT. SNESGT is a Japanese SNES/SFC emulator that, while slightly lacking in the video options department, has a sync option (called "Synchronous Update") that does things the right way. Many Japanese emulators seem to.
NES is a tricky spot for me, too. I love Nestopia, but Nestopia's VSync is the lag-introducing kind, and its Sync to Monitor Refresh option doesn't sync the frequencies completely; it always leaves a VERY slowly creeping line. I'd rather have this than a fast flickering line, though, so I still tend to use it. MESS doesn't look as good, even if it handles the timing better. I haven't looked into other emulators enough. Update: VirtuaNES, another Japanese emulator, seems excellent and has proper sync. Thanks hikarutilmitt!
For Genesis and SMS, you have the excellent Kega Fusion. I'm 99% sure that Fusion's "VSync" option does things the right way.
TG16 has Ootake, which, like other Japanese emulators, does VSync right. Should be all you need.
For Saturn I use SSF, but I honestly haven't been able to confirm how the emulator's VSync option behaves. On one hand, it seems good to me, on the other, I've heard mentions of lag. Can anyone confirm or deny how it behaves?
PSX has pSX Emulator and the ever-so-famous ePSXe. pSX Emulator, sadly, does things the laggy way. With ePSXe, it all depends on the display plugin. Last I checked, Pete's hardware-accelerated plugins actually do things the wrong way, where "VSync" on his Software plugin does things the right way. Funny!
This may all seem overkill, but, hey, to me it's the difference between a practically perfect experience and a tear-ridden jerky mess.