DeltaEngine

RocketCommander

RocketCommander

RocketCommander Gallery

RocketCommander Video

RocketCommander Tutorials

NOTE 2010-01-14:
These tutorial videos were hosted before on MSDN and Coding4Fun, but since their video links do not work anymore, I host them here too.
This is just to make sure the internet users can find these videos somewhere :)
Note that the MSDN article is still online (but it has changed the address several times), just the video links to not work anymore.

NOTE: All the following text is from 2005, some links or information might be outdated!



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 www.RocketCommander.com and download the game there (10 MB).

You can also take a quick look at the SourceCode (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 guys starting in game development you can check out the forum at exDream.com.


Content


Basic knowledge
Installation
Class overview
Tutorials
Links
About me


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 pratical 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 planing. 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 2 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 enough comments in the code and often there are no tutorials for them. Sadly many of these projects are canceled or are not continued anymore. It can be interessting to look at open source projects, but for beginners this is often very confusing and not helpful. This tutorials tries to fit in between and will give you both a big project with source code and hopefully an easy way in.


Installation


Okay, lets go. 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 Studio 2005 c# Express. It is not as powerful and you can't use any addins, 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 Studio 2005 c# 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 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 2 tutorials I will go into details what this is all about and give you some examples. Warum eigentlich? Rocket Commander ist auf Unit Tests aufgebaut und benutzt die Agile Methology. You will learn more about this in the first couple of tutorials. 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 still 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


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 does also explain 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 3. tutorial we take a look at the helper classes (click on ClassOverview, they are on the right side). In the 4. tutorial we will write our own graphic engine in less than 30 minutes. This will help you 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



  • 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.
    Watch Video Tutorial 1
    Links:


  • Video Tutorial 1


  • 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.
    Watch Video Tutorial 2
    Links:


  • Video Tutorial 2


  • 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.
    Watch Video Tutorial 3
    Links:


  • Video Tutorial 3


  • 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 to render models in 3d?
    • How can I display text on the screen?
    Watch Video Tutorial 4

    Links:


  • Video Tutorial 4


  • 5. Music+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.
    Watch Video Tutorial 5
    Links:


  • Video Tutorial 5


  • 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.
    Watch Video Tutorial 6
    Links:


  • Video Tutorial 6


  • 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.
    Watch Video Tutorial 7

    Links:


  • Video Tutorial 7


  • 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 analyse the shader classes in the engine and test these.
    Watch Video Tutorial 8
    Links:


  • Video Tutorial 8


  • 9. Input+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.
    Watch Video Tutorial 9
    Links:


  • Video Tutorial 9


  • 10. Game logic: We have now all our basic elements for our game engine and can finally implement some game logic. 80% 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 3-4 textures and 1 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.
    Watch Video Tutorial 10


    Links:


  • Video Tutorial 10


    Conclusion: Game consists now 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 interessting 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:


    About me


    Benjamin Nitschke

    I work at exDream entertainment (the creators of "Arena Wars", the first commertial .NET game).
    Currently I'm working on "Armies of Steel", a new innovative Real Time Strategy game.
    My Blog: http://abi.exDream.com

    © 2000-2010 exDream GmbH & MobileBits GmbH. All rights reserved. Legal/Impressum