XNA - NeHe Style (Projects 1 - 10) Source Code

Started by
28 comments, last by EnigmaticCoder 16 years, 6 months ago
Project 5 Completed!

I've implemented the fifth NeHe tutorial in XNA. The project and related files are located here.

Features:
- Backface Culling has been re-enabled
- The triangle and square Triangle Strips have been replaced with Pyramid and Cube Triangle Lists
- The cube rotates on all 3 axes to make more sides visible

Anyone interested in downloading the zip file, checking out the code, running the program etc...are encouraged. Please provide feedback about coding style, implementation details, etc...

Updates/Errata
9/20/2007, 2:00pm PT
Uploaded new source which corrected a problem with resources not being correctly restored when a device was lost.



[Edited by - JWalsh on September 20, 2007 3:04:54 PM]
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Advertisement
Two things:
1) I thought the general consensus here was that NeHe is bad for you.
2) Would it be too blasphemous a request to ask that these lessons be posted on NeHe's site...?

Last thing: Great f#$$ing job!!

Beginner in Game Development?  Read here. And read here.

 

Quote:Original post by Alpha_ProgDes
1) I thought the general consensus here was that NeHe is bad for you.


I always thought that NeHe's implementation was bad for you, in principle there's nothing wrong with it (except, perhaps, in creating more copy & paste beginners).
Project 6 Completed!

I've implemented the sixth NeHe tutorial in XNA. The project and related files are located here.

Features:
- Pyramid and Cube are now rendered with a texture map
- Pyramid and Cube no longer have vertex colors
- Fixed a bug causing resources to not be re-allocated on device lost (previous source code has been updated)

Anyone interested in downloading the zip file, checking out the code, running the program etc...are encouraged. Please provide feedback about coding style, implementation details, etc...



[Edited by - JWalsh on September 20, 2007 3:30:43 PM]
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Project 7 Completed!

I've implemented the seventh NeHe tutorial in XNA. The project and related files are located here.

Features:
- Pyramid was removed, cube is now transformed to the center of the screen
- Cube is textured with a Crate texture using the Mipmapped Texture Importer
- "F" key toggles 3 different filtering modes: None, Linear, and Linear Mipmapped
- "L" key toggles on/off lighting
- "Up", "Down", "Left" and "Right" modifies rotation speed about local X and Y Axes
- "PageUp" and "PageDown" translates the cube in/out of the screen
- Fixed a bug causing previous key state not to be cached for later comparison

Anyone interested in downloading the zip file, checking out the code, running the program etc...are encouraged. Please provide feedback about coding style, implementation details, etc...

Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Project 8 Completed!

I've implemented the eighth NeHe tutorial in XNA. The project and related files are located here.

Features:
- Press "B" to toggle on/off Frame Buffer Alpha Blending
- Fixed a bug causing lighting to be reset if the device was lost

Anyone interested in downloading the zip file, checking out the code, running the program etc...are encouraged. Please provide feedback about coding style, implementation details, etc...

Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
I'm going to be out of town for the weekend, so I wont be able to contribute to the XNA NeHe projects. But please feel free to provide any comments you might have about the source code, style, etc...

If you'd like to see projects completed based around a specific XNA topic, please speak up. I dont need to stick to NeHe's tutorials precisely. This is just a way for me to become familiar with the API, so I'm happy implement stuff beyond the NeHe tutorials.

Cheers!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Checking out some of the projects, I noticed you use the BasicEffect class rather than writing your own (simple) shaders. You could argue that mimicking the fixed pipeline like this is okay for very small demos like this, but since XNA really depends of the use of shaders, I would introduce them even in the early tutorials. Before things get more complicated and the use of shaders can realistically no longer be avoided, at least anyone who has used these projects as a learning tool will hopefully have a basic understanding of HLSL and the programmable pipeline by then.
Nice, I havn't looked at the source yet but I'm sure the projects will look sweet ;)

How about a subdomain like xna.gamedev.net? That way you can create a nehe-like website which, I'm sure, will be very populair.
Quote:Original post by WanMaster
Checking out some of the projects, I noticed you use the BasicEffect class rather than writing your own (simple) shaders. You could argue that mimicking the fixed pipeline like this is okay for very small demos like this, but since XNA really depends of the use of shaders, I would introduce them even in the early tutorials. Before things get more complicated and the use of shaders can realistically no longer be avoided, at least anyone who has used these projects as a learning tool will hopefully have a basic understanding of HLSL and the programmable pipeline by then.


Wan,

Thanks for your suggestion. I'd considered making all of them use HLSL, rather than relying on the built in shader which is part of BasicEffect, however I couldn't justify writing a simple shader for use by all these beginning tutorials when there is a perfectly good one included in XNA.

Also, I wanted to try and fit the XNA implementations as closely as possible with the original OpenGL versions, and you'll note those weren't written in GLSL.

Finally, I follow a strict programming paradigm which is made up of several "rules." One of which is "Code by Necessity." Which simply means, if I dont have a reason to write it, I dont. Writing my own shader for these while a simple task, unnecessarily increases the lines of code, the development time, and the debug and maintenance time. Meanwhile, using the built in shader for the basic effects comes for free.

As soon as shaders are a necessity, they will be used. Even with that, however, I may go back and plug in a basic shader for the earlier projects, just so people can see how a simple shader is implemented.

Thanks again for the suggestion!

Cheers!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

This topic is closed to new replies.

Advertisement