Advertisement

why are people using c# over java

Started by June 01, 2017 11:39 AM
9 comments, last by TheChubu 7 years, 6 months ago

Hi guys,

So as the title asks, why are people using c# over java ?

The last dozen posts are about c#, none on java. I was recommended to try gamedev.net in regards to learning java and participating in such a community but this seems more c# c++ side than java.

1. Unity uses C#, so there are a lot of game developers that use it. There is no equivalent for Java.

2. C# has a gamedev pedigree dating back 10 years, to XNA and Monogame. The Java game development community did not have any library as widely accepted as those.

3. C# has a popular open source implementation (Mono) so people don't feel locked in to a specific runtime. Java also has alternative implementations available but Oracle have been known to take action against companies that implement their standard library so this tends to have a chilling effect.

Advertisement

I don't have any data, but I assume that C# is much more popular in games? Unity uses it as the main scripting language, as do a few other engines. Not that many major game engines use Java as their main gameplay language, and it's quite hard to embed it as a "scripting language" like Unity has done. java is a perfectly capable language for gamedev though - there's plenty of people here who use LWJGL, libgdx, jmonkey, etc...

I learned C++, then Java, and then C#. I still use C++ and C# regularly. My personal feeling at the time was that initially C# and Java were extremely similar (after all, C# only came into existance after Microsoft's proprietary version of Java - J++ - got shut down via lawsuits, and then magically hey, C# exists now and is in no way related...) but that C# fixed a lot of Java's terminal design issues and was basically "Java done right" :lol:

The initial versions of Java came into being at the height of the 90's OOP-done-by-people-who-don't-understand-OOP craze, and were quite terrible... I actually haven't gone back and learned modern Java since that time, so I can only assume/hope that it has kept up with the pace of development that C# has had.

The above points aside, if you have Java questions or want to talk about Java I'd go ahead and ask here. Despite the apparent bias (which I suspect you'll find in any game development community unless it's specifically focused on Java) there are still at least a number of people here who actively work with Java, and many more who have worked with it previously or are otherwise familiar enough to participate in discussions.

- Jason Astle-Adams

I dont mind biased opinions, I just like seeing the reasons people chose this or that.

Thanks for the responses, it kind of make sense regarding unity that uses c# causing a wider popularity for it.

I mainly want to learn java to create a server for my game project which is written in gml, from what people have told me it's a bad idea to create a gml server for a massively multiplayer game which is what I'm aiming for. If I really want to make this game on my mind, I have to be realistic, so Java seems like the way to go.

I think I'll stick around on gamedev.net, because there's a lot ofinteresting stuff going on, but I'll be using stack exchange concurrently so that I can solve problems sooner. And also the more responses the more sense something will make.

Thanks again

I think it really is a case of the platform chooses the language. Depending what engine you choose, the language choice is made for you. I haven't come across anyone who puts the language choice before the engine choice.

Advertisement

I just like seeing the reasons people chose this or that.
For beginners, the actual language isn't that relevant. C# being a native at a Windows machine, together with Windows being the dominant platform, and existence of Unity, makes it a logical choice. Java is just a little further away, and thus used less.

... create a gml server for a massively multiplayer game which is what I'm aiming for
Massive multi-player game is a bad idea in general for a beginner. Multi-player game is already very hard, networking is complicated, "massive" adds good scaling to that equation, which is a few order of magnitudes more difficult. I would suggest you start with some much much simpler.

... but I'll be using stack exchange concurrently so that I can solve problems sooner.
The sites are quite complementary. At stack exchange you have the short simple factual-ish very concrete questions, while here discussions are more general, where the answer isn't always clear.

While people have covered the social side of things, I'm going to jump in and claim that C# is overall a better technical choice of language than Java. Yes, I went there. Java was designed first and foremost as safety scissors, a tool for people who couldn't be trusted not to hurt themselves. And honestly, that's true for most developers, particularly in the web and client/business app space. There was absolutely no desire to expose any "system level" functionality. It was meant to be a simple, sandboxy, safe environment to do most of the boring every day software development that makes the world tick.

While C# partly shares this worldview as well, both the language and the underlying runtime were designed with the option to step outside that box, as long as you do it explicitly. (Notably, VB.NET was not designed this way.) There's a lot more capability in C# to manipulate memory, integrate with native libraries, control allocation, and do a lot of the direct manipulation of buffers that is inappropriate for most types of apps but is crucial for graphics code in particular and to some extent game code in general.

It's the relative ease of doing many common game and graphics programming tasks that has made C# preferable here and in the industry in general. It's not that you can't do things in Java, but it always feels like you're fighting the language, working through kludges like FloatBuffer to get things done.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

Going on, there is also the nature of the task.

C++ is the currently chosen language for systems-level work in big games. It used to be different languages. C++ currently offers the most options for tight control of the hardware in systems where you need it.

Java is the currently chosen language for server-side work and big data backends. The business world adopted it fully in the late 1990s and it is by far the most popular language for tools and technology on servers. It is also the native language of Android, although many game developers bind the calls to C++ and do their heavy lifting outside of Java.

C# is a powerful language that is a good fit for a lot of things game do. It works extremely well for gameplay scripting, and as mentioned, Unity uses it on the gameplay side. It has a wide range of libraries and is easy to interoperate with other languages. The .net framework makes it almost trivial to put together simple tools and data processors.

If the site were focused on a more business-oriented field, or if the site were more about backend programming for games, then Java would likely be the most discussed language. Instead when talking about systems-level work people generally assume C++, and when discussing gameplay and tools work the discussions tend to ask if the language is C++ or C#. The networking forum of the site tends to be language agnostic, but there are many topics that specifically use Java.

I'm going to jump in and claim that C# is overall a better technical choice of language than Java. Yes, I went there.

Shots fired! :wink:

Frankly I agree with all that. C# has value-types, unsafe regions for pointer access and pInvoke which are all super useful for low-level work and much more flexible than java's FloatBuffer.

Having said that, "maybe" some of this could change with Java10 (Project Valhalla) introducing value types and generic specialisations that are hopefully optimised to the level of FloatBuffer. Java's also gaining ahead-of-time compilation which could mean more in-java heavy lifting for cases where people might at present have moved that code out to C++.

Just to stand up for present-day Java a bit: I am actually a huge fan of LigGDX as a gamedev framework. Java8 is significantly better than previous versions of Java. In fact it is just about reaching the point now where there are little nuggets of the language that I do miss when coding in C# (e.g. the diamond operator, functional interfaces are possibly a nicer idea than C# delegates, default interface methods, class-like enums, maybe a few other things).

This topic is closed to new replies.

Advertisement