Sign in to follow this  
johnnyBravo

How much faster is c# at making games than c++?

Recommended Posts

Hi I was wondering how much faster c# is at making games than using c++?, as in time to make. Because I usually use c++ to make my little 'pet' games, but I was thinking of playing with something new, and possible faster to code with. So if c# is faster at development, it would give me a reason to use it :)

Share this post


Link to post
Share on other sites
That really has more to do with your proficiency with the language than the language itself. If you are twice as good at programming in C++ then you are in C#, then I don't think it will be any faster. However, if you are just as good at doing C#, there are certain benefits to the language that may help you get up and running in a smaller time frame.

If you're looking for faster code however, stick to C++. It might take you a little longer to develop, but the code itself will most definitely be faster to run.

Share this post


Link to post
Share on other sites
Yes it's true that to be 'fast' with any language you need to master it first. However, C# is not a bad language to have learned to be prepared for what's coming. So it's a good investment anyway.

Share this post


Link to post
Share on other sites
Quote:
Original post by Morpheus011
If you're looking for faster code however, stick to C++. It might take you a little longer to develop, but the code itself will most definitely be faster to run.


This has been debated over and over and still hasn't been proven.

At any rate, as you said, the best language is the one you are most comfortable with.

Share this post


Link to post
Share on other sites
I say stick with C++ and if you need to rapidly develop anything, pick a game engine that may be used with C++ for graphics, audio, or whatever you need.

:)

Share this post


Link to post
Share on other sites
Short answer:
2D games: the same
3D games: the same
Unreal 3, Quake 4, Xbox 360 or PS3 games: C++ (notice you don't have the skill, expertise, or even know-how to even approach a game on such a scale, ergo, don't bother trying to make one)


Sorry misread question.

Share this post


Link to post
Share on other sites
Depends at what state you are in both languages. In my opinion, C# will be fastest if you are realivly new/inexperienced in both. With C# all of the 'core' stuff is done for you, works out of the box etc. However, with C++ while yes, you get the standrad library many people don't know about it or use, and then there's boost etc. I'd also say because C# handles a lot of the low level stuff, and is more syntacilly restrictive that C# is faster than C++ in terms of development. One of the only reasons the big teams are sticking to C++ is because they have massive reusable code bases.

Share this post


Link to post
Share on other sites
Are there any clear cut benefits to switching if you already use C++? I don't think so because everything you can do in C# can and probably has been done in C++. It's like replacing your car when the one you have works perfectly fine, it's actually pretty wasteful.

From the start though? I don't know, I'm entrenched in C++...

Share this post


Link to post
Share on other sites
If you're developing applications, C# has a big advantage of C++ in terms of rapidness in development (just drag-n'-drop the controls and add event handlers: no messy WinProc and subclassing stuff) however, in terms of game development... there's no real advantage... other that .net handling the garbage collection and other nitty-gritties (like strings and arrays) for you, which could be solvable by STL or your own home-brewed library.

it's not too bad to learn C# to, it may help you in creating level editors and stuff.

Share this post


Link to post
Share on other sites
C# has a far larger library than C++, and the language has some other features that are very useful, but unless you need to switch, you probably shouldn't.

Although, I switched from C++/OpenGL to C#/MDX, and i'm glad I did.

Share this post


Link to post
Share on other sites
for an good experienced developer the only benifit WRT developement time is C# doesnt need to be compiled this is offset somewhat by it having a slower startup time

Share this post


Link to post
Share on other sites
Quote:
Original post by zedzeek
for an good experienced developer the only benifit WRT developement time is C# doesnt need to be compiled this is offset somewhat by it having a slower startup time


C# does need to be compiled...

Share this post


Link to post
Share on other sites
does it? sorry my mistake i misremembered a reply by someone else from a post i made
http://www.gamedev.net/community/forums/topic.asp?topic_id=317431
Quote:
- Near instant compile time (and on-the-fly background compilation). No more waiting for a build to finish!

scrub my point then, then theres no development time advantage in a game for an experienced programmeur to use java/c#

Share this post


Link to post
Share on other sites
I'm curious: of those who are claiming C# has no advantages in terms of dev time for experienced programmers, how many of you are actually truly experienced programmers? [smile]


C# is a far better choice. You have good access to low-level hardware capabilities via Managed DirectX, which is a very sweet library. Garbage collection is infinitely superior to manual memory management for all but a very few niche development situations; I know many experienced programmers (myself included) who are still prone to get manual memory management wrong. C# has a horde of high-level constructs like delegates that can produce much more concise, expressive code over C++. C# also has superior GUI implementation capabilities, even over the best C++ GUI tools (C++ Builder and VC++/MFC come to mind).

In addition to being a more expressive (and clean) language, C# has a far more robust library, which has the advantage of being entirely developed at once rather than being cobbled together over time (ala C++SL/STL/Boost). This means it is generally easier to achieve interoperability between different elements of the library and your own code.

C# also has the amazing advantage of not being tied to a hideously broken compilation model; things like side-by-side assemblies can make code reuse far more efficient over time. You also escape the temptation to do a lot of disgusting macro hackery, which, sad to say, even good experienced C++ programmers are prone to do every now and then.

.Net has other powerful abilities, like easy cross-language development. Write high-level code in IronPython or F# or whatever, and low-level stuff in C# or even C++/CLI. Use other .Net languages for runtime scripting. Do automatic plugin discovery with reflection. It's an incredibly potent platform, and C++ will never catch up.


As if all that weren't enough, C# is built on the .Net runtime, which has one huge powerful advantage: JIT compilation. Instead of having to build one binary and hoping it performs well on a huge array of processors and system builds, you can ship CLR code which is then JIT compiled and can actually become faster over time. Each person's individual system gets a machine binary that is as efficient as possible for their hardware configuration. As hardware continues to diverge, and as JIT technology continues to improve, the days of C++ being the king of performance will disappear very quickly.

In any case, it's a good idea to get away from C++ sooner rather than later. As multiprocessing continues to become more commonplace, and with increasing core-count processors on the horizon, C++ will quickly become obsolete. C++ has absolute crap support for synchronization and multiprocessing, and while efforts like OpenMP are trying hard to counteract that, it is inevitable that a better language will take over. That language probably won't be C# per se, but it's still a good idea to have more languages under your belt than C++. Being a one-trick-pony is not a good situation in the technology sector [smile]



So there you go. Use C#, or IronPython, or F#, or whatever you want. C++ is not the best choice. In fact, there's a good chance it isn't even a good choice.

Share this post


Link to post
Share on other sites
As for this comment: "As multiprocessing continues to become more commonplace, and with increasing core-count processors on the horizon, C++ will quickly become obsolete."

It's a good thing that the architect for C# is also the chairman of the C++ comittee. Here's the future of both C++ and .Net in terms of concurrency:
http://microsoft.sitestream.com/PDC05/TLN/TLN309_files/Default.htm#nopreload=1&autostart=1

Share this post


Link to post
Share on other sites
Quote:
Original post by RDragon1
Also, if you're a game programmer, particularly a console programmer, you probably don't have access to the .Net framework on your platform.



Don't be too sure... [wink]

Besides, I doubt many console programmers are worrying about what language to write code in at the moment.


I couldn't get your link to load, but it sounds interesting. Any alternate places I could look to find out what you're referring to?

Share this post


Link to post
Share on other sites
Why is it always C# against C++

Why not consider Managed C++ if you are already a C++ programmer.
C# is by design a new language
Managed C++ is by design for those you already know C++.
So if you choose managed over unmanaged, there is no reason to consider C#. After all this is what the .Net framework is all about, single library and multiple languages (COMMON language runtime)

Share this post


Link to post
Share on other sites
I switched from C++/GL to C#/MDX half a year ago and im never going back.
As mentioned earlier, C#/.NET is built all at once and not layer upon layer.
You really feel that this a carefully designed system from the ground up.
And as i prioritize short dev time with clean code, theres really no arguing about what my preference is.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I've tested it and programming the same game in c# and then in c++ showed me that c# is 12,7% faster (it would be more, but I already knew how to do things when programming the c++ version after the c# version of the game).
So stick with c# for fast development times.

Share this post


Link to post
Share on other sites
Quote:
Original post by arithma
Why is it always C# against C++

Why not consider Managed C++ if you are already a C++ programmer.
C# is by design a new language
Managed C++ is by design for those you already know C++.
So if you choose managed over unmanaged, there is no reason to consider C#. After all this is what the .Net framework is all about, single library and multiple languages (COMMON language runtime)


it's always that way because people who try out managed c++, or c++/cli find a lot of infos about c# while searching for infos in the managed world.. and while they find those infos, they realise that it's exactly the same as in the managed c++ world, with one difference: much simpler to work with.. smaller code, simpler code, less error prone code. the language c# gives about the same ability of expression as managed c++, but allows so with much less work..

tierd of header files? c# doesn't have them.. tierd of this and that and these other things? c# doesn't have them.. it's simply some sort of .. c++ ++.. a c with 4 +.. actually.. thats where the c# comes from.. c# == c++++ in short.

once you start to move over to the managed world, you move quickly (very quickly) over from managed c++ to c# because it's simply the superior language to work in .net for most of the cases.

only when you start doing more complex stuff, interop with c++ libraries, old code, etc.. then, managed c++ starts to show it's big strenghts. but for ordinary coding, just use c#.

i never wanted to myself.. but what the heck :D once you "see the light", you never want to step back.. hehe :D it's about .. 95% of what i wanted c++ to be for years. so.. i'm quite happy now.

Share this post


Link to post
Share on other sites
Quote:
Original post by ApochPiQ
Quote:
Original post by RDragon1
Also, if you're a game programmer, particularly a console programmer, you probably don't have access to the .Net framework on your platform.



Don't be too sure... [wink]

Besides, I doubt many console programmers are worrying about what language to write code in at the moment.


I couldn't get your link to load, but it sounds interesting. Any alternate places I could look to find out what you're referring to?


XNA sounds good, but it also sounds like it's just for Xbox360... anybody see plans for other consoles to support it?

And no, I don't work for MS... but I live near them ;)

And that link earlier can be found here:

http://www.gotw.ca/

it's the bottom-left link on the page. Need IE to watch it :/

Share this post


Link to post
Share on other sites
its all about bottlenecks, there was a topic recently called What area of game development takes you the longest? i replyed with

1. 5% - basic engine stuff eg file readers,texture/models/mathlibrary shaders, opengl stuff, rendering
2. 25% - media content, making models textures sound
3. 5% - debugging, cleaning up code, optimizing
4. 25% - scenegraph stuff, algorithms, particle system etc
5. 40% - gameplay, physics etc

(this is from last year, today #4 would be 15% (inc physics) + #5 55% (gameplay only)

changing to java or c# will not make more more productive at all, since its not a bottleneck.
actually coming up with the algorithms etc is the hard time consuming part, expressing + typing them in as c++ is a no-brainer that i can do in my sleep

another coding mantra / premature optimization is the root of all evil

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