18 ms·
Yuzu (Nintendo Switch Emulator) Progress Report January 2021
- gamegoblin 6y agoDoes anyone have any links to blog posts they consider good descriptions of what goes into making a game console emulator? I am super impressed by the content of this post, but I bet there is also a lot that is going over my head that I am not even aware of.
- Cyph0n 6y agoI’ve recently been working on a Gameboy Color emulator in Rust[1], mostly as a learning project, and it has been an absolute blast! I’ve never enjoyed working on a project this much to be honest - it’s very satisfying to gradually see your emulator run games developed for another system, especially if it’s a system you’ve personally used in the past. In my opinion, the best way to learn how an emulator works is to start writing one. /r/emudev and the emudev Discord (see subreddit sidebar) are a great place to start. The Discord in particular is great: it’s split into channels for each system, and there are a ton of pointers to resources for all systems in the main channel. As far as consoles go, the typical recommendation is to start with CHIP-8. It’s a straightforward system with a very simple design, which makes it relatively easy to emulate. [1] For the curious: https://github.com/aksiksi/gbc https://github.com/aksiksi/gbc
- city41 6y agoI agree for older machines this is a great approach. A lot of the challenge is being organized and persistent, powering through all the opcodes and making sure they're accurately implemented. I made a Sega Master System emulator many years ago and it was a fun project. I do wonder how one takes on modern machines though. It seems like it'd be a completely different ball of wax.
- Cyph0n 6y agoOh definitely, writing an emulator for a modern system is an entirely different ballgame. I truly respect the dedication and skill of the people behind large emulator projects like PCSX2 and Dolphin.
- agret 6y agoModern game consoles have a lot of common library / OS system calls that instead of emulating you re-create those calls and make your own implementation with the expected return values. The low level stuff and shader translation aspects are very complicated though.
- djmips 6y agoThere must be hundreds of Gameboy emulators now. I guess it's the equivalent of "Hello World" for emulators.
- TylerE 6y agoInfocom Z-Machine? Probably even simpler to implement since it was designed to be emulated.
- sanj 6y agoBeen there, done that! And it was a blast.
- AnIdiotOnTheNet 6y agoPretty sure the word "emulation" doesn't apply. The Z-Machine never had hardware to be emulated, only a virtual machine to be implemented. Ditto CHIP-8 though. For emulating a real system, the Gigatron would be relatively simple. The hard part would be the display because it is bit-banged into NTSC.
- Cyph0n 6y agoI think CHIP-8 is a better candidate for that title. But yes, Gameboy emulators are quite common.
- deleted 6y ago[deleted]
- peteretep 6y ago> it’s very satisfying to gradually see your emulator run This does sound like fun. I feel like I’ve had a similar experience in porting and refactoring legacy code, and each successive step forward unlocks more and more cool stuff
- denkmoon 6y agohttps://cturt.github.io/cinoop.html https://cturt.github.io/cinoop.html Basic overview of a GameBoy emulator. Far cry from the complexities of a Switch, but still a great writeup by cturt.
- HideousKojima 6y agoIf you want to get into writing emulators yourself, I'd recommend starting with the CHIP-8. I just wrote one in C# and it was pretty easy, still need to properly handle input and rendering though (I'm currently saving the display output to a bitmap after every draw call)
- fermentation 6y agoIf you’ve got a bitmap you’re almost there, you can stream that bad boy over the bus to SDL for rendering.
- riverg 6y agoI wrote up a series [0] documenting a CHIP-8 emulator I wrote that I hope explains how to get something like this working from the ground up, albeit for a much simpler system. [0] https://river.codes/emulating-a-computer-part-1/ https://river.codes/emulating-a-computer-part-1/
- TAForObvReasons 6y agoDolphin (wii / gc emulator) blog is great: https://dolphin-emu.org/blog/ https://dolphin-emu.org/blog/
- lathiat 6y agoThere are some pretty good YouTube videos on the subject, worth a search
- JetSpiegel 6y agohttps://byuu.net/ https://byuu.net/
- city41 6y agoIt's really impressive how quickly new devices get emulated these days.
- reocha 6y agoThe switch was actually a special case, most of the APIs (the nvidia ones) where already decently well understood and the OS was based on the 3DS OS. The yuzu dev team still did an amazing job.
- cwyers 6y agoAlso, it has hardware specs that make it reasonable to emulate. You're very unlikely to see a PS5 or Xbox Series X emulator anytime soon.
- nemothekid 6y agoWould you even need to emulate PS5/XSX games? AFAIK, they are already x86 - you would just need provide the library APIs and break the security.
- spijdar 6y agoThis is a pretty common and old idea, dating back to the original xbox, which was basically "just" a normal pentium processor with an nvidia gpu. For various reasons, though, this sort of emulation has a lot of pitfalls. Either you directly run a lot of the console's firmware and e.g. try to implement the hardware devices in QEMU, or you try to recreate the console OS/firmware at a higher level, mimicking the underlying APIs. Neither are easy tasks. Take a look at the original xbox -- the emulators available aren't really great, even after nearly 2 decades of hard work. Of course, any complex emulator is hard -- just pointing out this isn't really as much of a shortcut as it may seem. The biggest upside is just (potentially) performance, as you don't need to interpret or translate CPU instructions.
- kristofferR 6y ago
- Apofis 6y agoFor someone that's been following Dolphin's progress for so long it's really amazing that there's already a pretty well done Nintendo Switch emulator.
- vinceguidry 6y agoIt shouldn't be. The hardware and software development toolsets used by modern game systems get ever-so-closer to commodity PC hardware with every market cycle. Older hardware is actually harder to emulate than newer. NES cartridges had their memory controllers built into the cartridge. The newer ones used by games such as Castlevania 3 are imperfectly understood and many games still have crash glitches. Only roughly half of these controllers were made by Nintendo and not all of the ones that weren't were licensed. The situation with the SNES is in some ways better and some ways worse.
- qwertay 6y agoThe wii and gamecube had only CDs for storage so it doesn't run in to that issue.
- monocasa 6y agoThey have their own very special requirements. For instance their equivalent of shaders are able to be changed much more quickly than PC architectures's GPUs generally allow.
- rubatuga 6y agoBut dolphin emulator enthusiasts mitigated that by creating huge shader caches by playing the games for hours, and then saving the shaders.
- srgpqt 6y agoI don’t think they use shader caches anymore? Unless something changed since 2017? https://dolphin-emu.org/blog/2017/07/30/ubershaders/ https://dolphin-emu.org/blog/2017/07/30/ubershaders/
- dang 6y agoIf curious see also Related from 2018 https://news.ycombinator.com/item?id=16150777 https://news.ycombinator.com/item?id=16150777 A bit from a few weeks ago https://news.ycombinator.com/item?id=25522454 https://news.ycombinator.com/item?id=25522454
- chmod775 6y agoThat's an impressively good and interesting writeup. It's even written in a way that non-technical users will understand, even when it does get technical. I'd call this the gold standard of patch/update breakdowns.
- pilif 6y agoDolphin started this tradition years ago and now many emulator projects are doing it
- abdo2023 6y agoThis Is Why You Should Adopt a Cat https://bit.ly/3a8uZVW https://bit.ly/3a8uZVW
- hertzrat 6y agoApparently, a lot of indie developers do well on switch for some reason. Breaking even is so hard for most indies that it sort of made me sympathize with the console model at least a little bit more
- Vanit 6y agoIt was a gold rush at the start due to lack of market saturation (I remember having my new Switch and being able to peruse the entire store in 15 minutes). It's now approaching Steam levels of saturation / shovelware.
- freeone3000 6y agoI'm not sure it's that bad -- every game I've seen on Switch has been, at the very least, a functional game with effort put in. I think it's simply that there are too many games.
- Cthulhu_ 6y agoWhile a lot of games on Steam (I don't know about Switch) are shovelware, at the same time we live in a golden age of (indie) game development, with so many great titles coming out every year - some of which only get discovered years after the initial release (like last year's Among Us).
- pjmlp 6y agoThe golden age were the 8 and 16 bit days, where game genres were yet to be invented and publishers were keen to take anything that came their way, and we were creating stuff that were told the hardware wasn't capable of. Modern games, in whatever form, most of the time are just watching yet another x-men remake.
- hnlmorg 6y ago> The golden age were the 8 and 16 bit days, where game genres were yet to be invented and publishers were keen to take anything that came their way, and we were creating stuff that were told the hardware wasn't capable of. None of that is true though. It's just the rose tinted glasses one wears when looking back at the games one grew up with and loved. > where game genres were yet to be invented Actually by the 16-bit era quite a number of genres were already really well defined. This was even true for the 8-bit era for some genres (like platformers, maze games, etc). > publishers were keen to take anything that came their way That very much depended on the publisher -- just the same as it does now (some publishers will buy any old indie crap and others are more selective). And it wasn't just publishers who were known to reject games, Sega Japan were famously strict about the titles they'd allow to be licensed on the Mega Drive. It was Sega America who allowed any old release to be licensed. > and we were creating stuff that were told the hardware wasn't capable of. That's selection bias. There was a lot of mediocre titles around too. Many of which didn't push the hardware or was less creative about the use of hardware resources. But people tend to remember the more impressive titles, in part because they have aged better, but also literally because they had that "wow" factor. > Modern games, in whatever form, most of the time are just watching yet another x-men remake. The 8-bit and 16-bit era had their fair share of copy cat games. When Mario Bros was a hit everyone seemed to jump on the bandwagon to make a Mario clone. There were hundreds of Pac-Man inspired games (and Pac-Man itself wasn't the first game of that style). Not to mention all the side scrolling shooters, JRPGs that are almost identical from one another, etc. Even popular games like Galaxian was themselves a knock off (eg Space Invaders). And don't get me started on the number of Space Harrier and Outrun clones on the Famicom. Even copy cat games aside, most successful games saw sequals (and even many unsuccessful ones). Alex Kid had 4 games. Wonderboy had 3. There are around a dozen 8/16-bit Sonic games that are 2D platformers (ie not counting Sonic 3D Blast and Sonic Pinball) and Mario has even more titles to it's name. Don't get me wrong, I do love that era of gaming. In fact I'm a massive collector of the original hardware and have ~20 consoles (including some obscure ones) still hooked up in a spare room...all of which still get regularly played. You could say this is a big passion of mine. But with that it does mean I also see my fair share of shelf fillers -- and they do outnumber the classic titles despite what your fond memories of the era tell you. As for what the golden age was, well that's subjective and likely whoever you ask will say it's the era they grew up in. Each new generation of gamers have seen a new paradigm in gaming and that's what they'll remember fondly.
- nanna 6y agoA sidepoint, obviously irrelevant to the technical feats of Yuzu, is that one of the main draws for me about the Switch is that it allows me to leave the computer and desk at which I sit 90% of my waking life, especially these days. That alone is worth using the real hardware and not emulating it.
- JansjoFromIkea 6y agoYep, the separation from the rest of your stuff is probably the main draw of a Switch if I were to get one right now. Similarly to how I rarely use the Oculus Link functionality on my Quest 2, it's just nice to have a device that feels independent of my work station. Was just messing about with CEMU yday and found I could play BOTW in 4K at 60fps on my computer, it looked absolutely beautiful compaired to playing on my Wii U but I can't see myself being able to settle down and play on that machine. I also think having access to so much stuff has made the hassle of tinkering not worth it for most people. Can remember back as a kid with dial up how I would relentlessly fine tune configurations to get some emulated games to a playable state, the slightly bit of lag on an emulation now and I'm like "crap, is this gonna keep happening? can I be bothered enduring this??"
- lapetitejort 6y agoGet a good controller and use the Steam Link app as a cheap and easy way to extend your PC to wherever you have good wifi. I have a Razer Kishi and it delivers a very good switch-like experience.
- tubularhells 6y agoI don't have a smart phone though.
- badsectoracula 6y agoCheck out the GPD Win devices, they are basically handheld x86 PCs running Windows 10 (you can install Linux too). The third one was announced recently (i'm not sure if it is yet available) and is quite good (also has a more Switch-like design while the others are more like tiny laptops) - here is a video of Linus from Linus Tech Tips gushing over it: https://www.youtube.com/watch?v=3LclRTo2YnQ https://www.youtube.com/watch?v=3LclRTo2YnQ One issue they have is that they're expensive (the earlier ones can be found for cheap, note however that the first one might have some battery issues) compared to the Switch, but on the other hand they are not susceptible to planned obsolescence and extreme locked down environments like pretty much all consoles are: you can run any game of the gigantic PC game library there (assuming the specs are met... of course :-P) and new games will be released for pretty much as long as the hardware can function. Here is me using mine with an unfinished version of an MS-DOS game jam game (i had to put my tablet between me and the handheld to record it hence the awful controlling): https://www.youtube.com/watch?v=BF8WqllGKg8 https://www.youtube.com/watch?v=BF8WqllGKg8 (yeah they're also neat demo devices :-P)
- fctorial 6y agoSwitch is a 4 core 2GHz cpu and a gpu. What techniques do they use for realtime emulation of games for this machine? JIT compilation?