ThePentiumGuy
Senior Contributor
I will be making a set of 5 or 6 tutorials, each of which include source for Visual Basic.NET 2002 and Visual Basic.NET 2003. C# tutorials may or may not follow. These tutorials are to give you guys a jumpstart to some Direct3D. I hope you enjoy these.
This tutorial will serve as an introduction for DirectX.
Well what is DirectX, and why do you want to use it?
"Microsoft DirectX is an advanced set of multimedia APIs built into Windows operating systems. DirectX provides a standard development platform for Windows-based PCs by enabling software developers to access specialized hardware features without having to write code that is hardware-specific."
-www.microsoft.com/HWDev/acronym.htm
Simply put, DirectX is an API for creating games. Rather than talking in 'hardware' language, we use the a set of functions that MS gives us.
"I want to write a 2D Game, so why am I using Direct3D?"
Microsoft basically (like it does with most products) dropped support for DirectDraw. Another reason to use Direct3D is becuase its got more features (Shader Language, Effects Framework, Alphablending..etc).
"Why can't I just use GDI+?"
Direct3D is way faster (although more complicated). I'm not saying don't use GDI+, its great for games such as card games, simple strategy games, board games (basically games which don't require a lot of stuff to move all at once). I once wrote a Tile Based GDI+ Game Engine. Once I added 2 enemy characters moving around, I got 7 FPS, and it dropped down to 4 when I added one more! GDI+ relies on software (.NET) to do all the drawing, whereas DirectX talks directly to your hardware. Also, Direct3D (like I mentioned above) has a lot more features.
"What are the downsides of using Direct3D?"
Uhh... its harder . Fortunately these tutorials may help you out.
"What are some books that you recommend to learn DirectX?"
Managed DirectX KickStart - C#, but the source is in VB.NET
For the uber n00b: .NET Game Programming with DirectX 9.0
---
Well, now that you're convinced to use DirectX, the first thing we need to do is install it!
Click here to get the Summer Update 2004, the latest DirectX Update at this time of writing(8/13/04). The file is fairly large, so you may require a broadband connection. During the installation, if it asks whether you want to install 'Retail' or 'Debug' choose debug. If there is an error in your game, debug will tell you what that error is. On the other hand, retail is faster, but the error will say something like "Error in the application", like that really helps .
Reboot your computer when it asks.
After rebooting, open VS.NET. Create a new project. All the way to the right, it say "References". Right click and hit Add Reference. Be sure that Microsoft.DirectX and Microsoft.DirectX.Direct3D show up on the list.
[This is for VS.NET 2002 users]
Well that's it for this tutorial. Now your computer is ready to start making some DirectX apps!
Expect to see another tutorial soon.
-The Pentium Guy
This tutorial will serve as an introduction for DirectX.
Well what is DirectX, and why do you want to use it?
"Microsoft DirectX is an advanced set of multimedia APIs built into Windows operating systems. DirectX provides a standard development platform for Windows-based PCs by enabling software developers to access specialized hardware features without having to write code that is hardware-specific."
-www.microsoft.com/HWDev/acronym.htm
Simply put, DirectX is an API for creating games. Rather than talking in 'hardware' language, we use the a set of functions that MS gives us.
"I want to write a 2D Game, so why am I using Direct3D?"
Microsoft basically (like it does with most products) dropped support for DirectDraw. Another reason to use Direct3D is becuase its got more features (Shader Language, Effects Framework, Alphablending..etc).
"Why can't I just use GDI+?"
Direct3D is way faster (although more complicated). I'm not saying don't use GDI+, its great for games such as card games, simple strategy games, board games (basically games which don't require a lot of stuff to move all at once). I once wrote a Tile Based GDI+ Game Engine. Once I added 2 enemy characters moving around, I got 7 FPS, and it dropped down to 4 when I added one more! GDI+ relies on software (.NET) to do all the drawing, whereas DirectX talks directly to your hardware. Also, Direct3D (like I mentioned above) has a lot more features.
"What are the downsides of using Direct3D?"
Uhh... its harder . Fortunately these tutorials may help you out.
"What are some books that you recommend to learn DirectX?"
Managed DirectX KickStart - C#, but the source is in VB.NET
For the uber n00b: .NET Game Programming with DirectX 9.0
---
Well, now that you're convinced to use DirectX, the first thing we need to do is install it!
Click here to get the Summer Update 2004, the latest DirectX Update at this time of writing(8/13/04). The file is fairly large, so you may require a broadband connection. During the installation, if it asks whether you want to install 'Retail' or 'Debug' choose debug. If there is an error in your game, debug will tell you what that error is. On the other hand, retail is faster, but the error will say something like "Error in the application", like that really helps .
Reboot your computer when it asks.
After rebooting, open VS.NET. Create a new project. All the way to the right, it say "References". Right click and hit Add Reference. Be sure that Microsoft.DirectX and Microsoft.DirectX.Direct3D show up on the list.
[This is for VS.NET 2002 users]
If not then you're probably using VS.NET 2002. Unfortunately, MS basically dropped support for VS.NET 2002. But don't worry - close VS.NET follow these instructions:
1) Go to the directory where you extracted the SDK Setup files, and then go to: Developer Runtimes | Managed DirectX | Debug (or retail if you want) | and run the short setup file there
2) Open Regedit(Start | run | "Regedit")
Navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\AssemblyFolders\
Right clikc the "AssemblyFolders" Icon and select New | Key
name it DirectXAssemblies
3) go to the DirectXAssemblies folder and double click the key in there which says "(default)"
and type in the path to your DLLs:
C:\WINDOWS\Microsoft.NET\Managed DirectX\v9.02.2904
be sure that this path exists.. my friend had 9.02.2902 for some reason
This made the summer update work for me.
"I thought I remember seeing these instructions elsewhere?"
Eh? I just pasted it from this thread.
Now go back and check whether the References show up or not (they should).
[/This is for VS.NET 2002 users] 1) Go to the directory where you extracted the SDK Setup files, and then go to: Developer Runtimes | Managed DirectX | Debug (or retail if you want) | and run the short setup file there
2) Open Regedit(Start | run | "Regedit")
Navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\AssemblyFolders\
Right clikc the "AssemblyFolders" Icon and select New | Key
name it DirectXAssemblies
3) go to the DirectXAssemblies folder and double click the key in there which says "(default)"
and type in the path to your DLLs:
C:\WINDOWS\Microsoft.NET\Managed DirectX\v9.02.2904
be sure that this path exists.. my friend had 9.02.2902 for some reason
This made the summer update work for me.
"I thought I remember seeing these instructions elsewhere?"
Eh? I just pasted it from this thread.
Now go back and check whether the References show up or not (they should).
Well that's it for this tutorial. Now your computer is ready to start making some DirectX apps!
Expect to see another tutorial soon.
-The Pentium Guy
Last edited by a moderator: