Rogue is a dungeon crawling video game first developed by Michael Toy and Glenn Wichman around 1980. It is generally credited with being the first "graphical" adventure game, and was a favorite on college Unix systems in the early to mid-1980s, in part due to the procedural generation of game content.

-- http://en.wikipedia.org/wiki/Rogue_(computer_game)

Monday, September 20, 2010

It is the little things

After beating my head against the wall, I called in a friend to help look at and debug the code.  If I were in a collaborative environment to begin with, I would have asked for another set of eyes sooner.  But after lunch at a nearby sub shop, I had him poke at my code.

Although the exact error was not found at that time, he did show me some more tricks working with Visual Studio and at least gave me a fresh perspective on where to focus my search.  After narrowing down the location, I was able to go back to the example code and figure out what I was missing.

In short, it was the typical "off by one" error.  In this case I was using a <= when it should have been <.  So after that was done, a few more errors in math were found in the rendering portion and finally I had completed the exercise.  Now I have half of a nice random terrain generator.

This is designed for an RTS so it has peaks and valleys.  I am not sure if I will have non-flat terrain in YAR itself, but it other aspects, such as path finding and object placement will be useful.  Orginally I was thinking of doing a simple 2D iso tile system, but it seems fairly straight forward to do this as a terrain/texture mesh over a 3D surface, even if the surface is going to be flat.  Since most of the heavy lifting has been done in DirectX (and OpenGL) like matrix transformations and what not, I might as well stay here as well.  I will be easier to make it simpler later.

Friday, September 10, 2010

Hitting a New Wall

I am slowing working my way though Programming an RTS Game using Direct 3D.  Only on Chapter 4 but I am taking my time to go over the code in the book and the full code on the CD to understand what I am doing.  Not to mention going back to some DirectX resources to see why I am doing what I am doing.

However, I have hit my first real stumper.  Some how I am getting corrupt memory in my initializations.  Annoyingly it happens at slightly different points in the code when I run it.  But the error is some type of heap corruption or other misaligned memory.  Unfortunately I have yet to see where the real problem is.  Also the example code itself runs fine, yet mine does not.  Now being the good learner, I am adding my own coding paradigm to the example code, so there are differences.  But I am not sure what difference is causing the error in question.

The upside is that I am getting more familiar with the Visual Studio Debugger.  It is kind of fun and for the most part I have been able to figure it out.  Right-Click is your friend.  Now I am still a little green trying to read some of the raw assembly code, but I got though reading UNIX trace/truss commands so this will just take some time to start seeing the patterns that have useful information.

Friday, September 3, 2010

FORTRAN is the Latin of Engineering

If you went to Engineering school in the 80's you most likely had to take a programing in FORTRAN class.  As I started in 1989, I too took FORTRAN.  Two years later, entering freshmen learned C instead of FORTRAN.  Granted I also took the C programing class as an elective, but FORTRAN was the required language.  Also I think my year was one of the last years to have a mechanical drawing class with actual boards, pencils and T-Squares.  And although I had my father's slide-ruler, we were allowed to use electronic calculators. 

So learning "old" technology is very comfortable for me even if it is academic.  Such is how I feel right now working with DirectX9.  It is on the way out since XP is finally no longer allowed to be put on new systems and soon that will be moot since it wont have the support of new hardware anyway.  I should be learning DX10 or DX11.  However there is a lot more written and available for DX9.  Currently most of the books of the variety "Programming $GAME with DirectX" are written for DX9.  So I have a lot more examples to pull from.

Now in my case $GAME = RTS. Though I do have access to the online copy of RPG as well.  So between the two of them I am getting a good idea of all the moving pieces that go in to a fairly typical, though small, game that I want to create for YAR.

I have found learning "old" methods very useful, though it has pigeon-holed me a few times.  On the other hand, I am one of the people that can bring grognards up a few centuries and use at least more modern equipment then what they were using.  Also since I am spending as much time learning the concepts of 3D graphics programing (like texturing and  transforms) I can use all the examples I can get.  My quick look in to DX10 shows that the concepts are still there but the implementation has changed (like Vertex and Index Buffers.)   You still have to know how to use those items from a conceptual standpoint regardless of the API.  When I poke a OpenGL sometime in the future, I will not have to learn basic 3D programing.