Sign in to follow this  

When does the choice of a language become a problem?

This topic is 4203 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

Hello, I'm currently in the process of learning how to work with Managed DirectX with C#. I really like the language and think I'll start developing with it. However, whether you might want to call it a myth, you will bump into people saying that since C#/Java and the likes have a slower performance speed than their rivals (C++)... I can understand why people would say such thing and I've read articles on it but when it comes to game development when does it (if it in fact does) become a problem? Should I consider different languages if I was to build a game the size of World of Warcraft or Oblivion? I'm not worried about my choice I'm mostly curious seeing how I don't know much about what performance speed could actually affect.

Share this post


Link to post
Share on other sites
Its not so much the speed of the language that would make the language choice become a problem. C# can run, theoretically, just as fast as c++, or at least the performance loss is not that great.

When you really need to consider the choice of a language is when looking for 3rd party libraries.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
There is no doubt that a great C++/ASM developer can write a faster 3D engine than a great C#/.NET developer. Would it be substantailly faster than C#? Probably not. Recently I rewrote the scene graph portion of my 3D engine in C#. I ported the renderer to managed C++ (using unmanaged DirectX not MDX), and for maximum performance on the C# side I used unsafe and fixed blocks, and pointers for buffer management and writing into geometry data. I had three C# developers code review the system and after we all figured it was as fast as it could possibly be it ran 10% to 20% slower depending on the particular subsystem than the C++ engine. If you examined the performance of the skinning system alone the C++ engine was 2.5X faster; but you have to realize my skinning system is faster than the average consumer GPU using a SSE2 code path.

My C++ engine contains oodles of crazy unsafe stuff including assembly blocks that would freak the average programmer out. It's also more difficult to maintain than a good C# engine would be because of all the bookkeeping with interfaces, smart pointers, factories, etc. There's also a lot of available stuff in C++ that you can plug right into an existing code base that you can't get with C# (like WildMagic for example).

I also hate the fact that C# doesn't have const correctness. Having used that for years, it's embedded into my brain, and I'm not comfortable without it.

I guess my advice to you is if you're not the best C++ programmer you know and you don't need any sort of portability, you should use C# to write your game. You'll get the game done sooner, you'll cry less, and you'll never know if it was slower than a C++ engine you could have written. If there's a particular block of code in your C# engine that's pretty slow, you could always call C/C++/ASM from C#.

I would love to have a full port of my engine to C#. I just don't have time to do it.

Share this post


Link to post
Share on other sites
You're nowhere near the point where you can write a game of that size. By the time you reach it, you should have learned several languages, should know which to use when, and be able to use them all together if necessary.

Don't worry about the language you're using now.

Share this post


Link to post
Share on other sites
Thanks guys,

@Fruny: I'm not asking which language to use because I will use c#, I was just curious that's all <edit>(I also know I'm no where near making a huge game, I was just wondering if the choice of language mattered to THEM </edit>. I just finished my 3rd year of Software Engineering and often you'll hear a group of people discussing which is faster and bla bla bla... but I just wanted to know if (and I mean IF) it became a problem at a definite point in the development. I'm thinking gameplay wise, could it slow down the program enough (because of performance issues) etc...

Again thanks guy, it's interesting to see what you all had to share and I'm glad calls to another language could always be done (which is something I hadn't thought about)...

Share this post


Link to post
Share on other sites
Quote:
Original post by sanch3x
Again thanks guy, it's interesting to see what you all had to share and I'm glad calls to another language could always be done (which is something I hadn't thought about)...


Well, for example, the program I'm working on right now. The high-level code is in Python, with some C++ added in places. It builds on a GUI library written in C, a math toolkit library written in a mix of Python, C and Fortran, and makes calls to a domain-specific module written entirely in Fortran.

Share this post


Link to post
Share on other sites

This topic is 4203 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.

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