Why I hate emulation.

For topics which do not fit in other specific forums.
caffeinekid
Posts: 75
Joined: Wed Nov 04, 2020 10:03 am
Has thanked: 21 times
Been thanked: 14 times

Re: Why I hate emulation.

Unread post by caffeinekid »

Emulation is great. I have Switch, Wii-U, Gamecube, Dreamcast, PS2, PS3 etc on my PC. Obviously the old systems gain a great deal from hardware simulation, but newer machines it's more or less redirected/translated api calls (if I understand how it's done correctly??) so lag isn't so much an issue any more - and newer machines have to deal with laggy flatscreen delays so games don't rely as much on frame accurate inputs?

I love the MiSTer, but emulation is not the devil. :)
FoxbatStargazer
Top Contributor
Posts: 994
Joined: Thu Dec 10, 2020 5:44 pm
Has thanked: 309 times
Been thanked: 228 times

Re: Why I hate emulation.

Unread post by FoxbatStargazer »

Redream still feels laggy compared to a real dreamcast and dolphin compared to a Wii, I don't know why people keep saying software emulation of newer system will have the lag issue magically solved, it does not. You still have all the same problems accessing USB and outputs quickly on the multitasking OS and are still held up emulating parallel CPUs and specialized chips in a semi-linear way.

It is true though that when HDMI consoles appear game design begins to take into account laggy digital TVs.
Bas
Top Contributor
Posts: 518
Joined: Fri Jan 22, 2021 4:36 pm
Has thanked: 60 times
Been thanked: 225 times

Re: Why I hate emulation.

Unread post by Bas »

Modern games run on an OS that abstracts the hardware away on the actual original machine. Emulation requires that you give the game an API/ABI that's indistinguishable from the original. That doesn't mean simulating circuitry anymore. Modern GPU's etc. are massively more capable so they have the headroom needed to deal with translation. The parallelism is taken care of by the host hardware.

Emulating 8/16-bit machines is different because those were programmed right on the metal, so you must emulate the actual metal for them to work right.
Chopin
Posts: 5
Joined: Fri Jul 30, 2021 1:37 pm
Been thanked: 3 times

Re: Why I hate emulation.

Unread post by Chopin »

aberu wrote: Sat Jul 31, 2021 3:44 am I'll wait for a more proper test demonstration than that video to prove otherwise. The video doesn't compare with original hardware directly, he just says that mario jumps within one frame of lag. There's no test-retest to account for sub-frame variance in lag. He used a "random Displayport to VGA adapter", so there is almost guaranteed more lag than original hardware and analog signals when compared to something like the MiSTer since you still have some video processing lag involved in that signal chain. Did Tyler Loch use a lag tester to do an equipment test on that adapter? There's a reason why someone like Bob from RetroRGB is much more thorough, because he wants to be as sure as possible that his claims are correct, whereas that video doesn't really prove much to me personally.
Here you are, in that case. This is my own setup, on a 34UC89-G and a Razer Panthera, on Windows 10. I'm using Vulkan and Snes9x, here, with two frames of run-ahead latency reduction. I have an LED diode wired to my button so frames can be counted more accurately, along with a frame counter OSD.

Count the frames yourself if you'd like, the video file is in 240fps, and so displays four frames for each individual frame of gameplay--you'll have to hit the "download" button after opening the link to Google Drive. Most of my inputs have one frame of latency--e.g., you'll see the diode cut out on frame 1 when the input happens, nothing will happen on frame 2, then Mario's animation will begin on frame 3. Some of my inputs have two frames of latency. None of them that I could find have three frames of latency, so as you'd expect, the latency varies by one frame.

It'd be possible to get my latency lower, but my monitor has at least 14ms of latency (the price you pay for an IPS panel, apparently), and the Panthera has at least 4ms of input latency. Which means that I have at least one frame of latency built into my setup itself, which means that RetroArch is indeed responding on the next frame, in at least some instances.

As I claimed earlier, though: even on my non-CRT setup, I'm able to beat or match original hardware input latency in most cases where run-ahead latency reduction is possible to perform. In this case, original hardware performance is two frames of latency--that's what's built into Super Mario World's engine. That's not a matter of speculation, that's just common knowledge. And if I were running my own setup on a CRT with a USB controller capable of 1ms response times, then there would be zero additional input latency over original hardware, even with run-ahead latency reduction enabled, at least for this specific core.

When you say
so there is almost guaranteed more lag than original hardware
it's not clear whether you're understanding what's going on; that CRT video shows next-frame response, which means there's literally zero latency. Original hardware is entirely incapable of next-frame response, and will always have at least one frame of latency. I find it kind of strange that you're having technical discussions about input latency on original hardware when you don't seem to know what kind of latency original hardware has.

The reality is that with contemporary hardware, contemporary video drivers, and contemporary operating systems, a properly coded emulator can get its frames to the display in less time than it takes for the display to process the next frame at 60fps. Which should be entirely unsurprising, considering how much more powerful PC hardware has become in the last decade, and how much of an emphasis there now is on higher framerates and lower input latency when it comes to PC gaming. That's now bled over even to console gaming, where you're seeing 120Hz become a standard for both televisions and gaming consoles themselves.
User avatar
aberu
Core Developer
Posts: 1144
Joined: Tue Jun 09, 2020 8:34 pm
Location: Longmont, CO
Has thanked: 244 times
Been thanked: 388 times
Contact:

Re: Why I hate emulation.

Unread post by aberu »

Thanks for the vid, that is great. It demonstrates exactly what you claim, next frame response consistently, pretty much.
Original hardware is entirely incapable of next-frame response
Not from my understanding but okay. I agree that this is the case more and more from PS1, to PS2, etc... Because they had that lag built in, they added dedicated GPU's which have framebuffer overhead, etc... The games were then designed around input lag being a gaven.

But next frame response being the minimum implies the NES doesn't read and execute a button press in under 16.6667~ms, and it implies that it would take 33.33333~ms to see the video update in response to the button press on a CRT. If this were the case, the Zapper wouldn't work consistently on original hardware hooked up to a CRT either. But it does. The NES itself does respond to the button push nearly instantaneously, it's at an incredibly low level merely electrical circuitry with some incredibly simple digital logic going on. It just can't display the response on the screen until the screen catches up to the update from the analog video chain. If a CRT had a refresh rate of 60hz, then of course you are limited to the TV having a 16.6667~ms response measurably, but the game system isn't updating that way internally, and that doesn't make it incapable of updating the screen within the next frame.

Either way, I have zero problem with and I regularly do say that software emulators have significant advantages in many avenues, and it's mostly dependent upon comparably expensive auxiliary hardware ($1000+ computer, combined with a nice monitor, maybe special hardware form the retro gaming community to do workarounds like GroovyMAME requires, etc...) when compared to the MiSTer. They each have strengths and weaknesses. To my ears, the best implementation of Sega Genesis audio emulation in software still doesn't sound right, whereas the MiSTer core is almost perfect (very few bugs and issues in some games still, but it's getting a major rewrite of the code from my understanding which should address these issues).
birdybro~
Chopin
Posts: 5
Joined: Fri Jul 30, 2021 1:37 pm
Been thanked: 3 times

Re: Why I hate emulation.

Unread post by Chopin »

aberu wrote: Fri Aug 06, 2021 3:51 pm Not from my understanding but okay. I agree that this is the case more and more from PS1, to PS2, etc... Because they had that lag built in, they added dedicated GPU's which have framebuffer overhead, etc... The games were then designed around input lag being a gaven.

But next frame response being the minimum implies the NES doesn't read and execute a button press in under 16.6667~ms, and it implies that it would take 33.33333~ms to see the video update in response to the button press on a CRT. If this were the case, the Zapper wouldn't work consistently on original hardware hooked up to a CRT either. But it does. The NES itself does respond to the button push nearly instantaneously, it's at an incredibly low level merely electrical circuitry with some incredibly simple digital logic going on. It just can't display the response on the screen until the screen catches up to the update from the analog video chain. If a CRT had a refresh rate of 60hz, then of course you are limited to the TV having a 16.6667~ms response measurably, but the game system isn't updating that way internally, and that doesn't make it incapable of updating the screen within the next frame.
I might be a little more specific: the NES hardware is of course capable of rendering next-frame inputs--but the caveat is that that's only on bare metal. When you're running a game, virtually every game post-early-Atari-era has at least one frame of latency baked into the game's engine, which is probably just a result of the sheer fact that there's not really a compelling reason to aim to design a game engine that's so fast and lean that it runs on less than one frame of latency. Preceding the 32-bit era, the rule of thumb is that basically everything has at least one frame of latency, somewhere between a minority and a majority of games have two frames, and very rarely games will have three or more frames. For example, Super Mario Bros. on NES has one frame of latency, while Super Mario World on SNES has two.

You can verify this using pretty much any core in RetroArch in tandem with the frame advance feature--pause emulation, press input, advance game one frame at a time using hotkey, note when input is registered. That's the standard way of determining how many frames of lag to compensate for via the run-ahead latency reduction feature.

At any rate, I entirely agree that the MiSTer is an amazing piece of hardware and that it provides an emulation experience that's about as good as it gets for a relatively minimal cost. But at the same time, it stands on the shoulders of software emulation giants (especially in terms of the decades of meticulous documentation that were necessary for it to be possible to write FPGA cores), and I'm always quick to point out just how good software emulation can be under the right circumstances, despite the fact that it can be pretty terrible under the wrong circumstances. So I hope I don't come off too abrasively. I'd also never gone through the trouble of performing an appropriate test on my own setup, so it was pretty fun to confirm with my own eyes what I had just assumed I was getting.
User avatar
aberu
Core Developer
Posts: 1144
Joined: Tue Jun 09, 2020 8:34 pm
Location: Longmont, CO
Has thanked: 244 times
Been thanked: 388 times
Contact:

Re: Why I hate emulation.

Unread post by aberu »

No, it's fine. I'm just the type that discusses things back and forth like this enthusiastically too. We actually mostly agree.
birdybro~
ExCyber
Posts: 217
Joined: Sun May 24, 2020 3:33 pm
Has thanked: 11 times
Been thanked: 66 times

Re: Why I hate emulation.

Unread post by ExCyber »

Chopin wrote: Fri Aug 06, 2021 8:04 pm When you're running a game, virtually every game post-early-Atari-era has at least one frame of latency baked into the game's engine, which is probably just a result of the sheer fact that there's not really a compelling reason to aim to design a game engine that's so fast and lean that it runs on less than one frame of latency.
I think it boils down to the fact that it's very straightforward for an old-school engine to read the controllers during or immediately after vblank and let all of the code assume that the input is current during the following frame of processing (especially on SNES, which has hardware support for automatically reading input during vblank). As far as I can figure out, significantly sub-frame input latency requires either wasting CPU time or carefully separating the game into input-dependent and input-independent subroutines so that it can delay reading input until closer to the next frame. This is essentially the principle behind RetroArch's "frame delay" feature.
Chopin
Posts: 5
Joined: Fri Jul 30, 2021 1:37 pm
Been thanked: 3 times

Re: Why I hate emulation.

Unread post by Chopin »

ExCyber wrote: Sat Aug 07, 2021 6:28 pmI think it boils down to the fact that it's very straightforward for an old-school engine to read the controllers during or immediately after vblank and let all of the code assume that the input is current during the following frame of processing (especially on SNES, which has hardware support for automatically reading input during vblank). As far as I can figure out, significantly sub-frame input latency requires either wasting CPU time or carefully separating the game into input-dependent and input-independent subroutines so that it can delay reading input until closer to the next frame. This is essentially the principle behind RetroArch's "frame delay" feature.
Ah, interesting insight. So it's probably just far less complicated from a code perspective to do input at perfectly regular intervals, and the only way to do that is with at least one frame of latency so that inputs executed at different times within the current frame can all be delivered at the same time for the sake of producing the next frame, if I'm interpreting all of that correctly. Otherwise, you'd have to worry about the precise time during which the input was received in the middle of frame generation, and what to decide to do with that input based on the sub-frame time at which it was received.
2DBox
Posts: 1
Joined: Sun Dec 05, 2021 11:48 pm
Has thanked: 3 times

Re: Why I hate emulation.

Unread post by 2DBox »

I'm sorry if responding in old thread isn't okay. I was searching for "duckstation lag emulation" to figure out if it's deterministic and came here. A few of the anti-emulation comments made me cringe but the responses are really impressive. I wanted to cover the greater picture.

FPGA cores such as MiSTer and Analogue devices are emulators too. They emulate at the hardware level using the VHDL, Verilog and/or SystemVerilog programming languages. Hardware method has pros and cons. Probably the biggest con is the cost. I can afford a $300 gaming device living in rich US but not most of my coworkers living in the Philippines and India. I don't think it's fair to compare MiSTeR to a device that costs 10x less without considering price points. Not asking for optimal RetroPie settings is another thing.

I have business refurbished ~$100 Windows 10 PC that plays the SNES and PS1 games I like with no perceptible input lag or inaccuracies*. The emulation was a bonus feature since I bought it to run PCIe capture cards. I had similar controller XInput / Dinput issue as chanunnaki on DuckStation that I solved in 15 minutes.

*No PlayStation emulator emulates disc loading lag correctly. They certainly reduce it.
witinhalf wrote: Wed Apr 07, 2021 3:41 am I've tried to play Yoshi's Island emulated for years. I've tried it with ZSNES, SNES9X, all the retroarch cores, raspberry pi, etc... I was never able to get into the game. It felt like the SNES just wasn't powerful enough to handle such a complex game. I guess that I never played it as it was intended. My friend was over when I got my MiSter and I launched Yoshi's Island to give it a test. The game is not the same game. I love it. Emulation does not cut it for this game.
I'm sorry that no one knew how to accurately emulate the Super FX2 chip of Yoshi's Island until the very expensive and difficult team effort to decap with byuu (Near) in 2010-2012. I see videos of Raspberry Pi 3 and RetroPie 4.4 running Yoshi's Island. SNES9X v1.57 released in late 2018 runs it accurately. RetroArch has cores that can. Seemed accurate to me on Nintendo Switch. Are we living in the same universe?

Chopin mentioned MiSTer benefitting from the work of software emulators going back to the 90s dark ages. I read on shmups forum that the SNES core started as a direct port of cycle accurate bsnes. There was no need to reverse engineer the enhancement chips to play some of the most popular games since this task had been done and open sourced!

Not a con but the reality is running at the cycle level is not the same as being cycle accurate. The Game Boy core originally paled in comparison to Gambatte, BGB and SameBoy but it's become much more accurate thanks to continued development. Several audio errors aside, a few GB and GBC games are not playable. You can see the actual response is asking if any software emulators have coded their memory bank controllers. In other words, the core dev doesn't know how.
akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: Why I hate emulation.

Unread post by akeley »

Every time I see this topic's title, it makes me cringe. Please let it go to sleep :)
dshadoff
Core Developer
Posts: 534
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 19 times
Been thanked: 141 times

Re: Why I hate emulation.

Unread post by dshadoff »

One might as well say something like "There's no difference between a Toyota and a Lexus".
In fact there is, but for many people the differences aren't worth the money.
And in some cases, might not even be noticed.

Whatever makes you happy, please pursue it.
For me, I will pursue both FPGAs and software emulation, in different use cases.
User avatar
aberu
Core Developer
Posts: 1144
Joined: Tue Jun 09, 2020 8:34 pm
Location: Longmont, CO
Has thanked: 244 times
Been thanked: 388 times
Contact:

Re: Why I hate emulation.

Unread post by aberu »

WellI wanted to delete my necro post to help this thread die, but apparently I can't. Either way, FPGA isn't magic, things like tri-state logic and asynchronous flip flops and analog circuitry cannot be recreated on a modern FPGA 1:1 anyways, so it's just a weird post with a strange and disrespectful anger toward the giants upon which FPGA-based emulators almost always stand upon.
birdybro~
Post Reply