Sign in to follow this  

C# or C++? Which one is better for Game developing? Pros and Cons?

Recommended Posts

Posted (edited)

there is nothing better . by the mean C# you mean Unity , Unity use C++ to compile game , C# for scripting . which has alot of library support for game programming . which you don't have to deal with pointer , which already handle a lot of exception . 

again , if you mean C# is Unity then Pro and Cons would be :

Pros : you can make your game really fast , even for beginer . Unity has a big comunity , which you can ask a question or search solution . Build in almost any platform . 

Cons : you don't know what going undernear that ( or should you ) . 

 

for example : you can take a look at my game build with my own engine (which took me more than 2 years to complete this far ) : https://www.youtube.com/watch?v=TGajDj9FftQ&t=22s

 

Which you can build the same with C#(Unity ) in the time less than 2 years . 

Edited by Feint

Share this post


Link to post
Share on other sites

A few general statements (that I have no sources to back up). If you have 2 equally skilled developers (one c++, one c#) then the c# one will probably get the job done a bit faster. The c++ one will probably have an easier time supporting multiple platforms and will be able to offer the most performance but that will still take a lot of time.

 

For simple, personal projects I am always more tempted to use c# but I like to use c++ otherwise more from preference than for any particular need. Almost definitely c++ when you need performance (many games) but there are plenty of games that just din't need crazy performance and you'd be better off using a language/tools that are easier and faster to develop with.

Share this post


Link to post
Share on other sites
For writing state of the art game engines, C++ is the tool of choice, because it allows very direct control over memory layouts, access patterns and generated CPU instructions, which are not easily expressed in C#.
The downside is that it's a very dangerous language, even for experts. Code that looks perfectly fine might subtlety be corrupting memory belonging to a completely different gameplay system, causing bugs that take months to find the single line of code responsible...

For writing high level gameplay code (or anything not written by optimisation experts), C# is arguably a much better tool, simply because C# is designed to be a much more productive language than C++. i.e. given the same amount of time, a programmer can do more work.
However C#, generally means C#.NET, which is a large 3rd party dependency that you have to figure out how to get running on all the platforms you want to support.

If you're making a game in Unity, the choice is made for you: use C#.
If you're making a game in Unreal4 the choice is made for you: use C++.
If you're making a game from scratch, use the one that YOU personally know the best / like using the best.

Share this post


Link to post
Share on other sites

This is like saying, "I'm hungry. Will I feel less hungry if I eat an apple or an orange?"

Silly, right? Either one will suffice.

When it comes to "programming", I think of it as being language agnostic. Programming is the process of writing very specific and detailed instructions on what to do. You could write out the instructions on how to make a peanut butter and jelly sandwich in plain english, and it could be considered programming. The interpreter just reads the instructions and follows them by performing actions. You could write those same instructions in chinese, and provided that the interpreter understands chinese, they can follow the instructions. When new people pick up programming for the first time, they're learning a new language and how to write logical instructions at the same time. That's why its so hard for beginners. Once you know how to write instructions, you can write them in any language after you learn it.

Anyways, when it comes to game programming, choosing between C# and C++ is going to mostly be a decision based on your existing experience, existing tool sets and libraries, what your team is best with, what API you want to use, what platform to target, etc. Like with my apples and oranges example, you can make amazing, excellent games with both C# and C++. The language of choice here is not going to be the arbiter of your success.

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