Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Rocket Commander Tutorials

  Welcome to the Tutorials of Rocket Commander. You will learn step by step in ten 30-minute video tutorials how to develop a game like Rocket Commander. This can be your introduction into the world of game development.
Benjamin Nitschke's Blog

Difficulty: Intermediate
Time Required: Greater than 10 hours
Cost: Free
Software: Visual C# Express Edition
Hardware:
Download:

Welcome to the Tutorials of Rocket Commander. You will learn step by step in ten 30-minute video tutorials how to develop a game like Rocket Commander. This can be your introduction into the world of game development. If you just want to play a bit, check out http://www.rocketcommander.com/ and download the game there (10 MB).

You can also take a quick look at the source code (which is freely available like the game) or get an overview about the project by looking at the Class Overview. There are around 20,000 lines of code and maybe 50 classes. Sounds like a big project, doesn't it? But we will take a look at the most important classes and even learn in Tutorial 4 how to write our own graphic engine in less than 30 minutes. If you decide to take a deeper look at the source code after watching the tutorials, it will hopefully help you out understanding a lot of the game mechanics because the source code is heavily commented as it should be in professional projects. If you have more questions, want help or meet with other developers starting in game development, visit the RocketCommander Forums.

Basic Knowledge

This tutorial is targeted to people, who already know how to program in C# and have basic knowledge of Managed DirectX. If you are not experienced with .NET and programming languages like C# or VB.NET please start with more basic tutorials and webcasts first and return to this one later. If you are looking for Managed DirectX tutorials, start with the ones in the DirectX SDK and check out the many free tutorials available in the internet, Coding4Fun is a good starting point. If you want more links check out the Links, webcasts and Tutorials below.

This tutorial tries to give you more practical view on coding and games than many other tutorials, which only show you a couple of tricks in 100-1000 lines of code. You can write down this amount of code without many comments and it can still be followed. But in bigger projects you need much more documentation, comments and planning. If you reach 20,000 lines of code (or 100,000–500,000 lines in bigger projects), you need more structure, a clean programming style, and a constant amount of refactoring. So what is refactoring? You will learn about it along with Unit Testing in the first two tutorials. Refactoring lets you restructure and rewrite your code without changing the functionality to improve maintainability and your coding style, sometimes to improve performance too.

There are many open source projects (even games), but most of these projects lack good documentation, have not enough comments in the code, and often there are no tutorials for them. Sadly, many of these projects are canceled or are discontinued. It can be interesting to look at open source projects, but for beginners this is often very confusing and not helpful. These tutorials try to fit in between and will give you both a big project with source code and hopefully an easy way in.

Installation

Okay, let's begin. The following steps are also explained in detail in the first video tutorial. If you have any difficulties watch it and follow it step by step. First of all, we need Visual Studio 2005! If you don't have Visual Studio 2005 right now and don't have any money to buy the Standard or Professional (or, if you are crazy, rich the Team System version), there is also a free version: Visual C# 2005 Express Edition. It is not as powerful and you can't use any add-ins, but it is good enough for our game. You can also use any other version or IDE that supports .NET 2.0. You can freely download Visual C# 2005 Express here.

First of all, start with installing Visual Studio 2005. If you already have it installed, skip this step.

You should also install the MSDN help. If you don't do this you can still access the help online, but this makes searches take a much longer time.

Next you need the DirectX SDK, which you can directly download from the Microsoft DirectX page: Microsoft DirectX Developer Center

When installing it, you should select installing the Redistributable in the custom setup step too. You will need it if you want to install your game on other computers. When DirectX is installed you can check out the newest features by taking a look at the samples with the DirectX Sample Browser. If you haven't worked much with Managed DirectX before check out the documentation and tutorials.

Last but not least we need NUnit, which you can get from http://www.nunit.org/.

You may ask, "why do I need NUnit?" Well, Rocket Commander is based on Unit Tests and uses the Agile Methology. In the first two tutorials I will go into details of what this is all about and give you some examples. In short this means that we don't fully design everything in advance and do incorrect planning because we can't know better when inventing new stuff. Instead we do a short concept (see Tutorial 2), but we adjust it dynamically as we go along. Unit Tests in our code allow us to make sure everything still runs as expected even if we have to make drastic changes in design. A lot of mini-test-programs inside the code allow us to constantly check features and play around with our engine.

If you are using Visual Studio 2005 Team System you can also use the Unit Testing features implemented directly in VS there. Alternatively there are also other Unit Testing Frameworks around (e.g., MbUnit, csUnit, etc.) and for Visual Studio 2005 Standard and above you can also use TestDriven.NET (a plugin to start Unit Tests from your IDE). For this tutorials we will try to keep things simple and only use very basic features of NUnit.

Class Overview

Click here for larger image

(Click image to zoom)

This is the project overview. It may be a little bit confusing when looking at it for the first time, but later this graphic will help us out understanding the classes and game engine. The program starts with the Program class (upper left) and this is where we start with Tutorial 1 too. The class overview and the Graphic Engine are explained in the following tutorials. You could say that any class that display anything on the screen is derived from IGraphicObject. For the first couple of tutorials we are happy with just the Texture and Model classes. We can do quite a lot with DirectX, but abstracting it a little bit more give us the advantage not having to write the same code over and over again. This is very important for our graphic engine.

The second tutorial also explains the concept of the game. Our understanding of the classes is not very advanced right now, but we take a step back and think about the game itself. In the third tutorial we take a look at the helper classes. In the fourth tutorial we will write our own graphic engine in less than 30 minutes. This will help your understanding the graphic engine a lot faster. In the following tutorials we then go into each part of the game until we have the full game together in the last tutorial and are ready to write our own modification.

The Tutorials

Tutorial #1. How do I setup Visual Studio for our project?

Explains all required steps to install Visual Studio Express and where to get Managed DirectX (Feb06 or better). But not only that, we will also drive deep into the common tools used in game development, including: CodeRush, FxComposer, 3DSMax8, ZBrush, Panda exporter for X-files, Photoshop, Paint.NET. At the end of the tutorial we are going to take a quick look at the project and all classes. Then we write our first unit test to check out some of the cool features in the engine. The unit test is basically a Model Viewer and shows an animated model from the game in space.

Links:

Tutorial #2. Design and Concept:

We are writing the concept for our game. You will see the concept of Rocket Commander before the first line of code was ever written and we go into detail about the concept and classes that were planed back then. We have a lot of great ideas in this phase, but we while this step is very important and projects that don't do any concepts are usually doomed, we still want to start coding and see some cool stuff on the screen. So at the end of this tutorial we write another unit test and render an Asteroid in Space (just 20 lines of code). Then we extend this idea and render a whole field of asteroids until we get a good understanding what classes are required in Rocket Commander to handle all that for us.

Links:

Tutorial #3. Helper classes:

Why do we need them? In this tutorial we learn why it is very useful to write so-called helper classes instead of doing the same thing over and over again. These classes will cut down the amount of code we have to do later by a great extent and will make our project much more manageable and easier to understand. We will take a look at the ElapsedTime, Log, StringHelper, RandomHelper, WindowsHelper, etc. classes. We also write a couple of Unit Tests and see why Test-Driven Development is so useful.

 

Links:

Tutorial #4. Graphic classes:

We learn in just 30 minutes how to write our own 3D Engine with help of Test-Driven Development. We don't just create classes for rendering textures and models, but also for rendering fonts on the screen. For the textures we use DDS-Files and the models use the X-File format from Microsoft. This tutorial answers questions like:

  • How do I render textures directly on screen?
  • How do I render models in 3D?
  • How can I display text on the screen?

Links:

Tutorial #5. Music and Sound:

Introduction to DirectSound and DirectX AudioVideoPlayback classes. These are the base classes for sound (.wav) and music (.mp3) playback. We will also learn in several unit tests how to adjust the volume, stereo balance and the frequency of wav files we play back.

Links:

Tutorial #6. Shader Introduction (TangentVertex class and FxComposer):

In this tutorial we are finally getting to the more interesting parts of Rocket Commander: Shaders. We check out some current games and compare some screenshots of scenes with and without shaders. Then we go into detail why shaders are so important for games in these days. We learn the differences to the Fixed-Function-Pipeline rendering and go depth into shader Development with FxComposer. We are also learning about the base classes in our engine and the used VertexFormat. To make things more clear we create our own shader class and write a simple, but effective SpecularPerPixel shader with Pixel Shader 2.0.

Links:

Tutorial #7. Shaders (Parallax, Instancing):

Now we finally get to the advanced shaders. This tutorial will let us produce very stunning effects. At first we do a comparison of today games again and take a look at the used shader techniques. Then we learn step by step the ParallaxShader used in Rocket Commander. We see both how it was developed in FxComposer and how the class in Rocket Commander works together with the ParallaxShader.fx file. We then write our own unit test and check out the textures for this tutorial in the engine.

Links:

Tutorial #8. Post Screen Shaders:

To make our scene even better looking we apply so called Post screen shaders to our scene. These shaders will manipulate the final image we have rendered on the screen and make everything appear much more consistent. First of all we start with FxComposer again and take a look at existing Post Screen Shaders and then we took a look at the more complex Post Screen Shader in Rocket Commander. We will take a look at Sepia, Sky cube mapping, Bloom, Glow, HDR und Motion Blur effects. Finally we analyze the shader classes in the engine and test these.

Links:

Tutorial #9. Input and Interface:

In this tutorial we will learn how to use the DirectInput classes and how Rocket Commander manages all Keyboard and Mouse input with help of several helper classes. Then we take a quick look at the Menu and User Interface classes in the game. This is usually a lot of work and can't be done in 30 Minutes, but we will see again that using some helper classes will greatly improve our productivity. Also reuse code as much as possible, this does not only make the coding easier, but also gives a more consistent look and feel to the final product. We take a look at the graphics created by the artists and see how we can manipulate and exchange (often called skinning) them, which is important for our next tutorial.

 

Links:

Tutorial #10. Game logic:

We have now all our basic elements for our game engine and can finally implement some game logic. Eighty percent of the tutorials did not really explain much of the game principles in Rocket Commander, but how the engine works. To leverage this knowledge we will learn how to extent the game. As an example we develop Flower Commander, which is a total conversion of Rocket Commander with just few very simple changes in the code.

As you can see on the screenshots the whole game looks much different, even the main menu looks different. All this is done by just exchanging three or four textures and one model (the flower instead of the asteroids). The game principle changes also a little: Instead of evading asteroids, we have to collect flowers now. We are not sitting inside a Rocket anymore, but we are a bee trying to collect honey (sounds crazy, but it is actually fun). Additionally we learn a lot of tricks and tips because the tutorial shows you that creating a mod can cause some problems, and instead of ignoring them we will check out what when wrong and learn how to adjust the game to our needs.

Links:

Conclusion

Our game now consists of: Input, Interface, Game logic, Helpers, Music, Sound, Graphics: Shaders, ParallaxMapping, TangentVertex helper classes, Instancing, Post Screen Shaders, Models, Fonts, Materials, Textures, Lens Flare effects.

More tutorials might be done at a later point in time. Tutorial #10 mentions a couple of interesting topics: More extensibilities, physics, game screens, manager classes, space camera, player and multiplayer capabilities, etc.

Further Links

If you are searching for more .NET or DirectX websites or tutorials, check out the following links:

  • If you don't have much basic knowledge of programming languages and especially .NET, you should start by reading a C# or .NET Book. If you know C++ or Java, you are pretty close to C# and won't have many problems anyway. There are many C# beginner books, just do a search on Amazon.com.
  • The MSDN help system is the biggest and most comprehensive help you can get for .NET and DirectX: MSDN.
  • The help for DirectX can be found here: MSDN Managed DirectX. Important: Don't neglect the DirectX C++ help. Maybe it looks complicated, but there are a lot more samples and documentation, so check it out!
  • There are a lot of webcasts around on MSDN and other sites; for example, Learn to write C# the fun way
  • The book about Managed DirectX by Tom Miller: Managed DirectX 9
  • GameDev.net
  • The Z-Buffer: Managed DirectX Resources
  • Tutorial-Links at Z-Buffer.com

Follow the Discussion

  • ERIC I BELIEVE IN C BY BELL LABRATORIESERIC I BELIEVE IN C BY BELL LABRATORIES

    This really does not explain much in detail.

    To understand what this instructor is doing you would have to be at his level of programming and if that would be the case the user would not be viewing the non-rewindable video.

     However I did get some details on how to use visual studio more in depth and some of his programming tactics.

    It is a good tutorial but I need to know how to create code and the justification of using the specific keywords and their integration in a straight forward manner.

    I really do not like integrating 5 topics at once and from my experience this creates mass confusion amongst beginners and makes them  

    disoriented and not being focused.

    Taking one thing at a time at a slow pace is the only way to learn and remember. It is hard enough to learn the constants that keep changing DO WE CHANGE THE ENGLISH DICTIONARY WORDS TO DESCRIBE DIFFERENT MEANINGS? who knows but hopefully some day If I had a dog I could call it a cat!

  • FranvaFranva

    It's really nice,and this is my first time to touch the game development.

  • golalegolale

    hi

    i have problem with tutrial one

    becuse  some of the file is loss.fore example i cant find texture folder in sorce code and i dont know where is the picture

    please help me!

    thanks

  • Clint RutkasClint I'm a "developer"

    @golale:  He's updated it a few times already, try one of his newer distro's.

    http://exdream.no-ip.info/RocketCommander/downloads.html

  • plaodjplaodj

    haha  so good  I like it very much  thank you

  • CharleyPengCharleyPeng

    I like this program. C# is a good solution to programers but now i'm basically leaning VB6.0 - -|| (that my teacher depends.,but i really hate the old interface.VB2008 is much impressive.) You guys is showing me the confidence of learning Game Programing! I will read the words you gave and the movies seem to be helpful.   I 've downloaded all the required things about this code source. Hope I can deal with it. ^ ^ by the way, I 'm a Chinese with poor English.   Regards.

  • Alcoholic_PenguinAlcoholic_​Penguin

    @golale:  You have to download the compiled version of the game and then install it, then go to the install directory and you will find the lost files.

  • trouwjurktrouwjurk

    Thanks Alcholic Penquin. That helped me to. Funny to find the solution in such an old post!

  • Alexander GegeskiAlexander Gegeski

    Only fantastic.

    I an Brasilian (Brasil).

    I love game.

    Abraços Brasil!!!

  • MoogleMoogle

    I just need it,Thank you very much!

    It let me get statarted to develop game with manged

    code C#.

  • Clint RutkasClint I'm a "developer"

    @Moogle Download links are at the top of the article labeled "Download Code" Smiley

  • Clint RutkasClint I'm a "developer"

    @Chandra, Actively tracking this down.

  • ChandraChandra

    I can't download the videos. Is there's any link I can use?

  • Clint RutkasClint I'm a "developer"

    @Chandra, sadly, I doubt I can get these back.  Had to remove the links.  sorry!

  • Clint RutkasClint I'm a "developer"

    @Peter, couldn't track down where the videos lived so I removed the links.  Did I miss a link?

  • PeterPeter

    VIDEO LINKS ARE DOWN ! PLEASE HELP, NEED THEM. Any other locations for the video files ?

  • jockejocke

    where is the videos Perplexed i'd rly like to check this out?

  • Clint RutkasClint I'm a "developer"

    @jocke, i think the videos are lost.  I couldn't track them down.

  • GtoknuGtoknu

    Haha very cool Big Smile

    I lik'd this game, but C# isn't a little poor? Yeah, I know, is a powerful language, but, you can't handle everything. I think C++ is better =]

    Hugs from São Paulo, Brazil.

    Gustavo Santos, 14 years older

  • Clint RutkasClint I'm a "developer"

    @Gtoknu what can't it handle?  Here is an interesting read, note this is from 2005, I'm betting performance in c# has gotten even better now.  Only reason why his 6th iteration won was since the CLR runtime has to startup!

    http://blogs.msdn.com/ricom/archive/2005/05/19/420158.aspx

    Note he had to:

    •Write his own file/io stuff

    •Write his own string class

    •Write his own allocator

    •Write his own international mapping

    just to get up to par / slightly outperform c# way back during 1.0

    There are perfectly good reasons to use C++, but I'd still like to hear why you think c++ is better.

  • Clint RutkasClint I'm a "developer"

    @alcoholic_penguin the msi's don't have all the required files?

  • Alcoholic_PenguinAlcoholic_​Penguin

    Ha!  I decided to go through these tutorials again after all this time, but I couldn't remember how to find the missing resources needed for tutorial 01, so I had to come back here and look at a response I gave to someone else regarding this problem from two years ago!

    Hey Benjamin, how come the source code never had those resources?

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.