XNA Game Studio / C#

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

wacko
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 12
Joined: Sat Oct 25, 2008 1:36 am

Re: XNA Game Studio / C#

Post by wacko »

GyroVorbis wrote:I'm not interested. Not because of anything against C# or XNA, but because I find myself extremely attracted to the computer science and engineering part of game development. I want to work at a low level, I want to write my own collision algorithms, I want to learn physics to write my own physics libraries. My lust for knowledge is one of the things that has kept me going on ES, and I feel like I would be missing out on my favorite part of the development process with something like XNA.
Nothing in XNA prevents you from doing what you want.... and I think you will find that once that low level stuff is written you hardly ever have to go back to it and you spend a lot of your time in the upper level stuff. I know from the rather large game that I work on, once we had all the physics libs and renderer stuff down we where only going back to only clean up. I would love to be working in C# everyday where I am currently working on in the game and not have to deal with the insanity of c++.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: XNA Game Studio / C#

Post by Falco Girgis »

XNA does prevent me from doing what I want. You're working several levels of abstraction away from any hardware and lots of things that I just find extremely interesting.

Some people enjoy the R&D side of game development. I find screwing around with special assembly opcodes to calculate sin and cos extremely quickly on the Dreamcast's processor just as enjoyable as doing higher level game-related tasks.

I find XNA holding my hand through lots of the process just as much of a turn-off as you when you say that you would rather be working in C# than the "insanity" of C++. It's a matter of taste and opinion--and XNA is not my cup of tea.
internetfx
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 11
Joined: Mon Sep 28, 2009 1:11 am

Re: XNA Game Studio / C#

Post by internetfx »

XNA is unfortunately a framework that has forgotten the reason why the best games are written in C++: performance. But it takes some serious work to become skilled in the language without having it maul you from behind.

Some people don't want the language to manage their memory usage, especially in games, where an unusually large number of objects may be spawned or destroyed in a few frames of play. C# begs you to let it manage your objects and clean up after you. Sometimes it's efficient, and sometimes it's painfully slow.

Admittedly, C# can be used for some pretty amazing things, and delivers on its promises... but if you're an avid C++ programmer, you're going to keep at a safe distance where you're in perfect control.
wacko
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 12
Joined: Sat Oct 25, 2008 1:36 am

Re: XNA Game Studio / C#

Post by wacko »

internetfx wrote:XNA is unfortunately a framework that has forgotten the reason why the best games are written in C++: performance. But it takes some serious work to become skilled in the language without having it maul you from behind.
20 years ago I would have agreed but your telling me that a 3 core PPC system can't handle the small amount of performance loss you get from using XNA ? A co-worker of mine who has been doing graphics programming for the last 15 years, suggested based on tests that the perf loss from writing games in managed code was less than 1% on modern systems.

Also C# allows for you to use non GCed objects, and second on those which can be GCed you can alter the behavior to be more perf aware. I mean if you can provide examples of C# games running on the xbox 360 that are "Painfully Slow" as you would put it, and the code is not crappy to begin with then I will concede your point but the reality is yes managed code is slower but not enough to say OMG I should not use it because I can't write my super efficient collision algorithm. I think people are misinformed about the performance loss when it comes to managed code.

Furthermore if you do not want to write it all in C# you can write parts of it in C++ still and provide a managed interface. This concept that you can't get "LOW LEVEL" is bogus. I am not saying that C# is better than C++ or that you should go out and rewrite your entire game in it but I think if your going to go out there and say all this crap about how its "SLOW" and does not let you have all the control you want, I then must come to the conclusion that you are ill-informed about managed code and how they work.
User avatar
hurstshifter
ES Beta Backer
ES Beta Backer
Posts: 713
Joined: Mon Jun 08, 2009 8:33 pm
Favorite Gaming Platforms: SNES
Programming Language of Choice: C/++
Location: Boston, MA
Contact:

Re: XNA Game Studio / C#

Post by hurstshifter »

wacko wrote: A co-worker of mine who has been doing graphics programming for the last 15 years, suggested based on tests that the perf loss from writing games in managed code was less than 1% on modern systems.

I would like to see the analysis that fathered these results. It seems to me that your argument of managed C# code being barely any slower than unmanaged C/++ code is just pointless without any concrete evidence of your findings. Your point may be extremely valid, but it's not worth arguing without the data to back it up. Also, I don't really think that Falco's #1 priority when using C++ instead of C# is performance. He has a thirst for knowledge that simply can't be satisfied by the higher level schemes of C#.Net. If he had to choose between using a pre-defined multiplication operator or writing his own entirely in binary, he would probably choose the latter. He's like the goddamn MacGyver of C/++.
Last edited by hurstshifter on Tue Sep 29, 2009 10:23 pm, edited 1 time in total.
"Time is an illusion. Lunchtime, doubly so."
http://www.thenerdnight.com
internetfx
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 11
Joined: Mon Sep 28, 2009 1:11 am

Re: XNA Game Studio / C#

Post by internetfx »

hurstshifter wrote:
wacko wrote: A co-worker of mine who has been doing graphics programming for the last 15 years, suggested based on tests that the perf loss from writing games in managed code was less than 1% on modern systems.
I would like to see the analysis that fathered these results. It seems to me that your argument of managed C# code being barely any slower than unmanaged C/++ code is just pointless without any concrete evidence of your findings. Your point may be extremely valid, but it's not worth arguing without the data to back it up. Also, I don't really think that Falco's #1 priority when using C++ instead of C# is performance. He has a thirst for knowledge that simply can't be satisfied by the higher level schemes of C#.Net. If he had to choose between using a pre-defined multiplication operator or writing his own entirely in binary, he would probably choose the latter. He's like the goddamn MacGyver of C/++.
Gah! You misquoted wacko's statement as mine (internetfx)!

I agree with you. It's not simply a defined percentage -- the amount of your process that deals with management. Certainly a modern system does not shrink the percentage just because it's modern. The issue is that depending on your program, management may be miniscule or it may be debilitating. Memory management, in particular allocation and deallocation, is one of the slower functions of a program. You can't brush it off as some tiny thing that happens every once in a while and assign it a percentage.

I don't disagree with most of wacko's statements either, as I think he's arguing a point that I didn't make. C# is fine; I don't think I said that it was crap or that you could NOT do low level coding, or implied in any way that people should never use it. After all, I could make the same argument against the Standard Template Library's hidden management, right? C# simplifies C++, which is good for most people. It's not a drop-in replacement for C++ for everything, though, or C++ would go away. It's quite a bit different. I don't like some of the syntax. You can't overload the new operator.

Anyway, we're all going to be saying "C++0x" soon, right?

My frustration is that XNA has left C++ out to dry, when it's the most common language to code games in.
User avatar
captjack
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 50
Joined: Fri Sep 18, 2009 4:23 pm
Current Project: engine framework
Favorite Gaming Platforms: PC, XBox 360, PS3
Programming Language of Choice: C, C++
Location: Northern Virginia

Re: XNA Game Studio / C#

Post by captjack »

Perhaps this isn't germane to the discussion, but I feel the reason software today sucks is lack of fundamental training in software engineering principles.

Who said, "I don't have to worry about garbage collection because my language does it for me"?

Well, I don't have to worry about garbage collection because I remember to free() when I'm supposed to. I call delete() when required. I don't need the language to do it for me - I understand that it's my responsibility. C/C++ are excellent choices of programming languages for the programmer who wants to be empowered to do great things.

C/C++ code does what I tell it to do (whether by design or in error). If I want to traipse off the end of an array, it allows me to do so without complaint. But I'd better know what I'm doing. It lets me shoot myself in the foot if I choose to do so (whether by design or in error). I don't want my language treating me like an uneducated fop and protecting me from myself.

It was said that today's processors are so wicked fast, why worry about performance loss with C#/.NET/etc? Why worry, because I care about performance. I don't want my game to say, "Requires a 9 Yotaahertz processor with similar amounts of uber-scandalous RAM" all because I can't write proper code. Young programmers today (and I do not heap all of them in this comparison) have no respect for the absolute necessity of writing good, solid, clean, organized, optimized code. Why is it that so many great, venerable, iconic, and revolutionary games written in the 80s were so damn tiny? Because those programmers knew how to code for 64K of RAM and kick ass doing so. I fear for those out there that believe massive bubble wrap such as XNA and C# will save us.

Even games so mega-awesome like "World of Goo", DDO, and WoW were written in C++. Most games are written in C/C++. Most game developers use one (or both) of those languages. We live and breath code, we thrive in chaos of the code. We love to "make it work". We want to suck the marrow out of life. As GyroVorbis said, we like to get into the mechanics - the nitty gritty details - the deep understanding that comes from working into the wee hours to get that collision detection working. It's called, in some circles, learning. We want the knowledge that comes from building it ourselves. We liked tinker toys in our childhood. Tinker toys got us to think. But some people like to be babied in their programming. As children they were drooling while gazing blankly at their peers who engineered massive tinker toy constructs.

<asbestos_underpants>
XNA programmers continue to stare blankly at the walls. XNA programmers still masturbate to the Sears catalog.
</asbestos_underpants>

The Unreal Engine is C++, Quake 3 is C. God was written in C. Adam was written in C++ since Eve inherited from him.

Crap. Time to go home. It's five o'clock somewhere.

-capt jack
User avatar
trufun202
Game Developer
Game Developer
Posts: 1105
Joined: Sun Sep 21, 2008 12:27 am
Location: Dallas, TX
Contact:

Re: XNA Game Studio / C#

Post by trufun202 »

captjack wrote: <asbestos_underpants>
XNA programmers continue to stare blankly at the walls. XNA programmers still masturbate to the Sears catalog.
</asbestos_underpants>
Hell yeah, who hasn't masturbated to the Sears catalog!? There's no shame in my game! :lol:

I'm an XNA programmer, but I don't develop game exclusively for XNA... My Golvellius game is written in C++, but my two most recent games are written in XNA.

I picked up XNA for a few reasons:

1. Sheer curiosity - why not? It's yet another game development framework I can add to my repertoire.

2. I'm a .NET Software Engineer and I code in C# all day, every day. Expanding my knowledge of .NET capabilities can only help my career.

3. I really wanted to release a console game. It's just something cool to tell the grandkids one day, ya know? With XNA I can create a PC and Xbox 360 build from the same codebase.

But who knows...maybe XNA is opening the doors for some wanna-be developers and introducing them to the world of game development. Perhaps XNA's ease of use will encourage them to further their learnings and move onto something more "hardcore" - like C++ / OpenGL.
-Chris

YouTube | Twitter | Rad Raygun

“REAL ARTISTS SHIP” - Steve Jobs
User avatar
captjack
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 50
Joined: Fri Sep 18, 2009 4:23 pm
Current Project: engine framework
Favorite Gaming Platforms: PC, XBox 360, PS3
Programming Language of Choice: C, C++
Location: Northern Virginia

Re: XNA Game Studio / C#

Post by captjack »

trufun202 wrote:
captjack wrote: <asbestos_underpants>
XNA programmers continue to stare blankly at the walls. XNA programmers still masturbate to the Sears catalog.
</asbestos_underpants>
Hell yeah, who hasn't masturbated to the Sears catalog!? There's no shame in my game! :lol:
Thank you for seeing the tongue-in-cheek tone of my posting! :)
trufun202 wrote: I'm an XNA programmer, but I don't develop game exclusively for XNA... My Golvellius game is written in C++, but my two most recent games are written in XNA.

I picked up XNA for a few reasons:

1. Sheer curiosity - why not? It's yet another game development framework I can add to my repertoire.

2. I'm a .NET Software Engineer and I code in C# all day, every day. Expanding my knowledge of .NET capabilities can only help my career.

3. I really wanted to release a console game. It's just something cool to tell the grandkids one day, ya know? With XNA I can create a PC and Xbox 360 build from the same codebase.

But who knows...maybe XNA is opening the doors for some wanna-be developers and introducing them to the world of game development. Perhaps XNA's ease of use will encourage them to further their learnings and move onto something more "hardcore" - like C++ / OpenGL.
To point one: I'm an old fart. I can't justify the time to learn the nuances of C#/XNA over what I'm already able to accomplish using C or C++. Over the years I picked up BASIC, assembly (on the 6502 and Z80), Logo, and Pascal all before C and C++ were readily available to me. By the time I them up (along with bash, Perl, and SQL) I just grew tired of learning YAL. Power to youth I suppose. ;)

Point two: .NET follows the same argument as point one. Too old to pick it up. I did the MFC thing, and still do fart around in .NET, but if C# becomes the requirement of the day to do Windows programming, I'm back to UNIX.

and Point three: If you want to develop for Xbox, I think you're stuck with XNA unless you work for a commercial outfit that can get access to the holy grail of XBox SDKs. That thing let's you do C++ natively w/o XNA, if memory serves. But little old me don't have that kind of clout.

But I still hold firm on my belief that things like Java and C# (and their associated development interfaces/libraries/etc) make for sloppy programming or, at the very least, sloppy habits. I simply enjoy the power C/C++ affords me. Now, having spouted all my religious views, I give credit where it's due. A kick ass game in XNA is still a kick ass game - no matter its pedigree. If it's a blast to play (and plays well) then I'm spared the horrors of potentially god-awful code. :twisted:

-capt jack


EDIT: BTW, your avatar, Trufun, cracks me up - even if it does conjur up images of that video (ew!)
vargonian
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 60
Joined: Fri Aug 07, 2009 3:34 pm

Re: XNA Game Studio / C#

Post by vargonian »

I had all the same opinions about C# when I was a C++ programmer (and game developer). (I coded exclusively in C++ for a decade both professionally and as a hobby, so I definitely appreciate it.) I thought: "C# is just like Java, it's gonna be slow like Java, it dumbs everything down and tries to protect me from myself, it's platform-dependent" etc. I think that a giant reason that C# has relatively weak adoption is just constant reinforcement of public misconceptions. In fact, it took Charles Petzold's (the Windows programming guru) strong endorsement of C# to finally get me to take a look at it. And wow, I was glad I did.

Don't get me wrong; if you're a low-level coding junkie who likes to mess with assembly and squeeze every last bit of performance out of anything just for the sheer exercise of it, C# probably isn't for you. But to address some of the issues:

1. Speed: Seriously, for virtually anything you're going to write (including games), it's more than sufficient and you won't notice any difference. And the 1% perf difference I believe was observed when porting C++ games to C#/Managed DirectX a few years ago. Whatever it's doing behind the scenes to translate IL into machine language, it's doing very efficiently.

2. Platform dependence: This isn't true, despite the fact that in practice it's a Windows-dominated platform. There's nothing preventing CLR implementations on any platform, and Mono has shown to be a respectable implementation on Linux. But okay, let's be realistic: if you want a multi-platform app, your life will be much more difficult in C#. Agreed.

3. It's not just "Microsoft's Java". C# is a modern language that was developed intentionally and purposefully to address a whole host of issues that prior languages (including Java and C#) faced. When you're writing in C# after switching from another once of these languages, you'll find that you'll frequently be thankful for the way that it simplifies an annoyance that was really frustrating in a previous language. This is by design.

4. "C# hides programmers from good software development practices/encourages bad code/etc." - Not true at all with the caveat that some of Visual Studio's design tools (namely, the Windows Forms designer) do in fact lead newbie programmers down a path of bad code design (specifically, mixing presentation and business logic). C# doesn't magically make a coder any more prone to bad practices than they would be if they started fresh with C++; the problems they have to deal with are just at a higher level. Rather than stressing out about some allocation that possibly didn't get freed, or writing over the bounds of an array or not properly null-terminating some string, a C# programmer has to worry about code cohesion, decoupling, separation of concerns, separating presentation from business logic, separating interface from implementation, standard design patterns, and everything else a usual software developer worries about. I would argue that C# makes it easier to write good code (though anyone can butcher it) by enforcing actual OOP, rather than pseudo-OOP. There are no globals in C#; no floating methods without an associated class. This annoys duct tape programmers at first (and yes it annoyed me a bit too), but you quickly realize why, and the solution is much more elegant and less hacky.

Anyway, I could go on but I'll spare you for now. I still have incredible respect for C++ as a language and I would gladly use it when it's justified, but that's just rarely the case anymore. I hope that my opinion carries at least a little bit of weight given that I was exclusive in C++ for a decade (including shipping 12 game titles), and have been a C# developer for the past 6 years or so.

It will take some time for XNA Game Studio to prove its worth, but hopefully some of the upcoming games like Dust: An Elysian Tail and Shank will be a nice demonstration of its first-class citizenship.
Image
Post Reply