Jump to content

  • Log In with Google      Sign In   
  • Create Account


Why C# XNA When Everyone Wants C/C++


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • This topic is locked This topic is locked
165 replies to this topic

#1 Intrawebs   Members   -  Reputation: 100

Like
0Likes
Like

Posted 04 March 2009 - 06:24 AM

For starters I've been a .net developer since the 1.1 framework. Everything from web apps to console apps, using C# and vb.net (ick). Also, I took C/C++ at a Uni many years ago. I'm looking at getting into game dev. So that leads me to the conundrum below... I've seen threads that suggest new comers to game dev to learn XNA and C# as their way into programming games. I find this very confusing. Looking at the job postings for Bungie, ArenaNet and Blizzard, they all want extensive C/C++ skills. The only mention of C# may be in regards to support of their web based technologies (not games). So, when the big shops want C++ why are many here in these forums recommending XNA and C#? There are more platforms than just WinPC and the XBox. Or am I wrong and the majority of shops are only doing WinPC and XBox dev these days?

Sponsor:

#2 Imgelling   Members   -  Reputation: 222

Like
0Likes
Like

Posted 04 March 2009 - 06:36 AM

I recommend XNA because C# and XNA are pretty easy to jump into. Even on the GameDev.Net latest news there is a story about a person who knew little of C# and nothing of XNA and made a block destroying game in a very short period.

http://www.gamedev.net/community/forums/topic.asp?topic_id=526722

Being able to make games and sell them on the 360 is just a bonus. Plus you can make games for a zune. Sure there are more systems out there than the PC and 360 and zune, but with 1 framework, you can code it once and basically (there would be a few changes, no keyboard on 360 or zune, smaller screen on zune, etc) compile and distribute on 3 of them.

But that is why I recommend it. Of course, I am not looking to get a job at Bungie/Valve/iD/etc. I would rather work for myself. But that is just me.



#3 Promit   Moderators   -  Reputation: 6329

Like
0Likes
Like

Posted 04 March 2009 - 06:39 AM

Any number of reasons.
* Most people are not learning with the sole goal of scoring a game development job, even if that is an interest.
* C#/.NET/Python/etc are important productivity tools, and good to know even if you are working in the industry proper. My former employer was moving all their tools over to C#. Civ IV is half Python code.
* Most employers value ability and demos are an excellent indicator of ability -- this is well known. It's a hell of a lot quicker to build said demos in an environment like XNA.
* Nowhere is it written that because C++ is The Industry Language ™, it has to be the first and only thing you know. It's a much more rewarding path, I think, to learn to build a game using C#/XNA, and then go back and learn all the details and irritations that doing it all yourself in C++ can involve.
Quote:
There are more platforms than just WinPC and the XBox. Or am I wrong and the majority of shops are only doing WinPC and XBox dev these days?
Well, the Playstation 3, the Wii, the PSP, and DS are all still relevant. Mac and Linux aren't, for better or worse. But there's a lot more to game development than simply knowing how to vomit out C++ code. Yeah, you'll almost certainly need it to get a job, but what good are you to an employer if you claim to know C++ but have no evidence that you know much of anything about actually puttinga game together?

#4 Intrawebs   Members   -  Reputation: 100

Like
0Likes
Like

Posted 04 March 2009 - 06:41 AM

Quote:
Original post by Imgelling
Sure there are more systems out there than the PC and 360 and zune, but with 1 framework, you can code it once and basically (there would be a few changes, no keyboard on 360 or zune, smaller screen on zune, etc) compile and distribute on 3 of them.


Sure, for now. One thing I've never liked about MS technology is that it only works/runs on MS technology. If one takes the route you recommend, then one day may come when they are job hunting and don't have a more generic game programming skill set like C++ to land a job somewhere that is more system/framework agnostic.

Also, this still doesn't really address the issue of game shops job postings wanting C/C++ vs. C#/XNA.



#5 PolyVox   Members   -  Reputation: 708

Like
0Likes
Like

Posted 04 March 2009 - 06:42 AM

Because the principles of programming (understanding logic, etc) as as important as knowing ny particular language. Languages like C# make it easier too learn these principles. People can then go on and learn C++ is they wish.

At least, that's the theory. To be honest I'm glad I learnt C++ first because otherwise I doubt if I would have had the motivation to learn C++ as it is so much more difficult to get stuff done quickly.

#6 Imgelling   Members   -  Reputation: 222

Like
0Likes
Like

Posted 04 March 2009 - 06:42 AM

Quote:
Original post by Intrawebs
Also, this still doesn't really address the issue of game shops job postings wanting C/C++ vs. C#/XNA.


Yeah, I realized that after I wrote it. Edited it a bit, then saw your post.



#7 Telastyn   Crossbones+   -  Reputation: 3726

Like
0Likes
Like

Posted 04 March 2009 - 06:43 AM

Because C++ sucks.

#8 jColton   Members   -  Reputation: 134

Like
0Likes
Like

Posted 04 March 2009 - 06:44 AM

My preferred language is c++. The truth is that knowing multiple languages never hurts, and they each have their uses.

I find that I do my major projects in c++ but I tend to do my tools and editors (quick things I throw together) in C#.

#9 Bru   Members   -  Reputation: 100

Like
0Likes
Like

Posted 04 March 2009 - 07:04 AM

Quote:
Original post by Telastyn
Because C++ sucks.

well,it's only less comfortable than c#,seeing stuff like LPDIRECT3DDEVICE9 is hell annoying to read and remember as a developer,but in the end c++ games are faster than c# games and mostly we only care for the result.

#10 swiftcoder   Senior Moderators   -  Reputation: 9739

Like
0Likes
Like

Posted 04 March 2009 - 07:07 AM

Quote:
Original post by jColton
I find that I do my major projects in c++ but I tend to do my tools and editors (quick things I throw together) in C#.
QFE - while you may prefer to write your engine in C++, or have a pre-existing engine, C++ is a truly horrible language with which to write GUI software. Something like C#'s .NET, Apple's Cocoa/Objective-C, or Python/wxWidgets is a much quicker way to get your tools/editors up and running.

Also keep in mind that being highly proficient with scripting languages is essential, in any programming field. You are going to need to write a lot of scripts over time, for format conversion, build systems, data export, etc.

Scripting languages are also useful for even smaller tasks as well - the other day I was given a homework problem, with the following sub-problem: find the summation of 100000/sqrt(i), for i=1,2,...,10000. Sure, you can solve it through integration, but a single line solution at the python prompt is a little quicker: sum([100000/math.sqrt(i) for i in range(1, 10000])

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#11 Promit   Moderators   -  Reputation: 6329

Like
1Likes
Like

Posted 04 March 2009 - 07:11 AM

Quote:
Original post by Bru
but in the end c++ games are faster than c# games and mostly we only care for the result.
And this is precisely the kind of blatant falsehood that is downright dangerous in these forums, and which I and several other moderators (along with any number of long time members) have been working to shut down.

Even if we accept the basic premise that C++ code has the potential to be faster, what the hell does it matter to someone just starting out that an experienced professional developer (or more likely a team of them) can eke out slightly more performance in the end? It doesn't, and you do a disservice to this community when you say things like that.

On the bright side, there are lots of people around to correct these problems, so there's no worry of someone making the mistake of believing you.

#12 Telastyn   Crossbones+   -  Reputation: 3726

Like
0Likes
Like

Posted 04 March 2009 - 07:17 AM

Quote:
Original post by Bru
Quote:
Original post by Telastyn
Because C++ sucks.

well,it's only less comfortable than c#,seeing stuff like LPDIRECT3DDEVICE9 is hell annoying to read and remember as a developer,but in the end c++ games are faster than c# games and mostly we only care for the result.


Execution speed is only one trait of software. And not exactly something C++ will guarantee you over C#.

Implementation speed is an important aspect. Readability directly impacts the maintainability, number of bugs, and ease of use by new/different developers.

Who cares if it runs fast if it took forever to write and is buggy?

#13 scottrick49   Members   -  Reputation: 366

Like
0Likes
Like

Posted 04 March 2009 - 07:37 AM

Then why do all the big name developers use C++? Or maybe that isn't true? Maybe you can point out some larger development houses that use a different primary language.

Are they a bunch of masochists who like to make things harder for themselves (since C# and other languages are more readable)? Are they just stubborn and set in their ways? There has to be a reason everybody uses C++, and if it is not speed, then what is it?

#14 joshuanrobinson2002   Members   -  Reputation: 183

Like
0Likes
Like

Posted 04 March 2009 - 07:48 AM

Don't quote me on this. I've never actually worked in game development and so I can't say for sure. But, I'd wager it has something to do with massive code bases all written in C/C++ that are incompatible with newer languages like C#/Python.

Porting large, existing code bases is no quick and easy task. To that I can attest and I imagine it is a large part of the reason C/C++ are still so widely used.

#15 Telastyn   Crossbones+   -  Reputation: 3726

Like
0Likes
Like

Posted 04 March 2009 - 07:49 AM

Quote:
Original post by scottrick49
There has to be a reason everybody uses C++, and if it is not speed, then what is it?


Momentum.

#16 swiftcoder   Senior Moderators   -  Reputation: 9739

Like
0Likes
Like

Posted 04 March 2009 - 07:57 AM

Quote:
Original post by scottrick49
Maybe you can point out some larger development houses that use a different primary language.
Eve online is largely written in Stackless Python - I know it is a tired example, but the fact remains that a very successful commercial MMO is written in an interpreted language.

In general the MMO crowd seem to be a little ahead of the rest of the industry, in terms of language adoption, but this is likely because they are forced to - writing distributed network simulations is hard, and modern languages have evolved many tools to help with this: just look to Google (Python), Yahoo (Lisp) or Microsoft (.NET).
Quote:
Are they a bunch of masochists who like to make things harder for themselves (since C# and other languages are more readable)? Are they just stubborn and set in their ways? There has to be a reason everybody uses C++, and if it is not speed, then what is it?
Don't forget that there was a time when C++ was considered far too high-level and slow to be useful for game development (vs C) - and there was an even earlier time when the same was said about C (vs assembly language).

There are many barriers in the way of a large company switching to a newer language. Legacy C++ code, programmers already experienced in C++, familiarity with tools and build systems, etc. These are typically not a factor for new developers, so you have the chance to take advantage of newer languages and tools, which may give you that extra edge needed to succeed.

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#17 Bru   Members   -  Reputation: 100

Like
0Likes
Like

Posted 04 March 2009 - 08:04 AM

Quote:
Original post by swiftcoder
Quote:
Original post by scottrick49
Maybe you can point out some larger development houses that use a different primary language.
Eve online is largely written in Stackless Python - I know it is a tired example, but the fact remains that a very successful commercial MMO is written in an interpreted language.

In general the MMO crowd seem to be a little ahead of the rest of the industry, in terms of language adoption, but this is likely because they are forced to - writing distributed network simulations is hard, and modern languages have evolved many tools to help with this: just look to Google (Python), Yahoo (Lisp) or Microsoft (.NET).
Quote:
Are they a bunch of masochists who like to make things harder for themselves (since C# and other languages are more readable)? Are they just stubborn and set in their ways? There has to be a reason everybody uses C++, and if it is not speed, then what is it?
Don't forget that there was a time when C++ was considered far too high-level and slow to be useful for game development (vs C) - and there was an even earlier time when the same was said about C (vs assembly language).

There are many barriers in the way of a large company switching to a newer language. Legacy C++ code, programmers already experienced in C++, familiarity with tools and build systems, etc. These are typically not a factor for new developers, so you have the chance to take advantage of newer languages and tools, which may give you that extra edge needed to succeed.


i doubt c# will replace c++ as the main gaming language, its not all about speed but also the fact that c# is bound to windows and the worst : you can decompile c# applications into their source code, and that's something you dont want.


#18 Imgelling   Members   -  Reputation: 222

Like
0Likes
Like

Posted 04 March 2009 - 08:08 AM

"but also the fact that c# is bound to windows"

That is not a fact, http://mono-project.com/Main_Page

Edit:
there is also
http://code.google.com/p/monoxna/
which would take xna code and allow it to be used on other platforms. Though I am not sure how far along it is. The last update was February 21st.

#19 swiftcoder   Senior Moderators   -  Reputation: 9739

Like
0Likes
Like

Posted 04 March 2009 - 08:12 AM

Quote:
Original post by Bru
i doubt c# will replace c++ as the main gaming language, its not all about speed but also the fact that c# is bound to windows
C# hasn't been bound to windows for a long time now - I occasionally use Mono on the Mac.
Quote:
and the worst : you can decompile c# applications into their source code, and that's something you don't want.
This is one of those myths you see thrown around regularly, which has no factual basis whatsoever: any language can be decompiled, and a decent programmer can read raw assembly code without much trouble. If your security, etc. relies on obsfucated source code, it is worth exactly zero.

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#20 Josh Petrie   Moderators   -  Reputation: 3099

Like
1Likes
Like

Posted 04 March 2009 - 08:13 AM

Quote:

i doubt c# will replace c++ as the main gaming language, its not all about speed but also the fact that c# is bound to windows and the worst : you can decompile c# applications into their source code, and that's something you dont want.


Wrong. C# is not "tied to Windows' in any way, shape, or form -- no more than C or C++ are. C#, like C, like C++, is standardized by a third party body (ECMA, in this case). Microsoft has people on the advisory board for the standardization committee, but they do the same for C++ as well. So, that's a wash.

Thus, you have non-Microsoft implementation of the CLR and supporting toolchain for platforms other than Windows (see Mono). Just like C++.

Absolutely nothing about C++ makes it "magically portable" to platforms other than Windows and hardware other than PCs. Somebody has to put the sweat and elbow grease into porting the infrastructure. C++ only looks more portable because it's been around much longer (especially since it could piggyback on C in its early years). Given a few more years there's no reason C# wouldn't be just as widespread.

As for your decompilation concerns, they are slightly valid. Sure it's less than ideal to be essentially giving away your code, but there are obfuscation programs that can make it a little harder to read, if you care. Theoretically on fixed systems (consoles), one could pre-JIT (like ngen.exe) the CIL to native code, too. Again -- if you care.

Large developers typically have the legal backing required to litigate you into oblivion should you steal their code (remember, just because a thing is possible or easy doesn't make it lawful or morally correct). So that may be less of a concern for them.

And security? Security via obscurity is no security at all. It should be obvious that having the reverse-engineered C# from a tool like Reflector isn't going to be a big deal to hackers who can already crack native programs before they even hit store shelves.

Do some research next time.

Josh Petrie | Core Tools Engineer, 343i | Microsoft C++ MVP





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS