Sign in to follow this  

c++ or c#

This topic is 3594 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 notice a lot of threads on here about what programming language to use for games. I think the question is sort of back to front.

What I mean is that it really depends on the graphics or game engine you want to use. Especially if you're not already deeply into a particular language.

Like some engines won't run on C# but are built for C++. Others use Python or their own scripting language. Test a few and see which environment suits your style of game development then go with the underlying code base.

For example some developers love drag and drop GUI engines with script generators etc. Personally I like to code everything so I have total control so I prefer a SDK with C++. If I was clever enough I'd write everything myself direct to the Direct X SDK but I'm not that clever.

In the old days when hardware was expensive the "real" game programmers wrote strictly in C and dropped into assembly where ever possible for sheer speed and a minimal use of memory. Those days are long gone though so you don't need to worry about that anymore.

m0ng00se

Share this post


Link to post
Share on other sites
Where I work, I use both C++ and C# on a daily basis. The game is all C++, but many of the tools and infrastructure are C#. This is getting increasingly common in the professional arena.

In the hobbyist arena, C++ is a waste of your time unless you're trying to build a demo whose code you'll be sharing with potential employers or just trying to learn. If your goal is to actually make a game, then you'd be a fool to pick C++ over C#.

Share this post


Link to post
Share on other sites
It's true that C++ is the industry standard, but that doesn't mean it's the best language for you. Most of the reasons C++ is standard is due to legacy code and legacy programmers, not that it's somehow a superior language in and of itself (it isn't).

Here's my advice: If you use C++ you'll spend a large portion of your time doing book-keeping and tracking down really messy bugs - tedious stuff that has nothing to do with what you're trying to accomplish. If you want to learn about games I think your time will be better spent actually doing useful stuff and learning from it, rather than wrestling with a legacy language. Use the language that let's you get the most work done in the shortest amount of time.
Plus XNA is C#, and that's probably one of the best platforms to get experience making games right now.

Share this post


Link to post
Share on other sites
This is the same argument that has gone on for 10 years now with numerous variations. As I said before, the total opposite is actually true in regards to "professional" game development.

People use C# because it's easier not better. People use C++ because it's easier not better than C. The big professional game houses still employ "real" programmers to write fast pure C that drops into assembly for real graphics intensive stuff. Anything that can write direct to the video and direct to the CPU is faster and handles memory better. A game written direct to Direct X will out perform anything done in a higher level language.

It's no accident that Windows is written in C++ (with some libraries still in pure C), most SDKs are in C++ or C. most widgets are in C++ or C and almost all direct hardware API's are in C++ or C that drops into assembly. Most very fast huge industry EPROM's use C as a wrapper for assembly.

Any higher level language such as C# is not "better" at all. It's easier that's all but it's also slower and more bloated and it protects the API too much.

Old School programmers believe that MS is deliberately leading programmers away from accessing the API directly because MS is the most "hackable" operating system on the planet.

It's true that XNA is where it's at so pretty soon the industry will be flooded with C# programmers (as happened when VB was "the" new high level language) and suddenly the industry will be looking for programmers that still know how to cut through all the bloat and directly access the API.

Just because something is hard to learn properly doesn't mean it's no good.

m0ng00se

Share this post


Link to post
Share on other sites
For my current game I decided to go with C# using XNA for the main reason that I want to make a game, and not be bogged down with having to write "tedious" components such as resource managers, since a lot of that is done for you. I do still like to experiment with things like that and when I do, I use C++. In my eyes, for games, C# should be used if you're aiming to just make a game, and C++ should be used for more serious projects or if you have more time to dedicate to it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
In the hobbyist arena, C++ is a waste of your time unless you're trying to build a demo whose code you'll be sharing with potential employers or just trying to learn. If your goal is to actually make a game, then you'd be a fool to pick C++ over C#.


There are valid reasons to use C++. Though Mono and Tao are quite good, C++ still has the upper hand for most things on non-Windows platforms. Downloading or installing the .NET framework may be too much overhead or might be infeasible for your target audience. But in general, I agree. Certainly the reasoning that "C++ is the 'industry standard'" is no reason to use C++ over C#.

Oh, and why did you stop considering Python, OP? It's a very nice language, but you seem to have dropped yesterday's thread about it in favor of C++ vs. C#. Either C# or Python would be a better choice than C++, IMO.

Share this post


Link to post
Share on other sites
C# is a good language to break into game development with. It does a lot of the behind-the-scenes stuff for you so that you can concentrate on learning what a game is, what it's comprised of, and how the game development cycle progresses.

Once you've gotten a grasp on how developing, maintaining, and patching a personal game works, you can move on to learning C++ and sinking your teeth into the industry's way of handling everything.

Share this post


Link to post
Share on other sites
Quote:
Original post by sebastiansylvan
Here's my advice: If you use C++ you'll spend a large portion of your time doing book-keeping and tracking down really messy bugs - tedious stuff that has nothing to do with what you're trying to accomplish. If you want to learn about games I think your time will be better spent actually doing useful stuff and learning from it, rather than wrestling with a legacy language. Use the language that let's you get the most work done in the shortest amount of time.
Plus XNA is C#, and that's probably one of the best platforms to get experience making games right now.
+1. My day job involves C++ coding, and I can't stress enough the amount of weirdass issues that comes up with C++ that simply don't exist in C#, and this is even after using STL, smart pointers, RAII, and other techniques to combat these issues. There are reasons to use C++, but I don't see any if you're a beginner. All you'll do is frustrate yourself and take a lot longer to do anything than if you were to use higher-level languages like C# or Python.

Share this post


Link to post
Share on other sites
I've only been programming for a year myself but I've had some experiance with C++, C# and java. I've even read some document on how hardware works so have came across asm and machine code.

Moving between the 3 big OOP languages seem to be a trivial task, I started with C++ going from C# or java to C++ may not be as easy as going the other way but do you really want to wait a couple of months before programming your first game.

If your going to program for windows then why not go with C# it's a much simplier language than C++, well the actual languages seem to be very similiar but the .net framework makes things so much easier.

with the rate at which hardware advance and it's cost picking a language on it's speed seems to be a waste of time even if modern hardware can't keep up with what your developing chances are in a year or two it will breeze through it. If you could push a P4 with a GeForce 6600 and 1GB of PC2700 ram Then you should think about performance.

Answer to your question: pick your language and API's now, the choice of API may determin what language you need. Go with what ever comes more naturally to you to begin with learning a second programming language is miles easier than learning to program.

As for the comment about windows as a OS it's not the best around but it is one of the most user freindly.

Share this post


Link to post
Share on other sites
As previously stated it depends what project your aiming for and the code you will need to use in the form of libraries. For example XNA supports only C# i believe so if you wanted to make a game using XNA then you'd have to program it in C#.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
Where I work, I use both C++ and C# on a daily basis. The game is all C++, but many of the tools and infrastructure are C#. This is getting increasingly common in the professional arena.

In the hobbyist arena, C++ is a waste of your time unless you're trying to build a demo whose code you'll be sharing with potential employers or just trying to learn. If your goal is to actually make a game, then you'd be a fool to pick C++ over C#.

Exactly!
Couldn't of said it better myself unless you are Carmack,Linus,or Joy,etc. who are uber programmers who can program as easy as they breathe air.
You'd know if are one of the select few because you'd be able to rewrite the entire OS in a weekend because you are bored while everyone else struggles.
Plus you wouldn't even be asking c++ or c# because either would just be a tool you would bend to do your bidding-hahaha...





Share this post


Link to post
Share on other sites
Quote:
Original post by rpstaekwondo
EZBEZ:

[Oh, and why did you stop considering Python, OP? It's a very nice language, but you seem to have dropped yesterday's thread about it in favor of C++ vs. C#. Either C# or Python would be a better choice than C++, IMO.


i didnt like the way python was writen, it just seemed wierd

Share this post


Link to post
Share on other sites
Quote:
Original post by rpstaekwondo
so wats the verdict, c++ or c# for a beginner?

not python


Neither. Python really would be optimal, but if you're set against it, at least try Ruby. Heck, even Basic would work (Visual or otherwise).

C++ and C# have a lot of complexity that isn't really related to you making your game. Other languages, like Python and Ruby, will let you focus more on your game and less on syntax.

Share this post


Link to post
Share on other sites
Quote:
Original post by rpstaekwondo
so wats the verdict, c++ or c# for a beginner?

not python


Python.

Seriously, you have no idea what you are missing out on.

If you must choose between C++ and C#, use C#. Just remember the caveat about cross platform programming with C#, if you care.

Share this post


Link to post
Share on other sites
Quote:
Original post by rpstaekwondo
so wats the verdict, c++ or c# for a beginner?

not python


How about downloading all 3, then going to the tutorial pages.

Try each one for a day.

The one you get most work done in is the best for *you*.

But, I'll answer what you want to hear: "Use C++. It's what all the leet coders use. C++ is fast and rocks and is serious business, not like all those toy languages and if you don't use anything but C++ you aren't leet enough and will be laughed at for writing in slow nanny language like Python. C++ - the choice of winners".

Share this post


Link to post
Share on other sites
Quote:
"Use C++. It's what all the leet coders use. C++ is fast and rocks and is serious business, not like all those toy languages and if you don't use anything but C++ you aren't leet enough and will be laughed at for writing in slow nanny language like Python. C++ - the choice of winners".



=]I like that

Share this post


Link to post
Share on other sites
Our OP needs a kick to make him start learning. Verdict: pick C#. Now move it, and start learning. I think we'll all agree because C++ is definitely a bad choice for a complete beginner. And given OP's posts, I think he's not ready for the challenge of C++ as a first language.

Share this post


Link to post
Share on other sites
Quote:
Original post by PromitIn the hobbyist arena, C++ is a waste of your time unless you're trying to build a demo whose code you'll be sharing with potential employers or just trying to learn. If your goal is to actually make a game, then you'd be a fool to pick C++ over C#.


I disagree completely. Some of us genuinely enjoy using C++ for our development and is thus not a waste of time at all. If it's a hobby, there really is no right or wrong -- I mean, people could feel it's not a waste of time to make demos that run on an Intel 8080.

I use C# for my tools and the like as you'd expect, but I still like writing my games in C++. I could switch over to C#, namely because I have absolutely no reason to port the code, and strictly support DirectX9, but why when there's really no compelling reasons to aside from having garbage collection and the like to make it a bit easier?

Share this post


Link to post
Share on other sites
Quote:
Original post by Flimflam
Quote:
Original post by PromitIn the hobbyist arena, C++ is a waste of your time unless you're trying to build a demo whose code you'll be sharing with potential employers or just trying to learn. If your goal is to actually make a game, then you'd be a fool to pick C++ over C#.


I disagree completely. Some of us genuinely enjoy using C++ for our development and is thus not a waste of time at all. If it's a hobby, there really is no right or wrong -- I mean, people could feel it's not a waste of time to make demos that run on an Intel 8080.

I use C# for my tools and the like as you'd expect, but I still like writing my games in C++. I could switch over to C#, namely because I have absolutely no reason to port the code, and strictly support DirectX9, but why when there's really no compelling reasons to aside from having garbage collection and the like to make it a bit easier?


Sorry, sitting in a debugger trying to track down some random undefined behavior despite already jumping through hoops to avoid it is not fun or enjoyable for anyone. History has shown that even excellent programmers following the best practices will occasionally trigger something in the nuances of the language to cause a bug, and that's in the fantasy-land were everyone on your team is an excellent programmer following best practices.

Add to that a sane compilation model, a (relatively) humongous standard library, improved IDEs... it seems like there are plenty compelling reasons.

Share this post


Link to post
Share on other sites

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