User:Almar Joling/Journal

From GPWiki

Files:GUITutorial_warn.gif The Game Programming Wiki has moved! Files:GUITutorial_warn.gif

The wiki is now hosted by GameDev.NET at wiki.gamedev.net. All gpwiki.org content has been moved to the new server.

However, the GPWiki forums are still active! Come say hello.


This is the journal for my Western themed game. The journal starts while a month or three have been passed already on this project. So I guess the best thing I can start with is what has been done already. If you scroll down to the "Journal start summary" you'll read a nice summary of what happened before I started this journal.


Friday, 1 July 2005

This week I've managed to rewrite the QuadTree. It goes one level deeper now, culling more triangles as needed. It still ain't perfect, probably because of my very effective vertex cache structure. It sacrifices easyness for speed. I need the speed, because everything is bruteforced... no LOD of any kind.

(pointers to )Objects are also stored in the quad tree now, allowing me to effectively render only the objects which are on screen.

Net to that, a renderstate cache is implemented, which will filter out any obsolete (redundant) render/texture state changes. Quite nifty, and improves speed.


Monday, 27 June 2005

Been quite a while since my last update. This was mostly because of my internship which is part of graduating. Anyway, I made some progress in the short amount of time which I had daily.

  • The Realtime light scattering is in. Not sure if I'll keep it, because the heavt calculations need to be performed on each single object. Something I forgot to think about while working on this...
  • Pixel perfect object selection! Using a special rendering technique I can find the pixel under the cursor and check if it's one of the 16581375 objects which can be detected. I can even render every face of the terrain with a different color and still have enough for the objects! That could give interesting ideas. Or maybe reduce the amoutn to 65k and do something like distance with the 3rd color byte. (I disregard the alpha channel since it gave me nothing but problems. When using that, I could identify 4228250625 different objects).
  • A Star pathfinding is in. Just the basic stuff, nothing special.
  • Game structure completely rewritten. Now using singletons and everything is quite neat! Loose .h/.cpp again instead of .h files only. I finally understand how it works now.
  • Actor structure. All game objects are inherited from one "base" actor object, makin it a lot easier to store and control those things.
  • State machines, Basic state machine is now implemented, and any object, can acquire any state. Quite cool.

I hope to improve my quadtrees soon too. I want to know which object is in what quadtree, so I can save a lot of rendering time there.

Monday, 14 March 2005

Took a day off, to work on the Western :). I've made some decent progress with the scripting support. Basically all the events trigger nicely. I can call both C++ from Lua and Lua events from C++ now.

My main issue right now is how to continue working on the AI. I'm a bit clueless to get it right the first time. A*, object detection ("Is there an unit next to me?"), line of sight, etc. All part of the AI. Well, I hope I can figure it out a bit :)

Thursday, 3 March 2005

Haven't been doing that much lately.. Except I finally got my vultures flying around independently, using Lua code, and using only one single LuaState. Pretty cool. I had to mail a bit with the guy who's developing LuaPlus, but eventually I got it to work.

Next to this, I've also prepared some configuration/scripting lua files for units, buildings and weapons.

And finally, tonight I fixed 99% of the memleaks. I'm glad the Direct3D debugger reports them. Some of the memory leaks are so easily created (a simple object just not being released, for example.).

This weekend will probably involve more scripting :)

Sunday, 20 February 2005

Ahh. My good old journal is waiting for an update. It's been weeks since an update. Mostly, because I haven't done that much lately. This weekend I have done some more, finally. Because of my internship, I do not have any time left anymore during weekdays to program what I want.

Filesystem

I've created the basics for a filesystem. A packaged file format, which will contain (almost) all the game files. It looks a lot neater to the end-user (the player), I think. Besides, it might stop some people from altering files.

The cool thing is that I've based it on my PAK format of YALG. This means that I do not have to rewrite a new packager, I'm simply using my YALG one with only a few modifications. A great time saving idea.

Right now the loader only loads a texture from a byte array loaded in memory. Later I'll add support for shaders, text messages, camera paths, etc. It's like an virtual file system, kinda.

Grass

A moment ago I finally got the (Prairy) grass to work. It doesn't look perfect (it's made of strips), but it does give an extra dynamic element in the game. The terrains needs to 'live' actively, and not look very passive.

Problems

I want to increase my terrain texture detail. Probably using "texture splatting". But this is something for the future. One problem is already at the corner: Changing my quad tree depth will make the terrain look bad. I should rewrite it someday, because the system is very badly written (one of the first things I did, taking weeks). I hope I can do it faster now after all the stuff I've learned meanwhile.

A screenshot will follow later someday demonstrating the grass and stuff :)

Saturday, 29 January 2005

Completely finished porting the DirectX9 Custom UI demo to DirectX8. Except for three little things: Somehow the text is a bit unsharp at the current 640x480 res. Second: It's slow compared to DirectX9. The DrawText function mises one critical argument it seems. I'll probably write my own font rasterizer and plug it in. Although it might be quite a complex task. The game does not have much text to render. It's a game, not a text-based MUD :). Ingame I'd like to have western-styled text anyway. And last: The IME controls have been disabled. Soem strange errors appear which I can't be bothered to fix right now. I'll look into that when I really need it.

Further:

I finished another article for the GPWIKI. A basic guide how to use vertex shaders and pixelshaders.

Right now my "hard-to-do-list" is all done. Something I'm quite proud of, since most things were quite figured out by myself. (Although some came with frustrations ;))

guitotal.jpg

Thursday, 27 January 2005

Yesterday I got the shader based hardware blending vertex blending working! One of the items on my "hard-to-do-list". It works great. The framerate is almost untouched when rendering animated items now. I wrote an article about it, check out the tutorials section for C++

I've also managed to use classes in Lua. Although it is not working as great as I've hoped. I have to execute a seperate string command. Not my favorite way, but in return I only need one Luastate then. (I can put all my objects in a table, and refer from my C++ code to it)

And, I managed to compile the CustomUI demo from the DirectX9 SDK, in DirectX8. Phew! That was so much work. And it's still unsure if it will ever put a poly on the screen as well. I have a hard time getting the objects link and compile correctly. Maybe I need to switch my code to seperate .h and .cpp files, something I do not look really forward to. The current method (everything in .h) worked just fine till now.

Only a few days left before internship starts. If I get the UI working, and learn my tests as well, then we have made quite some progress the last weeks.

Saturday 22 January 2005

It's been a few days since my last update. Today I finally managed to get the multiple selections working. Simply draw a box, and objects between will be selected. Pretty cool. I posted an article about it here on the GPWiki.

Next to that, I've also worked on implementing Lua in my game. Lua is a nice free programming language, even for commercial use. I'm using LuaPlus, a c++ wrapper version. My particle engine is now controlled by Lua. And the AI will be soon too. I've written a Lua article as well for the GPWiki.

Only one left before internship, and then the free time goes down to 3h/day.. after programming javascript/C# 8h/day. I wonder if I'm still interested in programming at home then :).

select%20cone.jpg

The selection code, visualized.

Monday 17 January 2005

Not much happened lately. So much to do, but don't know where to start. I added a nice selection system though. It works using the Z buffer. The objects are rendered an extra time after a mouse click, and the color of the object (dynamicallty assigned using a vertrex shader) makes me know the object which was clicked (by looking the texture color up again).

Further a small lasso selection box. Doesn't work yet though.

I've been looking into vertex tweening on the vertex shader. Doing the interpolation between the bone animations of the model on the video card. That's going to be a tough one. And currently I do not want to do hard, time taking stuff :). Up next is a screenshot class that will allow me to make screenshots bigger than the screen resolution.

I've also been looking how to export 3DSMax models to MilkShape/GameSpace, but everytime the texture coordinates are non existent, it seems. Even usign the Panda DX exporter, no textures.

Anyway, I have a headache and my monopoly in OpenTTD (opensource Transport Tycoon, even better than the original, still the same :P) is waiting for me.

Friday 14 January 2005

Today not much progress. I'm not sure what I should do right now. There is ofcourse plenty and plenty to do. I'll probably start working on an nice interface system, probably using the one from DirectX9 SDK as a guideline, since it contains textboxes, checkboxes, lists, etc. Pretty cool! When coding YALG I had quite a tough time getting some nice user controls. Making it in C++ is probably worse :).

I've also spent about two hours grabbing interesting screens from some of my Clint Eastwood movies. It might inspire the modeller, and me for some new ideas. My personal preference for big cannons just makes me have to post this screenshot. I hope it will be in the game someday.

Image71.jpg

Also printed out the design document to get some more ideas going. (Hopefully!)

Evening note: Added a simple "store camera" position system like seen in various RTS games.

Thursday 13 January 2005

Today I added sound to the game. The simple birds (vultures ;-)) flying around make seagull sounds now. I've also added a configuration loader, which will simply load filenames with a name in the model or texture manager so I do not have to hardcode the textures anymore.

Also tried adding the map<> library type, but somehow it doesn't want to work likeI want it to. I can't access individual elements. Something I have to look for later. Also looked for some more SkinnedMesh demo's, since my Milkshape animated vulture is displayed incorrectly (in Milkshape 3D as well). So, I might have to fix an .X loader after all. And that's something really awfull :). Or, I should write a convertor to my own format. Something I do not look forward to either.

Only three weeks left for internship, so I got to hurry on the game. AI and other things that are just mere programming tasks can be done in my 3h a day, that are left soon, instead of the 8/h I can do right now.

Late night addition:

The problem regarding the Milkshape model has been fixed. Whe ncreatign completely new skeletons in Gamespace, all bones have the same name by default. This confuses Milkshape3D so that all nodes share the same root node in the skeleton. When that was fixed something was still weird in my code, and eventually it was an QuaternionInverse() that shouldn't have been there.

Now there are vultures really flying around making seagull sounds! :D :)

Journal start summary

I started on the development of my game somewhere in October. In my vacation I got to visit a software company in Seattle where they convinced me (not using words,but with what they made) to try working with C++. My previous games were all made in Visual Basic 5-6. VB wasn't really much of a problem for these games though. (Check out my user page if you're interested in more details)

So I installed VC++, and looking for interesting C++ tutorials on the net. The idea of my game was quite simple: The story should be related to a western. I'm quite a fan of Clint Eastwood movies, and Unreal Tournament's mod: Badlands.

So, I started working on terrain first. My first problems started when I tried to add quadtrees. These quadtrees are the first step for frustum culling: Do no render what is not visible. My problems were related to the indices and normals. Luckily I managed to fix the problem, but it took quite some while, and required assistence from some other people.

After finishing the terrain geometry, I started working on the lightmap and shadowmap calculator. I'm using a modified version of the lightmap calculations mentioned on Gamedev.net somewhere.

The calculations are quite slow unfortunatly. Since the code goes trough every pixel in the heightmap.

My next step was loading Milkshape 3D models. This was quite hard, since there wasn't much usefull code (mostly OpenGL) available. Eventually I found some code which did everything I wanted (which is also available at my site).

After getting this to work I worked on all kinds of aspects of the game. Particle emitters, Camera paths, Logging, Water, etc.

Those went all quite straight forward, with exception of the water. I was tryin to make the entire game still work on a Voodoo3, since that was my machine back then (AMD 500Mhz). At 31 December 2004 I finally got myself a new computer and started working on some real cool looking stuff!

This new computer started a whole new era: Pixel and vertex shaders, many texture stages, etc. So I reworked my terrain a bit and after implementing shadows I got some great pictures:

Screenshot 1 Screenshot2

And this is where I end this summary, and start working on a more regulat process.