News for hackers. Stuff that matters.
Re:Ask HN: What are the performance gains using native C++ i... by UnoriginalGuy on Wednesday February 20, 2013 @05:09AM (#5249679)
Depends on the programmer.

Both C# and C++ can be used to make a video game, they can be used to make a 3D video game. Heck you could almost certainly write a well selling commercial game in C#. I mean Minecraft was written in Java and look how well that has done...

The reason people like C++ is because you can optimise it down to near its optimal speed at key choke points in the code. It is kind of like the 95% rule, 95% of the time C++ and C# will run at similar speeds, but it is that 5% where C++'s versatility really matters.

Re:Ask HN: What are the performance gains using native C++ i... by z3phyr on Wednesday February 20, 2013 @05:22AM (#5249717)
But minecraft dosen't look photorealastic; I mean, the engines like luminous, unreal engine 4, id tech 5.

Can C# or Java be optimised to run these kinds of codebases with near similar efficiency?

Re:Ask HN: What are the performance gains using native C++ i... by UnoriginalGuy on Wednesday February 20, 2013 @06:03AM (#5249809)
The thing about these large industrial game engines is that they're build from very efficient libraries already written in C/C++. So the optimisation has already happened.

You could write a "game" in C# that uses the native broker to call into the C/C++ libraries and generate something remotely similar to what a modern game engine does, but there will always be overhead in doing so.

Efficiency isn't really an interesting discussion topic in this area to be honest. What is interesting is the fact that almost all of the code already written for games is in C/C++.

You want to use a library? It will be C/C++. You want full access to DirectX? C/C++. You want access to all of the OS's underlying APIs/data-structures? C/C++.

Even if C# was entirely as efficient as C/C++ (and as I said 95% of the time it really is) - it doesn't actually matter, because for the last twenty years programmers have been pumping out game libraries for C/C++, not for C#.

C# and many other languages have a chicken/egg problem: Nobody wants to write game code for the language because nobody is writing game code for the language.

Re:Ask HN: What are the performance gains using native C++ i... by z3phyr on Wednesday February 20, 2013 @06:35AM (#5249882)
Is there any possibility of the video game industry market shifting toward C# in forseeable future?

I emailed Aras, lead graphics programmer at Unity technology. He replied that C++ in video game industry, esp in game engines is indispensible, and it will remain the standard in long forseeable future.

I also sent an email to Mike Abrash at valve, and he replied that there is no movement away from C++.

Re:Ask HN: What are the performance gains using native C++ i... by UnoriginalGuy on Wednesday February 20, 2013 @06:44AM (#5249905)
> Is there any possibility of the video game industry market shifting toward C# in forseeable future?

No chance at all.

It offers nothing that C/C++ doesn't already. It has no game libraries written for it at all. It is largely unsupported on non-Windows platforms (e.g. Android, Linux, Mac, etc).

Best case scenario: The XBox 720 allows "apps" to be written in C# and sold to end-users. So C# becomes the de-facto indie game language of the XBox 720 (as in mini-games, not full AAA titles).

Re:Ask HN: What are the performance gains using native C++ i... by dekken_ on Wednesday February 20, 2013 @05:35AM (#5249748)
C#/Java are more forgiving than C++. For a visually demanding game you're going to need all the performance you can get, and unless you're coming from a background of managing memory yourself, that's unlikely to happen with a managed langauge. Just learn C++/CUDA and you'll be grand ;)