Sign in to follow this  
LizardGamer

Java vs C# (Mono)


Recommended Posts

SimonForsman    7642
[quote name='LizardGamer' timestamp='1311476713' post='4839454']
What would you find the best for Cross-platform game dev?

In what ways would you find one of these good?

What is your opinion on these 2 languages?
[/quote]

It really doesn't matter all that much, the main advantage C# has for game development is XNA which isn't available if you go cross platform, The quality of the crossplatform libraries and engines are pretty much the same for both languages, both runtimes (Mono and Java) have good performance these days, Personally i think Microsoft will do a better job with the actual language than Oracle will.

Share this post


Link to post
Share on other sites
LizardGamer    98
Hidden
[quote name='SimonForsman' timestamp='1311478032' post='4839463']

It really doesn't matter all that much, the main advantage C# has for game development is XNA which isn't available if you go cross platform, The quality of the crossplatform libraries and engines are pretty much the same for both languages, both runtimes (Mono and Java) have good performance these days, Personally i think Microsoft will do a better job with the actual language than Oracle will.
[/quote]

C# Mono isn't made by Microsoft

Share this post


Link to post
boogyman19946    1487
I've never really used C# and I don't know it's capabilities are, but much like Simon said, Microsoft will probably do a far better job with their product than Oracle (it seems they already are). In terms of cross-platform, I can't seem to find any evidence that Java works on the consoles, but Wikipedia suggests that C# is seeing support on the 360, PS3, and the Wii, so it definitely gets an edge.

Share this post


Link to post
Share on other sites
LizardGamer    98
[quote name='ApochPiQ' timestamp='1311488447' post='4839498']
"Cross platform" is way too vague. [i]Which[/i] platforms are you trying to target?
[/quote]

Mainly Linux, Windows, Mac, Android

Share this post


Link to post
Share on other sites
LizardGamer    98
I know that Java is faster than C# (when using the VM), but Java uses more memory, and I see Java has alot more game related tools like Jmonkey, Lwjgl, jogl, ode4j, jbullet and I haven't seen too many for C# (and please don't say Xna because it only works on Windows and Xbox 360)

And that some people say C# is much easier than Java.



But I find it difficult to choose between these languages

Share this post


Link to post
Share on other sites
kunos    2254
how do you know that java is faster than c#?

To answer your question, c# / mono / opentk will take you to windows, mac, linux, android, iphone and who knows what else.
You also have to think about Visual Studio as part of c#.. the productivity boost you get just by using it is, alone, a reason to prefer c#.

But as usual, when it comes of these threads my answer is.. you cannot choose and don't have the necessary background to make a decision... throw a coin then stick with it. Both languages are perfectly capable of delivering... the bottleneck is the programmer, not the technology [img]http://public.gamedev.net/public/style_emoticons/default/biggrin.gif[/img]

Share this post


Link to post
Share on other sites
Fetze    720
I don't think there is really a significant performance difference between Java and C#. I'd pick C#, but that's just a personal decision. my impression is that C# is more advanced than Java in matters of actual language features. LINQ is pretty neat, to name one. There's a lot of nice syntactic sugar. Besides that, here is a [url="http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java"]comparison between Java and C#[/url].

Share this post


Link to post
Share on other sites
LizardGamer    98
[quote name='kunos' timestamp='1311499095' post='4839529']
how do you know that java is faster than c#?
[/quote]

This will answer your question:

[url="http://shootout.alioth.debian.org/u32/csharp.php"]Language Benchmark[/url]

Share this post


Link to post
Share on other sites
kunos    2254
[quote name='LizardGamer' timestamp='1311504065' post='4839544']
[quote name='kunos' timestamp='1311499095' post='4839529']
how do you know that java is faster than c#?
[/quote]

This will answer your question:

[url="http://shootout.alioth.debian.org/u32/csharp.php"]Language Benchmark[/url]
[/quote]



so basically you don't know. you just decided to trust these people.
that does answer my question [img]http://public.gamedev.net/public/style_emoticons/default/biggrin.gif[/img]

Share this post


Link to post
Share on other sites
MatthewJackson    104
[quote name='LizardGamer' timestamp='1311488914' post='4839500']
[quote name='ApochPiQ' timestamp='1311488447' post='4839498']
"Cross platform" is way too vague. [i]Which[/i] platforms are you trying to target?
[/quote]

Mainly Linux, Windows, Mac, Android
[/quote]

As I understand it, all of these platforms commonly have Java compatibility, but, with the exception of Windows, will require that additional components be installed (namely Mono) in order to run emulated .NET bytecode (I know that it's not actually emulation).

I researched something similar, but for Windows and OSX only as well as having a few other parameters, and came up with C# being incapable of transparent to the user cross-platform compatibility. In my opinion, that makes C# only appropriate in special circumstances.

Share this post


Link to post
Share on other sites
SimonForsman    7642
[quote name='M.Jackson' timestamp='1311523370' post='4839633']
[quote name='LizardGamer' timestamp='1311488914' post='4839500']
[quote name='ApochPiQ' timestamp='1311488447' post='4839498']
"Cross platform" is way too vague. [i]Which[/i] platforms are you trying to target?
[/quote]

Mainly Linux, Windows, Mac, Android
[/quote]

As I understand it, all of these platforms commonly have Java compatibility, but, with the exception of Windows, will require that additional components be installed (namely Mono) in order to run emulated .NET bytecode (I know that it's not actually emulation).
[/quote]

its very far from emulation, Mono is a free implementation of the CLI , it works in pretty much the same way as Microsofts own implementation in .Net or Oracles JVM and it is theoretically possible(allthough given the difference in developer resources its unlikely) for Mono to become faster than Microsofts .Net.

Share this post


Link to post
Share on other sites
mhagain    13430
Performance of Java vs C# doesn't come from the language, it comes from the VM. And don't forget that in a game a huge chunk of performance is going to come from your graphics hardware, and that has nothing to do with the language being used.

Share this post


Link to post
Share on other sites
LizardGamer    98
[quote name='mhagain' timestamp='1311580432' post='4839892']
Performance of Java vs C# doesn't come from the language, it comes from the VM.
[/quote]

I understand the VM has to do with the performance and all that, and I found out that Java's VM is having a massive update to the end of this year and next year (with Java 7 and 8)

[quote name='mhagain' timestamp='1311580432' post='4839892']
And don't forget that in a game a huge chunk of performance is going to come from your graphics hardware, and that has nothing to do with the language being used.
[/quote]

It depends on how well the binding is to the graphics API e.g. OpenGL or DirectX
With Java there is Jogl and Lwjgl (OpenGL)
With C# there is OpenTK (OpenGL)

(I don't care about DirectX :D)

Share this post


Link to post
Share on other sites
mhagain    13430
[quote name='LizardGamer' timestamp='1311581963' post='4839899']It depends on how well the binding is to the graphics API e.g. OpenGL or DirectX[/quote]

Yes and no. Ultimately the graphics API isn't doing the actual drawing, the hardware is. All the graphics API does is tell the hardware to draw, so all other things being equal language is of minimal relevance for this consideration. So the binding is important only in so far as it doesn't generate unnecessary overhead, but it's importance ends there.

Share this post


Link to post
Share on other sites
way2lazy2care    790
I would take C# because for the majority of situations. The performance increase in either direction would be small, but the productivity increase I feel would favor C# quite a bit.

Share this post


Link to post
Share on other sites
arbitus    440
[quote name='LizardGamer' timestamp='1311488914' post='4839500']
Mainly Linux, Windows, Mac, Android
[/quote]

One of these things is not like the other things (pretend rest of the song is here)

Cross platform development introduces (often times unnecessary) extra overhead and development considerations. For instance, even in Java, you have platform specific libraries to consider, you have platform implementations to consider (are the VM performances equal across all platforms), and you may even have platform difficulties to consider (does the target even support all of the library functionality).

Then you have to consider the platforms themselves. Obviously an Android app is going to have more hardware level restrictions than a desktop platform, so do you restrict yourself to only the lowest common denominator when writing your code? Do you have different implementations for each, which enhanced features on desktop platforms?

Also, you have differences in toolsets. You can write all of your Java code using the same editors, but will your build chain be the same across all platforms? Maybe you need to use a different profiler on a different platform? For sure you need an Android emulator for testing Android apps.

Different tools (and programming languages are just part of your suite of tools) work differently in different circumstances. Some are better at some things than others, some have better platform support than others, some focus on solving certain problems whereas some are general purpose, some have better library support, etc. etc. etc. Usually when people start talking about "cross platform development" (especially those who are new to programming or come from a homogenous background) they are really asking "what tool can I use to do everything?" And the only real answer is "all of them." Just like when you build a house, you use all your tools, when you want to do everything in computer software, you need to understand and use different tools for different tasks.

But you don't want to do everything. You want to do something. What is it that you want to do? You mentioned Android, so perhaps you want to build an Android app. If you want to build an Android app, why are you concerned about Windows, Linux, and Mac? These are unrelated desktop platforms, and what is best for building Android apps may not be best for building desktop applications on these platforms. The "app" model of development is generally not mainstream on desktop platforms in the same way as phones and tablets, so even if your "app" is cross platform, does it make a difference if it will only be adopted by mobile users? If not, then you have expended time and energy trying to pick a tool that was ill suited for your actual needs.

So my suggestion is that you think through a few basic questions: What do you want to make (app, desktop thick client, browser based, etc.)? What form does this software usually take (there are big differences in requirements among full desktop games, web/browser based games, and mobile games)? What are the platforms that typically support this type of software (people who primarily play AAA desktop games do so on a Windows machine, casual and browser based games are often platform agnostic using technologies like Flash, mobile apps are generally created using the specific tools for that mobile platform)? What are the tools that are typically used in the creation of this type of software (Android emulators for Android platforms, Java and associated Android libraries as the default development platform for Android vs. C# and XNA for XBOX\WinPhone 7 compatibility)?

Share this post


Link to post
Share on other sites
Serapth    6671
[quote name='LizardGamer' timestamp='1311488914' post='4839500']
[quote name='ApochPiQ' timestamp='1311488447' post='4839498']
"Cross platform" is way too vague. [i]Which[/i] platforms are you trying to target?
[/quote]

Mainly Linux, Windows, Mac, Android
[/quote]


With this list of platforms, with wanting to make a cross platform game, is about the only time in the world I would actually recommend C++.


Plus, Android implements a subset of what is supported on those other platforms. I did some development last year on Android and quite frankly, it was not a pleasant experience, especially if you wan to support the plethora of devices and versions. My most frustrating experience was writing code that worked on 1.6, 2.0, 2.2 and 3.0 devices, but wouldn't run on 2.1! Oh, and the joys of Google support, which is frankly non-existant. In addition to the complete crap marketplace, the offloading of customer support onto the developer and the various undocumented "gotchas" which are far to common, it was a brutal experience. Despite all their billions of dollars, so often dealing with Google feels like amateur hour.

Another thing to keep in mind, the UI development process on Android is completely and utterly different than every other platform you just listed.As is the user experience.

Share this post


Link to post
Share on other sites
Dragonion    131
"[i]Although C# applications are intended to be economical with regard to memory and processing power requirements, the language was not intended to compete directly on performance and size with C or assembly language[/i]"

~ One of the ECMA design goals for C# ~

"[i]Like C, Java's goals were really around being able to build relatively specific kinds of software, and we were really going for very distributed, very reliable, interacting-with-people kinds of software -- ones where things like reliability mattered a huge amount, things like security mattered a huge amount, and they all mattered enough that there was a willingness to take a performance hit for them[/i]"

~ James Gosling, inventor of the Java programming language ~


... and this pretty much sums up why you shouldn't use either for game development =)

Share this post


Link to post
Share on other sites
arbitus    440
[quote name='Dragonion' timestamp='1311626760' post='4840187']

... and this pretty much sums up why you shouldn't use either for game development =)
[/quote]

Given that there are successful games already released using both languages, why do you believe this is an accurate statement?

Share this post


Link to post
Share on other sites
kunos    2254
[quote name='Dragonion' timestamp='1311626760' post='4840187']
... and this pretty much sums up why you shouldn't use either for game development =)
[/quote]


and this pretty much sums up your deep ignorance in this matter.



Share this post


Link to post
Share on other sites
arbitus    440
[quote name='LizardGamer' timestamp='1311666826' post='4840405']

Ah?
[/quote]

He is perpetuating a dangerous (for the "For Beginners" forum) myth that game development should only be done using C, C++, and assembly. It has no basis in fact, and you can feel free to ignore it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this