Chapter 8: Post-Screen Shaders and the Rocket Commander Game


Overview

Well, it was fun to write the graphics engine the last couple of chapters, but where is the next game? Don’t worry, now you get to a really cool game: Rocket Commander. The original version was released in March 2006 at the time the German www.Coding4Fun.de site went offline and Visual Studio 2005 came out in Germany. One month and many thousand played games later, the English Rocket Commander Tutorial Videos were created and two additional mods were released with it. Half a year later, 100,000 games were played online; even more if people were playing offline. Many other mods were also created and the engine proved to be reliable enough, even for two commercial games that were released with the Rocket Commander engine: Pizza Commander and Rocket Racer.

The Rocket Commander game and the complete source code are free to download and you are encouraged to play around with it or even use it to create your own games. I received many nice stories via email of people learning C# for the first time, and they were able to create their own engines and games in a short time thanks to the Rocket Commander and the video tutorials on the German and English Coding4Fun sites.

Let’s just say the Rocket Commander game was a success. I didn’t get rich or anything, just famous. In December 2006 the final version the of XNA Framework and XNA Game Studio Express were finally released and I was working hard on the release of Rocket Commander XNA, a complete port of the Rocket Commander engine to XNA to make it possible to play the Rocket Commander game on the Xbox 360. The performance of the XNA port is great; it runs even better than the old version and the game has no problems with thousands of asteroids rendered at the highest detail level with anti-aliasing in the highest HDTV resolution (1920×1080, I wish I had such a monitor or TV) on the Xbox 360. One major improvement of the new version is the support for multiple cores, which is both important for the Xbox 360 and today’s PCs. The game now calculates all the physics, collision testing, and other game data in an extra thread that is executed on another CPU core (if available like on the Xbox 360) than the rendering thread, which is always busy pushing data to the GPU.

Before you get into the Rocket Commander game you are going to learn all about post-screen shaders first, which is also a major part of Rocket Commander in addition to the powerful rendering engine and the physics. For more information about physics please read Chapter 13. Most information about the shaders for the 3D objects were already discussed in the previous chapters and if you are interested in the game logic, take a look at the source code or watch the Rocket Commander Video Tutorials.

For the rest of the book you will of course still use the XnaGraphicEngine, but any improvements like the heavily optimized render system in Rocket Commander XNA or the physics system can still be used for future projects. Most importantly for the look of all upcoming games, including Rocket Commander, will be the many pre- and post-screen shaders that are introduced in this chapter. Pre-screen shaders are executed before the 3D scene is rendered and allow you to render textures, sky cubes, and other effects in the background. Writing such a shader is quite easy.

Post-screen shaders, on the other hand, are much more complex and they are executed at the very end of the frame rendering process. They take the fully rendered scene as a texture on a render target and modify it in several steps to output the post-screen shader result on the screen, which the user then finally sees. Getting this render target right is not a piece of cake, but once you’ve got the system up you can easily plug in more post-screen shaders and play around with effects. Don’t overuse bloom and motion blur effects; it is cool to use those kinds of shader effects, but overusing them will not make your game better. Try also to make sure that the post-screen shaders run as fast as possible because they can heavily reduce performance on high resolutions, especially if you have five or more passes and modify every single pixel on the screen.




Professional XNA Game Programming
Professional XNA Programming: Building Games for Xbox 360 and Windows with XNA Game Studio 2.0
ISBN: 0470261285
EAN: 2147483647
Year: 2007
Pages: 138

Similar book on Amazon
XNA Game Studio 4.0 Programming: Developing for Windows Phone 7 and Xbox 360 (Developer's Library)
XNA Game Studio 4.0 Programming: Developing for Windows Phone 7 and Xbox 360 (Developer's Library)
Learning XNA 3.0: XNA 3.0 Game Development for the PC, Xbox 360, and Zune
Learning XNA 3.0: XNA 3.0 Game Development for the PC, Xbox 360, and Zune
Beginning XNA 2.0 Game Programming: From Novice to Professional (Expert's Voice in Game Programming)
Beginning XNA 2.0 Game Programming: From Novice to Professional (Expert's Voice in Game Programming)
Microsoftu00ae XNAu00ae Game Studio 3.0: Learn Programming Now! (Pro - Developer)
Microsoftu00ae XNAu00ae Game Studio 3.0: Learn Programming Now! (Pro - Developer)

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net