6 ms·
What made C# a good choice for this?
by edflsafoiewq 6y ago
What made C# a good choice for this?
- tester756 6y agoSometimes people just pick the languages they're most proficent in so they can move fast maybe that's the case here
- bitexploder 6y agoOr as a “Look, you can do X in language Y, a lot of people assumed this was not possible.” Situation. Seen that a few times.
- DoctorOW 6y agoIn my opinion this is the exact reason C# was picked. Almost everything C# is either Windows-only or Console/Server app. This is neither and that's what's interesting to me.
- moonchild 6y agoMany video games are written in c#. This includes pretty much all games written using unity (the most popular 3d game engine) and fna (a very popular 2d framework).
- danhau 6y agoBut that's an apples/oranges comparison, isn't it? C# code in Unity games is predominantly high-level game behaviour / scripting. Most of the heavy lifting is done by Unity behind the scenes. So to me it's even more impressive that an emulator for a modern games console can be written in a 'managed' language.
- tmitchel2 6y agoThe heavy lifting bit of unity is also written in C#. C# has a rep for being slow which is undeserved these days.
- david-cako 6y agotrue, the first thing I thought was "wow, I didn't realize you could do this with C#"
- bitexploder 6y agoThat’s how more than a few of my projects have started. It really helps you learn the performance mechanics of a language and it’s runtime doing something like, implementing an emulator then optimizing it. Maybe not something as ambitious as a switch emulator though. I like 16 bit processors like the MSP430 :)
- The_rationalist 6y agoC# is the fastest GCed language and emulators are not just about performance, a high level language increase both productivity and the number of contributors, hence the number/depth of optimizations + features and correctness. C# has C++ interop if ever needed.
- kyberias 6y agoC++ interop?
- Const-me 6y agoC++ interop is not supported in modern .NET out of the box, but wasn't too hard to implement as a library: https://github.com/Const-me/ComLightInterop https://github.com/Const-me/ComLightInterop
- pjmlp 6y agoC++/CLI works perfectly fine on Windows, it was a major milestone for .NET Core 3.0. And then there is WinRT/COM as well.
- kyberias 6y agoOk C++/CLI can be considered C++ interop but it's really compiling the C++ code again with some limitations.
- pjmlp 6y agoNope, it is compiling C++ with extra features, not limitiations. Unless you mean pure safe assemblies.
- Const-me 6y agoIndeed, on Windows there’s no need for that library. But on Linux, none of that is available. I have used C++/CLI long ago for a couple of minor things, and I didn’t like it. The two runtimes, C++ and .NET, are interacting in a weird way, I got an impression it combines worst parts from both C# and C++ languages. I prefer IUnknown-based COM interfaces ever since. With some care about API design, C# side of the interop is only marginally more complex that it would be with C++/CLI, but unmanaged side is much easier in regular C++, without the CLI.
- aksss 6y agoI’m a big fan of c# but this question still fascinates me too. Would love to hear some input from the project devs on this.
- GlitchMr 6y agoMostly, because it's easier to program in C# than in C++, and there is not much of a loss of performance (and worth noting that C# has `unsafe` keyword if necessary). In the past Ryujinx did use RyuJIT provided by .NET for JIT, albeit now it's using a custom JIT because RyuJIT was too slow for the way it was used by an emulator.