DirectX Programming examples wanted...

MrElusive

Banned
Dec 10, 2001
87
0
0
I'm new at directX and I'm almost done learning C++ and I'm very curious of what directX is like. I was going to go out and buy a book on directX 8.0 but not sure I could understand it so I immediately thought of you guys. :) I know functions, variables, strings, everything I need really except I don't know squat about graphics. I'm about to learn the basic drawing techniques but I don't really care for them. I know what directX is but not sure if I would or could understand it. Please give me an example of it or give me your opinion on this.
 

Adrian Tung

Golden Member
Oct 10, 1999
1,370
1
0
You might want to familiarize yourself with the Win32 API (Windows programming) before you go into DirectX. Learning DirectX is largely about calling APIs, using Interfaces and such. Most books will also get you to write your own (or use the author's) wrapper functions that manage DirectX functions.


:)atwl
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
Before delving into DirectX, be sure you are comfortable with (advanced)C++. I have been hearing that DirectX has improved considerably in the recent times (in its ease of use). If you find DirectX is not to your liking, be sure to give OpenGL a go :)

Some DirectX tutorials here: Nexe @ Gamedev.net
OpenGL tutorials here: Nehe @ GameDev.Net

Also, the MS DirectX samples don't see to bad either (code is typically not too readable however).
 

Gaunt

Senior member
Aug 29, 2001
450
0
0
I've recently just taught myself DirectX for a school project... hopefully I can convey some useful bits of advice.

First, the SDK for DirectX, available Here (Click DirectX 8.1 SDK on left hand side, don't know why they hid it). You will also want to download the SDK Extras, to get useful tools, and a collection of Sample applications. Alot of people suggest you look at the samples to help you learn DirectX. A few words of warning... In some cases the samples are badly adapted from older versions of DirectX, and the coding standards are lacking. With that in mind, the sample applications are still quite helpful.

Second, you're going to need to understand C++ fairly well, you should have an idea of what COM is and how you can use COM objects, and you will definately need to understand Win32 API enough to know how to handle messages, and create and manage windows. With the Extras comes an appwizard extension for creating D3D applications which can be useful, and hides most of the details from you. It will create a main windows, and will also create the COM objects you need for your application.

Lastly, a book might help. Prima Publishing has a fairly good book called "The Zen of Direct3D Game Programming". It covers quite a bit of stuff, and gives a fairly good introduction. In my opinion it's a little heavy on the 2D, but it still helped me wrap my head around DirectX.

I came from an OpenGL background, into DirectX. There is a ton of overhead in DirectX, but in the end it's well worth it. DirectX offers you the ability to easily control all the sound, graphics, and input for your application, without having to rely on third party libraries, as you would in OpenGL. The actual techniques involves for creating scenes are similar, however. You will need to understand matrices, and how they are used to transform your world and your projections. As mentioned earlier, gamedev.net will probably have some useful information on this, and many other things.

That should keep you busy for a little while. :) It looks a little complicated, but once you get things figured out, games are suprisingly easy to create.
 

MrElusive

Banned
Dec 10, 2001
87
0
0
A few things to add (Thanks for replying). I never did find out how to make windows in C++ since my school is really cheap and won't give us better books and computers. Is that what Win32 is? I saw it on the list of programs to create in Visual C++. If you have any tutorials on them I'd appreciate them. So the steps you think I should go would be to get a lot more C++ knowledge, get and try to comprehend SDK for Visual C++, then move onto DirectX? Not too sure what COMs are either! :(

Also I don't totally understand APIs so an English translation would be appreciated. I'm a PA "hick" and there are about only 3 (2 to be exact) that know somewhat what we are talking about. The teachers are all jocks especially the C++ one so no knowledge will be found there. I'm on gamedev a good amount but I find it as a labyrinth. Their for beginners section just offers books and a quick 5 or 6 page quick overview of where you should start but no explanation of how the coding or APIs or graphics & sound all fit together. So I ask you guys.

"It looks a little complicated, but once you get things figured out, games are suprisingly easy to create." But are they fun and rewarding? That is the entire reason I am (probably you are too) for being into the gaming industry because otherwise I couldn't care less about programming.
-Thanks
 

MrElusive

Banned
Dec 10, 2001
87
0
0
Yeah I looked at some of the code for that stuff and I've come to the conclusion that I'm a fukin idiot and I won't ever be able to understand any of that. Are programmers the only thing in demand? I'm learning Maya and I really enjoy it and I'm big on drawing characters when I can draw but honestly I don't see me working in the game industry. I didn't think you had to be as intelligent as I thought. All in all I can't believe that I STILL can't understand any of the code in those examples on SDK. Well whoever said We'll always need ditch diggers is totally correct because I'm going out to buy a shovel. :(
 

Gaunt

Senior member
Aug 29, 2001
450
0
0
I haven't a clue about C#, but microsoft's site will probably have some info. I think the only SDK's they have available are for C++ and VB, but I could be wrong. Check the link I mentioned in my previous post.


Now, Mr. Elusive, by the sounds of it you're a High School student? I'm just guessing, don't take any offence to that. Now, to rant for a bit...

Is game development rewarding and fun? Yes, I would say it is, but then again, I've loved programming since I was about 7, so I might be a little crazy. To me, it doesn't matter what I'm creating, I enjoy it, and it's very rewarding. Game development was something new that I tried only in the last couple months, and I must say out of all the things I've written, it was definately one of the more enjoyable. There definately is alot of background you need, as you seem to have found out. Don't let this discourage you. It doesn't take long to learn, really. If you are considering this as a possible career, or even a hobby, it's going to be worth your time (once again, my opinion is quite biased).

Having no idea how much programming experience you have, it's difficult to tell you where to start. You mentioned you've got some C++ experience... A fairly good understanding of the language is going to be a necessity, but you're only going to get that by programming and experimenting. As for Win32, it is the API for windows. API is application programmer's interface (or close to that) and is just the name given to a set of functions that allow you to control something, in this case, the Windows OS. There's alot of not so pleasant stuff to deal with when working with Win32, and it's going to take you a little time to figure out. It will definately allow you to create windows, and do just about anything else with Windows that you might like.

If you want to start with graphics, and you want to keep things simple, check out OpenGL. It is quite simple to understand, and you won't need to deal with Visual C++ and Win32. It will also allow you to get some C++ experience (well, mostly C actually, but whatever). Check OpenGL.org for more information, and to download GLUT (OpenGL utility library, makes things alot easier in some cases). Then check around for some tutorials on opengl. When I get home tonight I will try to post a site with some interesting ones.

You mentioned you are working with Maya and characters. That is a good avenue to continue down as well. There are many parts of game design, and everyone will always need models for their 3D games. The Extras in the DirectX SDK offer a plugin for Maya to allow you to export what you've created to be used in your game. The importing code isn't too fun, but everything will come in time.

So, in short (after a huge reply)... Keep at it, I believe it will pay off. Get some books, reading and experimenting with the code is really the only way you're going to learn. You might not be able to create a game for school for this term, but it will be handy for the future.
 

singh

Golden Member
Jul 5, 2001
1,449
0
0


<< Yeah I looked at some of the code for that stuff and I've come to the conclusion that I'm a fukin idiot and I won't ever be able to understand any of that. Are programmers the only thing in demand? I'm learning Maya and I really enjoy it and I'm big on drawing characters when I can draw but honestly I don't see me working in the game industry. I didn't think you had to be as intelligent as I thought. All in all I can't believe that I STILL can't understand any of the code in those examples on SDK. Well whoever said We'll always need ditch diggers is totally correct because I'm going out to buy a shovel. :( >>



Don't be frustrated man. Firstly, nobody understands everything the first time. Second, the code samples that MS has are NOT very well written. I would even go as far as saying that they aren't even aimed at beginners. The code (in typical MS style) is usually horribly written without keeping beginners in mind.

Be persistent in your learning. It will pay off. The biggest problems with programmers is that they don't LIKE what they do - they don't enjoy programming. If you are one of those that actually enjoys developing, then believe me, that alone is enough. And most of the DirectX code does NOT need to be understood 100%. Just use a "skeleton" program to get you started (true even for OpenGL). However, it is important that you understand the theory and mathematics behind 3D Graphics (hardware and API independent).
 

XZeroII

Lifer
Jun 30, 2001
12,572
0
0
C# and VB.NET will be supported in DX9. Not before :( There are many websites with forums that will give you some advice. I'd recommend GameDev. They have some excellent examples and their forums have many people who are willing to help.