Friday, January 2, 2009

DirectX learning experience

I decided to devote some of my holiday vacation time to learning 3D programming in Direct X, for the following reasons:

1) Most new games are 3D, if I want to work in the game industry I am going to need to get a great deal of experience in 3D programming.
2) DirectX is fairly standard (though not the only option for 3D programming, there is also OpenGL, etc.) and it will be a good skill to show on a resume.
3) I would like to make Rina and I's next game in 3D.

So I spent a good many hours over a week period going over Direct3D tutorials, and samples, and came up with the following conclusions:

1) The learning curve is a bit difficult, especially if you are not very familiar with Matrix math (its been a while since I've used them)
2) The set of things the library does for you out-of-the-box is much more limited that I thought.
3) For some reason I couldn't find any good DirectX books in any nearby local bookstores (I checked at least 6). I did find many XNA books, which have some of the same content, but I prefer a DirectX 3D-only book. There is several of these on Amazon, but its a mystery to me why the bookstores stopped carrying them.
4) Mesh export from Blender works pretty well, except the type of materials exportable is limited.

I was able to make a test mini-engine with the following features
1) Add objects to the scene based on '.x' files, with a position, scale, and rotation.
2) Shadow support using shadow maps and custom shaders (using HLSL)
3) Ability to pick an object with the mouse cursor and move it around freely
4) Ability to rotate around with the camera

In most cases I took code from a example and tweaked it a good bit to get the results I liked.

Near the end of this period I decided to write code to do object animation based on frames exported from Blender. The only API call I could find to import animation from an .x file required storing an entire structure of all the bones, which is beyond the level complexity I was looking for. I simply wanted to say 'play frames 5-10' without worrying about the low-level details, but it seems as if DirectX doesn't provide this functionality, you have to write alot of code yourself to preform this action, which I consider pretty basic.

So I ended up stopping my DirectX 3D studies as my vacation ended, though I was not able to complete this last part. I decided that I had a good sample of 3D programming in Direct3D and I would now do some experimentation in a game engine, to see how much easier things were. Since I am not being too particular about the graphics in the earlier stages of the game design (this is just a hobby project at present), I don't need that much control of the low-level elements.

So what game engine will I use? That will be covered in my next post.

until next time!

No comments: