How about C# for game programming?

Started by
9 comments, last by Seifsta 16 years, 11 months ago
Hello, guys. I'm not new in programming, however in game programming thing i'm a beginner. I've read the article that compares different languages one can use, pointing out their advantages and disadvantages. So, I'm wondering which one should I start majoring in, because Visual Basic and Delphi (the languages I've dealt the most) don't seem to be the most appropriate ones, hehe. So far, I'm convinced that C++ would be a good choice to start with. But there was no mention about C#. I searched for the differences between C# and C++, and there are quite a few but, overall, these two a very similar. Which one of these two would you recommend? And is Microsoft Visual Studio .NET a good development environment for C++ Or any other IDE is better for this task? Thank you in advance.
Advertisement
C# is a great language for game development; see XNA. And Visual Studio is IMHO the best C++ IDE out there; others have preferred Code::Blocks and/or Eclipse.
I would certainly not say that C++ and C# are "very similar" - they have superficially similar syntax but they have some major differences in the way things actually work (most obviously, manual memory management versus garbage collection).

C# is a perfectly valid language to use; as Sneftel says, you'll probably want to look into XNA, which is a technology that lets you write games in C# that run both on PC and on Xbox360. Given your background it's probably the best choice for you. You may want to learn C++ eventually but there's no need to do so right now.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

C++ is best suit for game programming for many reason.

But, if you are interested in .NET programming and hava experience with VB you can make great games with Visual Basic.Net. A program made with the .NET technology, theorically will have the same performance.

Anything that is compiled into .NET can acces other .NET modules as well, which have the interesting effect that diferrent languages can talk between them. .NET is not tied to any particular language, Microsoft oficially support Managed C++, C#, Visual Basic.Net and J#.

One great disadvantage of XNA is that you'll be tied with the Visual C# Express edition, it won't work with other compilers. XNA is a framework. For mare information look into:

http://msdn2.microsoft.com/en-us/xna/default.aspx

And your games will be restricted in portability as with Managed DirectX, look at:

http://www.gamedev.net/community/gds/viewentry.asp?projectid=272200

To see an example of a game with many problems to run in diferent machines.
Quote:Original post by ejele012
C++ is best suit for game programming for many reason.


Hmmm...

1)Legacy
2)Performance(sometimes)

I count only two.

I'd add:

3)Platform

unless that's somehow covered by Legacy

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

Quote:Original post by nobodynews
3)Platform


Well, Nintendo and Sony consoles are hardly what I consider legacy [smile] For the rest, C# and C++ support about the same range of platforms anyway (with C# running as-is, and C++ requiring a recompile).
Legacy: Yes, you can buil actually a C style program (structured programming) or an Object Oriented Programming. You also have low level acces to the machine, wich, in some routines can improve your program.

Performance: With actuall tools, like XNA, C++ and DirectX is twice faster. Also you won't need the latest graphics card and a lot of ram to run a simple space shooter. Try to run an XNA in a PIV with a Geforce 5200 and 512 RAM.

Platform: A C++ game with OpenGL, SDL or Allegro can be build and compile over many different OS, like Linux, Unix, Beos, Mac, etc. So, actually your game can get to more users.

Support: Just google it. In the net there are tons of tutorials and code that you can reuse. Go to your nerest bookstore an take a look. Ask to a teacher in the University an ask him.

Stability: Today, I can rebuild my old games, made many years ago, and they run smoothly. I can't say that from XNA

Goto http://www.wrox.com/WileyCDA/WroxTitle/productCd-0470126779.html and take a look. They just have put the all source code to download. Why? 'Cause the source code that came with the book doesn't compile well with the XNA refresh.
The only way you'll ever find out for REAL is to try both languages, and the various IDEs that support them.

If you plan on getting a job in console game development, go with C++, no question. This is because any company that would hire you would already have all of their game code in a mix of C and C++, and would only use C#, Python and Perl for utilities to process the raw game assets.

If you just want to mess around as a hobby at home, go with C# since you don't have to worry about as much ancient language 'features' that C++ drags along with it that tend to cause lots of headaches. But don't take my word for it - try it yourself and in a few years when you've had time to get into making a 'real' game, you will have the experience of getting bitten by various C++ problems, and you can make up your own mind.
I think the problem most people have about starting to code is the worry that a particular language will become obsolete fairly quickly and they have spent all that time learning the language, that's the case for me anyway. I've looked at C# examples and the code seems quite nice to work with but if your considering C# why not Java? I believe Java is now Open Source which will mean further improvements by dedicated and talented people, but that's your decision.

I hate when people say this language is faster than that one, blah blah blah, it's not the language, it's the engine it uses! potentially C++ has the capability to develop more intricate applications and games as it provides full control over your development.

there are plenty of game engines that support .NET now, like OGRE, Irrlicht etc... so you could do alot worse than C#, as a previous poster stated, the best way is to try it out yourself, perhaps you could decide on something to create and see how easy and how fast you can get it to run, the make up your mind based on that.

I believe the best way if you want to get into game development as a career would be to concentrate on design techniques such as 'SCRUM', data structures, algorithms etc... and not get too wrapped up with the actual syntax of a language, the language can change, generally the design, algorithms are the same no matter what you use.

This topic is closed to new replies.

Advertisement