why was C# adopted for game dev ? compared to java given that they're both similar langauges which use a vm.
I do understand that C# has a better native interop story. than java.
and probably the only notable jvm based game was minecraft
why was C# adopted for game dev ? compared to java given that they're both similar langauges which use a vm.
I do understand that C# has a better native interop story. than java.
and probably the only notable jvm based game was minecraft
Modern C# also has more features that help avoid allocations, which in turns reduce GC pauses, which are the biggest enemy of a game
Unity used Xamarin to target iOS and Android, so this meant using C#. As Unity's popularity grew, so did the use of C# in gamedev.
XNA was a very well-designed game framework (not engine) that allowed many people to get into indie gamedev without learning C/C++ and SDL or OpenGL. Java had nothing comparable, libGDX was released only in 2014. If you followed one of the indie stars and tried to emulate them, you were quite likely to learn XNA or one of its reimplementations.
They hired the guy who created Boo (a python like programming language) and switched to Mono (I'm not sure why they picked it instead of JVM I guess it was possible related to licensing but because they just had people who were experienced with it).
Also C# wasn't even their primarily programming language until 2012-2014. It was UnityScript (JS like syntax running on Mono). The idea was that C#/static typing was too scary/complex for most of their uses.
However CLR has support for AOT and C++ since day one (even if NGEN isn't that great and only covers specific cases.
C# has thus access to the CLR features needed for C++, while exposing them in a more developer friendly way, and since C# 7 many of those features that required direct MSIL manipulation are being exposed as language features, making it even more easier to use.
The JVM isn't/wasn't the greatest to embed and it's kind of a lumbering beast even today.
Also you aren't embedding C#, but dotnet, with which you open yourself up to an entire ecosystem of languages (if you really want to write plugins in VB.NET or F# or IronPython), and a ecosystem of libraries and even Microsoft tooling that's way more polished than Oracle/Sun ever put out.
Unity uses C# for historical reasons - when Unity started, Mono was one of the few options that fit their needs. Outside Unity, C# mindshare isn't that big I think.
Java has been used a fair bit for Android games for obvious reasons, but game programmers are rarely Java fans.