Sign in to follow this  

C# or C++

This topic is 4776 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 know C++ is very popular for game programming. But what about C#? I like C# becase: 1. uses Common language runtime CLR 2. drag and drop 3. built in classes in the CLR let you do just about everything from encryption, database classes, networking, everything. 4. The drag and drop and CLR clears a lot technical hurdles for you so you can concentrate on the fun part of making the game. The problem is about the speed? how fast is C# compared to C++? Would there be a noticeable difference in game play? I've made a simple 2-D game in C# with some collision detection. I don't know where to start for making a 3-d game. Would the .NET classes be too slow for 3-d?

Share this post


Link to post
Share on other sites
It's all preference.

C++ will have the most resources, because it's popular. The more popular something is, the more tutorials and help you can find.

C# is good enough to do any 2d gaming.

For 3d, it depends on what 3d game you want. It's too generic to lump '3d gaming' into a single entity, since some 3D genres have higher requirements than their 2D counterparts.

Share this post


Link to post
Share on other sites
ok well ive never programmed in C# but i know from what ive heard that it is slightly slower this can be a problem on 3d or networked (complicated, not checkers online) games and also becomes a fairly big problem on councles and external systems that dont have the vast amount of ram and Gigs as a computer (altho some of the Next-Gen councles are getting there)

Share this post


Link to post
Share on other sites
Assuming you aren't trying to push every last bit of strength from your target computer, C# should work well. when using Managed DX, it is only a few percent slower than unmanaged code. the main problem I see currently with .NET languages in general is the huge framework. If you want to have a user download a 2 MB game, along with a 22 MB framework, they may be a little aprehensive. If it is being distributed by CD, this really isn't a problem, just have the user choose to install the framework if they don't have it already (much like DX works).

Share this post


Link to post
Share on other sites
Don't forget about C++/CLI which is basically the second version of Managed C++.

C++/CLI is an extended version of C++ for use with .Net. I've been playing around with it recently and finding it a nice language to work with (unlike the previous version of managed C++ which had a rather horrible syntax). Just like C# you can use the entire .Net class library and can use the windows form designer for RAD.

Another nice thing about C++/CLI is that you can seemlessly mix managed and unmanaged code. Though if you do do this you loose cross-platform capability (i.e. you can't just directly run your program on anything with a CLR implementation) and I believe there may be speed penalities when going across a managed/unmanaged boundry.

C++/CLI is currently only avaiable in the VS 2005 beta (meaning anyone running stuff you make with it needs the .Net 2.0 beta framework as well), I'd recomend taking a look at it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sr_Guapo
If you want to have a user download a 2 MB game, along with a 22 MB framework, they may be a little aprehensive.

Not a lot of games that are that small. If you download a game (demo), sizes in excess of 100 megs is pretty common. The 22 megs from the framework is less overwhelming in that context.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sr_Guapo
Assuming you aren't trying to push every last bit of strength from your target computer, C# should work well. when using Managed DX, it is only a few percent slower than unmanaged code. the main problem I see currently with .NET languages in general is the huge framework. If you want to have a user download a 2 MB game, along with a 22 MB framework, they may be a little aprehensive. If it is being distributed by CD, this really isn't a problem, just have the user choose to install the framework if they don't have it already (much like DX works).

I don't really even see this as much of a problem. Users routinely install 25 megabyte components and applications onto their system without so much as a second thought. 25 megabytes is a few mp3 files.

As for performance, .NET does very well, even better than C++ in some cases. Most of the boost comes from the fact that it's a higher-level language than C++ and is generally more human-readable. However, C++ promotes multiple programming styles, not just OOP, whereas .NET ascribes heavily to OOP as the way to go.

However, neither of these should be viewed as weaknesses or strengths; just properties of the language. Programming languages are tools; is a saw a bad tool because it can't drill holes? No, of course not; it's just not the right tool to use. Similarly, does Java suck because bytecode can be orders of magnitude slower than native code? No; Java's strength is its portability, not its execution speed. C# lacks true portability (few CLR implementations have been written for other platforms), though it has great potential (all someone needs to do is write them).

Share this post


Link to post
Share on other sites
C# has about as much performance as VB, so don't hurt yourself doing anything intense with it! ;). I use it to develop the tools for my games. For example, if you want to make an application that writes a configuration file, or builds levels for a 2d game, write it in c#. If you want high performance, or want your 2d game to run on older computers, use c++. Otherwise, go for c#, it is definitely on my list of sexy programming languages.

Share this post


Link to post
Share on other sites

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