Sign in to follow this  
Dave FF

C++ or C# for learning game programming?

Recommended Posts

Hi everybody, I'm a total newbie starting to learn about programming, and I would like to learn to write simple games for the Windows O/S. I read some of the FAQ articles for beginners and saw a lot of discussion about C/C++ as a good language for games. But there was no mention of C#. (Maybe those FAQ articles are dated.) My question: What about C# as a starting language to learn about programming and games? What are its pros and cons compared to C++? Would appreciated any comments or suggestions. Thanks. Dave

Share this post


Link to post
Share on other sites
I liked C# since it allowed me to focus on the game theory stuff and less on worrying about the actual code. The biggest con when i started a couple years ago was the lack of books but now there are plenty and some good websites that focus on managed code too. Managed DirectX 9 Quick Start by Tom Miller was my favourite.

Share this post


Link to post
Share on other sites
C# is more abstract, and thus will be easier to learn with. While the industry is CURRENTLY using C++, there is no reason to worry. After you get the hang of C# you can always go and learn C++ as well.

Share this post


Link to post
Share on other sites
C# is a much cleaner and more intuitively consistent language than C++. While C++ has a long and (sort of) venerable history, it also has a lot of historical warts and leftovers of design concerns that have long since stopped making sense. C++ is a minefield of obscure syntax rules, weird magic, and a strong dose of arbitrary quirkiness. It isn't an easy language to master, and in many cases, just trying to get something simple done in C++ can be a lot more complex than it seems like it should be.

By contrast, C# is intended to promote quick development. This is done in two ways: by giving you a huge amount of prefab code to work with (the .Net framework, which is absolutely excellent), and by removing a lot of mundane little details about how your program works so that you can quit worrying about technical issues and focus on getting things done.

Overall, C# is definitely a better place to start than C++. Once you get used to the concepts and mental processes of programming, it isn't a big deal to pick up C++, although to be honest you'd have to be insane to prefer C++ to C# [wink]

Share this post


Link to post
Share on other sites
Thanks to everyone who posted a response to my question regarding C# vs. C++ as a language for game programming. It looks (to this point at least) that the posts are unanimous in support of C# for my particular situation. I thought that there would be at least one die-hard supporter of C++.

I will start looking for a good first book to learn C#. Any suggestions?

Dave

Share this post


Link to post
Share on other sites
If you want a good book to start with I would read "C# Primer Plus" by Klaus Michelsen. I know this book came out in 2001 and only covers C# 1.1, but it will give you a really good basis to work from. This book will give you in depth code explanations and training.

From there I would look at Jesse liberty's developers notebook to find out what has changed in C# 2.0

Hope this Helps
T!

Share this post


Link to post
Share on other sites
Im am by majority a C++ programmer. I have learned my share of C# though, and I can say both languages have their merits. I absolutely love C++ programming, mainly because it is easier working with low level memory constructs, hardware access, casting, as well as some of what people are refering to as the "hacks". On the other hand, for 90% of the apps, C# is quicker to use, and nearly if not just as fast, so why not use it? Just if you are doing Interprocess communications via dll hooking, DONT use C# :).

Share this post


Link to post
Share on other sites
Quote:
Original post by Long Dog Studios
If you want a good book to start with I would read "C# Primer Plus" by Klaus Michelsen. I know this book came out in 2001 and only covers C# 1.1, but it will give you a really good basis to work from. This book will give you in depth code explanations and training.

From there I would look at Jesse liberty's developers notebook to find out what has changed in C# 2.0

Hope this Helps
T!


Or y'know, you could just start with Liberty's book which includes 2.0...

Share this post


Link to post
Share on other sites
Quote:
Original post by PaulCesar
Im am by majority a C++ programmer. I have learned my share of C# though, and I can say both languages have their merits. I absolutely love C++ programming, mainly because it is easier working with low level memory constructs, hardware access, casting, as well as some of what people are refering to as the "hacks". On the other hand, for 90% of the apps, C# is quicker to use, and nearly if not just as fast, so why not use it? Just if you are doing Interprocess communications via dll hooking, DONT use C# :).

Translation: if you're not doing anything too involved or overly complicated use C# [lol] [grin]; much later on decide and compare what language fits the bill.

Share this post


Link to post
Share on other sites
Quote:
Original post by Telastyn
Or y'know, you could just start with Liberty's book which includes 2.0...


I would also recommend Jesse Liberty but do NOT start with "Programming C# (Fourth Edition). Start with "Learning C# 2005: Get Started with C# 2.0 and .NET Programming" instead!
"Programming C#" is more for programmers who are already familiar with OO programming with C++, Java or VB.NET. I've read it and I would not recommend it to a C# newbie but it's really great if someone is already familiar with C++ and wants to learn C#, too. "Learning C# 2005", however, is an entry guide!

Cheers!

Share this post


Link to post
Share on other sites
Thanks to everyone for the C# book suggestions. I hope to look over the suggested titles in a local bookstore in a day or two. I will avoid Jesse Liberty's "Programming C#," since it does sound like it's more advanced than would be helpful. His "Learning C#" does sound like a better fit for a beginner.

Dave

Share this post


Link to post
Share on other sites
If you want to do C# programming in games, you can also take a look at the (free) webcast series by Microsoft and Digipen. They have two series of webcasts: one for 2D games in C#, then a second for 3D game-development.
Here's the link:
Microsoft-Digipen C# Game-making Webcasts

The webcast at the bottom of the page is the introductory series (2D). It takes you through basic programming concepts through the completion of a small game. The second sequence (at the top of the page) is the making of a basic 3D game. I think there's almost 20 hours of webcast saved there.

If people want more C## game tutorials, I'd be willing to guess that Microsoft+Digipen could probably do more-- the 3D webcast was added due to high demand. It's a win-win-win situation: Microsoft pushes C#, Digipen gets to show off their skills, and everyone gets free lessons!

I hope this helps!

First sequence:
MSDN Webcast: Basic Programming Concepts and Introduction to C# (Level 100)
MSDN Webcast: Creating Sprite Behavior (Level 100)
MSDN Webcast: Game Music and Sound Effects (Level 100)
MSDN Webcast: Introduction to Sprites and Animation (Level 100)
MSDN Webcast: Overview of Game Development Process (Level 100)
MSDN Webcast: Overview of Game Elements (Level 100)
MSDN Webcast: Player Control of Sprites (Level 100)
MSDN Webcast: Transformation and Collision of Sprites (Level 100)

Second sequence:
MSDN Webcast: Introduction to 3-D Games (Part 1 of 11) (Level 200)
MSDN Webcast: The 3-D Engine (Part 2 of 11) (Level 200)
MSDN Webcast: The 3-D Engine (Part 3 of 11) (Level 200)
MSDN Webcast: Importing Background and Objects (Part 4 of 11) (Level 200)
MSDN Webcast: Importing Background and Objects (Part 5 of 11) (Level 200)
MSDN Webcast: Understanding and Handling Collisions (Part 6 of 11) (Level 200)
MSDN Webcast: Artificial Intelligence (AI) (Part 7 of 11) (Level 200)
MSDN Webcast: Multiple Levels and Additional Character Functionality (Part 8 of 11) (Level 200)
MSDN Webcast: Game Play (Part 9 of 11) (Level 200)
MSDN Webcast: User Interface (UI) (Part 10 of 11) (Level 200)
MSDN Webcast: Gaming and Miscellaneous Effects (Part 11 of 11) (Level 200)

Share this post


Link to post
Share on other sites
RapidM,

That webcast list from MSDN looks great! Just what I would be interested in, particularly the 2D part. Thanks.

Dave

Share this post


Link to post
Share on other sites
My opinion is on that C++ for games C# for testing theories, tools probably, and test programs.

C# has a bit more limitations than C++.

Share this post


Link to post
Share on other sites
Quote:
Original post by llloyd
The biggest con when i started a couple years ago was the lack of books but now there are plenty and some good websites that focus on managed code too. Managed DirectX 9 Quick Start by Tom Miller was my favourite.


Actually, there's two C# books that I know of that are based on Managed DirectX and one more based on general GDI+ graphics. I'd suggest not to learn Managed DirectX because the XNA Framework is taking its place, thus MDX 2.0 will never be really released. It's a name change, basically with additional tools. Think of the XNA Framework as MS Office which has MS Word, MS Excel, etc. If you must learn graphics for C#, I'd suggest reading C++ General/DirectX books until gaming tools for C# matures. After that, you'll see more books on the subject. What you learn will transfer over anyway. Thus, I'd say C++ all the way.

Share this post


Link to post
Share on other sites
Quote:
Original post by Riekistyx
My opinion is on that C++ for games C# for testing theories, tools probably, and test programs.

C# has a bit more limitations than C++.

Be more specific, please. I can't think of a thing that C++ can do that C# can't when it comes to games.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by nullsmind

Actually, there's two C# books that I know of that are based on Managed DirectX and one more based on general GDI+ graphics. I'd suggest not to learn Managed DirectX because the XNA Framework is taking its place, thus MDX 2.0 will never be really released. It's a name change, basically with additional tools. Think of the XNA Framework as MS Office which has MS Word, MS Excel, etc. If you must learn graphics for C#, I'd suggest reading C++ General/DirectX books until gaming tools for C# matures. After that, you'll see more books on the subject. What you learn will transfer over anyway. Thus, I'd say C++ all the way.


_____________________

Although I've decided to go with C# as my language of choice for games, I hope to learn some C++ so I can understand a little of the C++ coding on this forum. I've got Brian Overland's "C++ Without Fear," and hope to get through that book if it doesn't confuse me too much in trying to learn C# simultaneously. If I mature and the game market for C# doesn't, I'll switch to C++ at a later time. Thanks for your thoughts.

Dave

Share this post


Link to post
Share on other sites
Quote:
Original post by RabidMarsupial
Dave FF-

I'd like to know what you think of it when you're done with the series.
Post back here if you can!

Thanks,

RM

____________________________

Will do, although it may be a while before I get through the whole series.

Dave FF

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
If I mature and the game market for C# doesn't, I'll switch to C++ at a later time. Thanks for your thoughts.

Dave


You're going to have to learn C++ eventually along with Java and other languages. You can't make it out there with only knowledge of one language.

Share this post


Link to post
Share on other sites
Quote:
Original post by ApochPiQ
it also has a lot of historical warts and leftovers of design concerns that have long since stopped making sense. C++ is a minefield of obscure syntax rules, weird magic, and a strong dose of arbitrary quirkiness.


Such as?

Share this post


Link to post
Share on other sites
Maybe this was mentioned before: Another advantage of C# is better tool-support, such as refactoring and some kind of uml-tool...

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