XNA and C# - Too big a bite ?

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
User avatar
t0ne
Baaaaaa!
Baaaaaa!
Posts: 3134
Joined: Wed Sep 11, 2002 8:48 am 0
Location: Bristol

XNA and C# - Too big a bite ?

Post by t0ne »

I'm just starting to teach myself C# and am looking for a project to get my teeth into. I've got a few game ideas floating about, so would I be mad to try to get to grips with XNA and C# at the same time ?
I should add that I'm a glorified code monkey for a living (C/C++/Java) and usually pick up things pretty quick. Although, I've done tons of Windows code I've little experience of DirectX, most of my game tinkerings have been with OpenGL upto now (although I'm not sure that's relevant ?).

Opinions please from those who've tried :D
User avatar
fred_zen
Baaaa!
Baaaa!
Posts: 743
Joined: Mon Jun 26, 2006 3:15 pm 0
Location: France

Post by fred_zen »

Nah, you'll be fine, if you already know C++ and Java learning C# will be a breeze :-) so you've really only got XNA to learn

(And XNA is said to be friendlier than DirectX, but I haven't tried XNA myself)
User avatar
Mark
Baaaaaa!
Baaaaaa!
Posts: 3611
Joined: Mon Apr 22, 2002 7:53 pm 0
Location: England

Post by Mark »

If you know C++ already you shouldn't have any trouble at all.

The main thing you'll need to learn are the differences between C++ and C#, and they're pretty straightforward.

The real benefit though is the ease of getting game assets up and running with XNA. It's incredibly simple. I spent ages in C++ building a 3D game engine from a book, and writing a model format, and incorporating OpenAL, and failing to work up the chutzpah to ever tackle DirectInput properly. Within a couple of days of first using XNA I had a very rough 3D game, with both keyboard and gamepad input (with rumble on the pad) and a few sound effects. Things like fogging, which I wouldn't even know where to start in my old engine, I got working just by rooting around with the Intellisense system. It took 2 minutes from finding the function, to having a sickly purple haze enveloping the horizon. I didn't even want fog at the time, I just added it because I'd stumbled upon the functions.

It was quite galling really. I've got several nice-looking but unfinished projects written in C++, my own 3d model format, and some nice engine routines that are the results of a good few years work on and off, and I don't ever want to go near most of the stuff again because XNA is so much easier to use.
User avatar
t0ne
Baaaaaa!
Baaaaaa!
Posts: 3134
Joined: Wed Sep 11, 2002 8:48 am 0
Location: Bristol

Post by t0ne »

Mark wrote:If you know C++ already you shouldn't have any trouble at all.

The main thing you'll need to learn are the differences between C++ and C#, and they're pretty straightforward.

The real benefit though is the ease of getting game assets up and running with XNA. It's incredibly simple. I spent ages in C++ building a 3D game engine from a book, and writing a model format, and incorporating OpenAL, and failing to work up the chutzpah to ever tackle DirectInput properly. Within a couple of days of first using XNA I had a very rough 3D game, with both keyboard and gamepad input (with rumble on the pad) and a few sound effects. Things like fogging, which I wouldn't even know where to start in my old engine, I got working just by rooting around with the Intellisense system. It took 2 minutes from finding the function, to having a sickly purple haze enveloping the horizon. I didn't even want fog at the time, I just added it because I'd stumbled upon the functions.

It was quite galling really. I've got several nice-looking but unfinished projects written in C++, my own 3d model format, and some nice engine routines that are the results of a good few years work on and off, and I don't ever want to go near most of the stuff again because XNA is so much easier to use.
Just what I wanted to hear :D. I've done similarly in the past and just can't face doing it again. I've been using blitzmax recently for my tinkerings but this looks like a better idea even if I don't currently have a 360.
I take it the performance is good as I assume a lot of this is just a friendly veneer over native code ?
User avatar
PaulCunningham
Baaaaa!
Baaaaa!
Posts: 1218
Joined: Sun Jan 18, 2004 11:47 pm 0
Location: Walsall, England
Contact:

Post by PaulCunningham »

Go for it - It's really, really easy to get stuff up and running with XNA. I'm from an OpenGL background too and the Shader stuff was all new but you don't have to touch it directly if you just want to do simple (2d sprite based) stuff as they've handily created a BasicEffect class to hide it all.

The major difference you'll face coming from C++ is the value / reference datatypes and the GC. Reference types create garbage, value types (structs, most builts in types, enum) don't. The CLR profiler will tell you if you're creating too much.

My advice is jump right in and get coding. There are loads of samples already; even Rare have released some. And see the Benjamin Nitschke stuff (XNA Racer, Rocket Commander) at http://abi.exdream.com/

The main site for XNA is here...
http://creators.xna.com/

Good luck
Cheers,
Paul Cunningham
Pumpkin Games
User avatar
Oaf
Baaaaa!
Baaaaa!
Posts: 1688
Joined: Mon Nov 11, 2002 1:14 pm 0
Location: Dark Hedges
Contact:

Post by Oaf »

Another vote for "just go for it!" :)

The IDE's great, there's plenty of reference and it's dead easy to get something up and running in a short space of time.
User avatar
Mark
Baaaaaa!
Baaaaaa!
Posts: 3611
Joined: Mon Apr 22, 2002 7:53 pm 0
Location: England

Post by Mark »

Performance-wise I haven't got any complaints so far - although most of the meshes I've been using are place-holder. I'd guess I've had a scene with approaching 100, 000 polygons in it without troubling it (but that's nothing these days).

A better indicator though is probably the Racing Games starter kit that you can get from the creators club site Paul linked to.

Here's a video of it in action:

http://www.youtube.com/watch?v=TgChURF5fQE
User avatar
PaulCunningham
Baaaaa!
Baaaaa!
Posts: 1218
Joined: Sun Jan 18, 2004 11:47 pm 0
Location: Walsall, England
Contact:

Post by PaulCunningham »

Yeah the racing game is ace - here's the web site:

http://XnaRacingGame.com

30 frames per second, 1080p (i think) post screen shaders, cross platform - lovely :)

I will counter all this enthusiasm with a couple of negatives.

Game content tends to be way bigger than it needs to be mostly due to the need to use wavs for all sound data. Probably not such a big deal with broadband.

You can share your games on Windows no probs but to simply just play XNA games on the 360 requires a Creator Club membership ($99 per year).

Your minimum spec GFX card need to support at least Shader Model 1.1.

But none of the above are real showstoppers IMHO.

(PS - the MONO project are supporting XNA too)
Cheers,
Paul Cunningham
Pumpkin Games
User avatar
Muttley
Sheepie Whore
Sheepie Whore
Posts: 13169
Joined: Thu Apr 25, 2002 12:30 pm 0
XBL Gamertag: Mu77ley
Location: In a maze of twisty passages, all alike.
Contact:

Post by Muttley »

Is there a decent dummy's introduction to C# anywhere, for someone who's only really dabbled in C/C++?
Muttley's Blog: Rarely updated, occasionally interesting… maybe
RetroRemakes Framework: Open Source BlitzMax Game Framework
MuttMod: My Open Source BlitzMax Modules
User avatar
DeanoC
Baaa!
Baaa!
Posts: 318
Joined: Sat Feb 01, 2003 1:07 pm 0
Location: Going South
Contact:

Post by DeanoC »

XNA is fairly easy, and its a lovely IDE which really helps.

Go for it!! Theres enough of us on here to ask questions of, if you get stuck.

Deano
User avatar
PaulCunningham
Baaaaa!
Baaaaa!
Posts: 1218
Joined: Sun Jan 18, 2004 11:47 pm 0
Location: Walsall, England
Contact:

Post by PaulCunningham »

Muttley wrote:Is there a decent dummy's introduction to C# anywhere, for someone who's only really dabbled in C/C++?
I'd probably start here: http://msdn2.microsoft.com/en-us/vcsharp/aa336766.aspx

not sure it's for 'dummies' but here's Hello World.

http://msdn2.microsoft.com/en-us/librar ... S.71).aspx
Cheers,
Paul Cunningham
Pumpkin Games
User avatar
t0ne
Baaaaaa!
Baaaaaa!
Posts: 3134
Joined: Wed Sep 11, 2002 8:48 am 0
Location: Bristol

Post by t0ne »

Thanks for all the words of encouragement, I'll give it a shot. Looking at the XNA framework and demos has got me quite excited about coding something at home again :D

Muttley, I'm starting to work my way through "Essential C# 2.0" by Mark Michaelis, which was recommended to me from a couple of different sources. From what I've seen so far it's pretty good, and highlights similarities or differences between C++, Java and VB where appropriate.
User avatar
t0ne
Baaaaaa!
Baaaaaa!
Posts: 3134
Joined: Wed Sep 11, 2002 8:48 am 0
Location: Bristol

Post by t0ne »

PaulCunningham wrote:Yeah the racing game is ace - here's the web site:

http://XnaRacingGame.com

30 frames per second, 1080p (i think) post screen shaders, cross platform - lovely :)

I will counter all this enthusiasm with a couple of negatives.

Game content tends to be way bigger than it needs to be mostly due to the need to use wavs for all sound data. Probably not such a big deal with broadband.

You can share your games on Windows no probs but to simply just play XNA games on the 360 requires a Creator Club membership ($99 per year).

Your minimum spec GFX card need to support at least Shader Model 1.1.

But none of the above are real showstoppers IMHO.

(PS - the MONO project are supporting XNA too)
Yes, I found a series of videos on YouTube of an interview with the XNA development manager Frank Savage http://www.youtube.com/watch?v=I4lzFcL4I6I. He has the racing game is running 30fps @ 1080p on the 360.
I downloaded the Racing Game project template earlier and it's running (in debug mode I hasten to add) at 60 - 100fps on my PC @ 1680 x 1050. Pretty damn impressive if you ask me.
Frank Savage was saying a shader model 1.1 card is a GeForce 3 and this thing can scale back to 640x480 if it needs to so older hardware should cope.
User avatar
PaulCunningham
Baaaaa!
Baaaaa!
Posts: 1218
Joined: Sun Jan 18, 2004 11:47 pm 0
Location: Walsall, England
Contact:

Post by PaulCunningham »

t0ne wrote: Frank Savage was saying a shader model 1.1 card is a GeForce 3 and this thing can scale back to 640x480 if it needs to so older hardware should cope.
Isn't that a mistake?
MSDN - XNA Framework and XNA Game Studio Express wrote: Q: Are there any prerequisites to run XNA Game Studio Express?
A: Yes. You must download and install Visual C# Express and the latest DirectX runtime updates (the full DirectX SDK is not required). Also, you need a Direct3D 9.0 video card capable of supporting at least Shader Model 1.1. Our recommendation is that your graphics card supports Shader Model 2.0 since many samples and starter kits require it. Check your graphics card manufacturer’s website for more information about your specific graphics card.
Cheers,
Paul Cunningham
Pumpkin Games
User avatar
t0ne
Baaaaaa!
Baaaaaa!
Posts: 3134
Joined: Wed Sep 11, 2002 8:48 am 0
Location: Bristol

Post by t0ne »

PaulCunningham wrote:
t0ne wrote: Frank Savage was saying a shader model 1.1 card is a GeForce 3 and this thing can scale back to 640x480 if it needs to so older hardware should cope.
Isn't that a mistake?
MSDN - XNA Framework and XNA Game Studio Express wrote: Q: Are there any prerequisites to run XNA Game Studio Express?
A: Yes. You must download and install Visual C# Express and the latest DirectX runtime updates (the full DirectX SDK is not required). Also, you need a Direct3D 9.0 video card capable of supporting at least Shader Model 1.1. Our recommendation is that your graphics card supports Shader Model 2.0 since many samples and starter kits require it. Check your graphics card manufacturer’s website for more information about your specific graphics card.
Hmmmm... yea, I was a little surprised when he said GeForce 3 and I'd forgotten the Direct X 9 requirement (I better go listen to it again in case I got it wrong) :?

EDIT: http://www.youtube.com/watch?v=87ZBU88xBE8 around the 05:20 mark, I'm not going mad, he does say you could run the game on a GF3 etc.
Post Reply