Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

nibmike

C# for Game Programming

This topic is 5426 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m about to start programming a 3D game but i don''t know which language to choose. i''ve read that C# performs slower than C++, but C# is far easier to code, especially for threading and object oriented work. What would the performance difference be between C++ and C++ for .net? However, the crucial point for the choice is obviously performance. How would you rate the following languages performance-wise when it comes to 3D game prgoramming with DirectX or OpenGL? C# :: C++ .net :: C++ :: Java cheers

Share this post


Link to post
Share on other sites
Advertisement
All are valid choices. C# and Java performance are both nearly on par with C++. Performance isn''t something you should worry about anymore in language choice (at least with the ones you listed). What''s more important is how well you know the language you intend to use, as you will not be able to get optimal performance from any of them if you aren''t intimately familiar with it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:

However, the crucial point for the choice is obviously performance.



Actually, that depends on what type of game you''re out to make. Obviously performance isn''t much of a concern with an RPG, as 30 fps is quite acceptable.

One must also understand that the less time you spend on other things (building a garbage collect, debugging nasty code, setting up D3D), allows for more time to be spent on other things (such as performance).

Share this post


Link to post
Share on other sites
c# isnt nearly on par with c++ but goes at a decent speed to make a 3d game.

and java.....i dont think thats anywhere near the speed of c++
edit:
with c++ you could just make a function based wrapper where you dont really see the nasty amount of code for each thing

[edited by - johnnyBravo on November 11, 2003 1:36:49 AM]

Share this post


Link to post
Share on other sites
quote:
c# isnt nearly on par with c++ but goes at a decent speed to make a 3d game.

and java.....i dont think thats anywhere near the speed of c++
edit:
with c++ you could just make a function based wrapper where you dont really see the nasty amount of code for each thing

dude get ur facts right about your java comments there''s even an article on this site showing benchmarks..

Share this post


Link to post
Share on other sites
If you are already comfortable with unmanaged c++ then I would just use it. Otherwise, C# is a good idea imo. Especially with managed directX, this should greatly speed up developement time.

According to Microsoft, a C# managed DirectX application runs about 10% slower than a c++/unmanaged DirectX one. (Not sure exactly about the % but it was something like that )
So it isn't too much of a big deal, especially since (I assume) you won't be doing a very big/complex game.

I personnally coded with all of those languages, and C++ really strikes me as the best of them. C# is also very nice but I think its more useful for tools. I would totally stay away from C++.net, from my personal experience, theres a lot of new ways of handling things that didnt seem natural or clean. If you want to use .net language definately go with C#. It's design is elegant and clear, very nice language to use.

As for Java, well, I hate it but I never really gave it a real try. For one there is no nice ide to develop Java with as far as I know. If there is, I expect it to be subpar compared to VisualStudio.NET. Also, compiled Java code won't run on pc's that doesn't have the Java Virtual Machine. The same goes for any .NET language, they won't run on pc's that doesn't have the .NET framework, but since .NET is a microsoft technology, you can bet all your .NET apps will run on feature version of windows (and most current ones, some problem with win98).

[edited by - dopeflow on November 11, 2003 2:31:02 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Be sure that, if you decide to go with C#, that you install .NET Framework 1.1 and, if possible, use VS.NET 2003 - 1.1''s bytecode-to-x86 just-in-time compiler is a lot faster than 1.0.

I have used C# for a medium-sized private game project, it''s wonderfully easy to program in but you have to be careful about filling up the heap - garbage collection causes a noticeable pause on my 1.6GHz machine, I had to use the heap profiler to find places in my code that were creating lots of quickly-discarded heap objects.

Share this post


Link to post
Share on other sites
dopeflow: No ide to develop java? You have to be kidding.

www.intellij.com/idea/

This is by far the best IDE for java that i have ever used.

Share this post


Link to post
Share on other sites
quote:
Original post by johnnyBravo
c# isnt nearly on par with c++ but goes at a decent speed to make a 3d game.

and java.....i dont think thats anywhere near the speed of c++



Wrong and wrong. Both Java and C# apps are run via JIT compilers. This means that (at least for Java - and I assume the .NET JIT works the same way) when the app is running, the bytecode is analyzed and parts of the app get converted to native instructions. As a side effect, more information is available for the JIT compiler to use in making optimizations - simply because it can ''see'' how the code is being used at runtime. This means that, in some circumsatnces, Java performance can actually be *faster* than C++ thereby giving the whole app a performance boost.

I''m starting to sound like a broken record on these forums, but Java is *not* slow anymore. On average, a programmer who knows the language well will be able to see performance around 5% slower than an equivalent C++ program. That''s important - knowing tha language. If you don''t know a language thoroughly, you can''t hope to get the most optimal performance out of it. This applies to C++ just as much as it does to Java and C#.

Anyway, I''m tired of hearing the ''java is slow'' mantra. And now the ''C# is slow'' mantra. People either take what they hear as gospel or spout off about experiences they had 6 years ago when Java *was* slow. Times have changed. Get with it. Check out java.com for a listing of some current Java games. And don''t be surprised when you see a few C# game titles on the shelves in the near future.

Share this post


Link to post
Share on other sites
quote:
Original post by dopeflow

As for Java, well, I hate it but I never really gave it a real try. For one there is no nice ide to develop Java with as far as I know. If there is, I expect it to be subpar compared to VisualStudio.NET. Also, compiled Java code won''t run on pc''s that doesn''t have the Java Virtual Machine. The same goes for any .NET language, they won''t run on pc''s that doesn''t have the .NET framework, but since .NET is a microsoft technology, you can bet all your .NET apps will run on feature version of windows (and most current ones, some problem with win98).


Heh, sorry but I have to respond to this one, too.

First of all, there are countless IDEs available for Java, some of which greatly exceed the capabilities of VS.NET. Eclipse is considered by many to be the best of the best. Started by IBM, it is Open Source, multi-platform, and feature rich. There is a plugin that allows it to be used with C/C++ compilers (still in development). Once you use an IDE like this you will never want to go back to VS.NET. Take a look at it. There''s also JBuilder, NetBeans, SunONE Studio (based off of NetBeans source), just to name a few. Even so, availability of IDEs seems an odd thing to base a choice of language (or even compiler) on .

Next, regarding the JRE, that can certainly be an issue when distributing an app on the net. However, Sun has recently made deals with several OEMs (such as Dell) to have the JRE installed on all new PCs they sell. For boxed titles, it''s a non issue as it''s a simple matter of putting the JRE installation on the CD.

Conceptually asking the user to download and install the latest version of the JRE is no different than it is asking them to download and install the latest DX runtime. It''s probably not the case realistically, though. In the near future, it will no longer be an issue. There''s a lot going on that will improve the situation.

When someone wants to choose a language to develop games with, the big picture needs to be considered. What platforms are targetted? Where does the dev''s experience lie? In which language is the dev more productive? What sort of third party tools will be used? What is the purpose of the project? What is the method of distribution? For most hobbyists, it will come down to preference. For anyone looking to make money, there are too many factors to list - performance of the language (when talking about C/C++/C#/Java), however, is not one of them.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!