Jump to content
  • Advertisement
Sign in to follow this  
capone888

C++ or C#

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

It seems to me that many commercial games are written in C++. But I have heard that C# is replacing C++. C# is suppoesed to be a step up. Is this true, and if so, will future games be written in C# as opposed to C++? I am concerned because I am just starting out, and I do not want to focus on C++ if C# is the future. Any thoughts? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
You are not in danger. C++ and C# are so similar that you will have no problem moving between them if this happens. C++ will be a popular language for a very long time. C# is the new hotness, and Microsoft is pushing it very hard for programming tasks on Longhorn.

You should eventually know both. Please note that I think C# is easier to learn, so if you do have trouble with C++...try C# and when youre more skilled, go back to C++.

Share this post


Link to post
Share on other sites
C++ is used most commonly because of its hybrid nature, you can do everything with it. Of course, that also means that you MUST do everything other languages take away from you, though a great library support allows for "drop-in" solutions if you don' want to hand-code a specific mechanism provided in other languages, for example memory managment.

-Structured ("Procedural") Programming
-Object Oriented Programming
-Generic Programming (which in turn allows for some sort of Functional Programming)

It is also low-level, meaning it has low runtime overhead. Because games are always pushing to the edge of technology, this is an advantage that most "pro" developers don't want to give away for the ease of higher level languages, even if it means they have to write more code.

C#, on the other side, may sure be a good language, which takes away some of C++ power (memory managment as an example) in favor of faster work.
But it is a (for now) a proprietary language, which means that it will take quite a time until it reaches C++ level of library support, and it also forces the client to install a large runtime.

So, for the game code, most programmers tend to use C++ anyway, but it is in good use for tools, like level editors.

That said, I can imagine that major games will be written in C# in the future, and to begin with C# before switching to C++ (if ever) is not a bad choice, because unless you want to write ultra-performant 3D code, you probably won't suffer from its runtime overhead.

Thermo/Konfu

Share this post


Link to post
Share on other sites
Quote:
i heard that C# is for Windows only..

It's not. C# is just a language and the specification is open. There is nothing about it that makes it Windows specific. You could write your own compiler for any platform you wanted to right now. It just happens that currently Windows has the most mature C# compilers and libraries. There are compilers and libraries already for Mac and Linux and as the language gains popularity, these will become better.

Quote:
which takes away some of C++ power (memory managment as an example)


I don't see that as taking away power. Memory management is one of those tasks better left behind the scenes.

Besides, I have seen some nice games done in C#. Arena Wars comes to mind. I say just pick one and go for it. Worry about learning proper programming techniques rather than spending all your energy on what language you will use.

Share this post


Link to post
Share on other sites
yeah like someone said many times before learn to program first then learn to write games.
After you have learned and programmed in every language from fortran,basic,assembly,c,c++,pascal,etc like I have you will come to the realization that programming languages are just tools and you should pick one based on what you are trying to do.

Share this post


Link to post
Share on other sites
yeah like someone said many times before learn to program first then learn to write games.
After you have learned and programmed in every language from fortran,basic,assembly,c,c++,pascal,etc like I have you will come to the realization that programming languages are just tools and you should pick one based on what you are trying to do. Another thing you should consider is that c# a moving target since there will be alot of changes to the language when visual studio 2005 comes out.
p.s. if you are really that worried about it learn fortran since it still used as much today as when it came out especially in scientific circles.

[Edited by - daviangel on September 29, 2004 10:49:46 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by pex22
i heard that C# is for Windows only..

might as well be since the parts like forms programming and other support libraries that make it was easier to program than c++/mfc are only available on windows!
I'll admit there is mono but it's still beta last time I checked:
t's not Mono vs .NET Framework. Mono is an implementation of the .NET Framework and C# compiler on the linux platform. If you're asking about IDEs, then look at the ones the review talked about, and sharpDevelop and such.

The mono c# compiler allows you to create CIL (common intermediate language) code, which is analygous to java byte-code, except for just-in-time compilation. The mono implementation of the .NET Framework allows you to compile CIL to native linux binary JIT and run it on Linux.

The whole point about the .NET Framework and CIL is that you could write and compile a program using Mono, then copy it to windows and run it, and vice versa for VS.NET to linux. Right now this probably only works with console programs, and web services and ASP.NET and such. (Of course, with both windows and linux if you include system specific APIs, they won't run on the opposing system. )

When Mono's Windows.Forms implementation is complete, you should be able to do this same thing with complete GUI applications, however in the mean time that's what GTK# and other linux-based APIs are for.

[Edited by - daviangel on September 29, 2004 10:26:48 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!