Omg. I have become a total slacker the last couple of days, no updates here :( I didn't had much time over christmas to code, but I read some more of my Rapid Development book (see last post
) and it is still interessting and insightful. Yesterday I still was
in vacation land and had to force myself to get back to coding ^^
I also reconsidered some choices I made and came to the conclusion that this project was
originally started to make a quick little game with DirectX9 in c# and also to write a new
base engine for upcoming DirectX9 projects. I did obviously spend too much time researching
shaders (DirectX9 fx high shader language)
and saw last week there is no way to implement that nicely in 2 weeks (when the game is running
with all the other parts finished I will reconsider implementing shaders). For the engine part
of the deal this is still great work and I have a lot of base classes for any shader effect
development ready, but for the "quick little game" Lost Squadron part it is not looking so good.
It is a conflict of interests because finishing up something quickly does not work hand in
hand with researching and implementing new techniques. For this project I think it is better
to focus on developing a solid base engine, next project will be planed much straighter.
Yesterday I collected a lot of effect graphics and sounds and made some new ones. I got
now a nice collection of effects with graphics and some funny sounds for the effect engine
and made a couple of effect types (parameters, testing, etc.), but when adding more and
more effects it became very obvious that this would be a great think for scripts. Instead
of hating myself later for not using scripts right away, I just went crazy and implemented
the whole effect system in LUA scripts and can add new effects there without changing
any code of the engine. I did the base code for that a month ago (check out LUA.NET for
doing that in c#) and have read the great book Programming in Lua by Roberto Ierusalimschy.
LUA links in case you are interessted:
The effect engine needs still some testing and I haven't worked
with lunit yet (will do that tomorrow), everything should be up and running tomorrow and
I will post a new screenshot with some nice effects then. The rest of the base classes
except wayfinding and enemy ai is also pretty much complete, so I hope I can finish up
a small demo till New Years Eve (driving around, shooting at some stupid enemies).
Sorry for no screenshot today and sorry for the long pause. Fabian is ill (my intern
helping me out a bit with Lost Squadron), hope you get better till next week :)
Tomorrow the LUA effect engine should work and I will post a
screenshot of the actual gameplay finally (I want to kill some stuff).
First of all: Merry christmas to everyone and thanks for reading all this stuff, my page views increased a lot since I do this daily series.
I spend the last couple of hours trying to get Unit Testing on the engine level to work and I finally got now everything up and running. This is really one of the greatest things ever in Game Development IMO! Normally I would spend a lot of time changing code to just test stuff or even write small test application only to check the behaviour and graphical output of effects, newly imported textures or models or new game features. Now I can just write a VERY short Unit Test for that INSIDE my project, no more extra projects, no more messing around in the code.
Just to make this clear: This is not a usual Unit Test like in other parts of the engine, like when checking file input/output, internal methods or some logic issues. These Game Unit Tests (thats how I will call them from now on, or just GUT, which is german for good ^^) give you all the features and easy testing possibilities like normal unit tests, but you can initialize the whole engine, see visually whats going on and shut down everything automatically or by user input. Let me give you an example how this looks:
Note: This code uses .NET 2.0, if you want to read about Anonymous Methods click here.
Same thing is of course possible with a couple of lines
more code when not using Anonymous Methods (using Events or just duplicating the code in TestInitEngine). This code will create all the stuff required for the game engine, then execute the initialization code to create the effectManager. Then it will proceed to the game loop and execute the render code each loop there, everything will be shut down if the user quits the form, presses some key or if we set a timeout to quit automatically. There is a lot of hidden code behind all that, but this is exactly the code executed when just running the game and testing that is always good :-)
In the next 2 days I will not code much (visiting family, chrismas, etc.), but I will to read 2 nice book from Steve McConnell: Code Complete 2 and Rapid Development. I already read a couple of pages of Rapid Development and it is really written good and very interessting.
The next Lost Squadron screenshot will be posted presumably in 2 days.
The game itself did only get some minor improvements today, I spend most of the time on the engine. As you can see on the screenshot, there are now effects like that explosion effect (there are already over 20 effect types), but the EffectManager isn't complete yet. Additionally to the road it is now possible to set railroads and I imported some new objects and new graphics into the editor (not on the screenshot).
Hey everyone. Today I made some improvements on the graphical side, mainly because I received some mixed feedback about the current graphics. Doesn't look too pretty right now. For that reason and because a lot of classes for the game handling are not finished yet (and only 1 day left till chrismas) I think its much better to give this project 1 week more. Maybe this time will be enough to finally implement shaders and shadows for all objects. Especially shadows will add so much to the game, it is pretty much impossible to tell how height an object is when looking straight down. Shadows would not only make the scene more realistic but would also improve the gameplay (you would see what your unit can and can't see).
As you can see on the screen I completed the roads stuff and added some new objects. Also as planed yesterday the moving around and mouse aiming does work now, but I'm screwed again with those X files, there are totally messed up (rotation wrong, each object is rotated differently, meshes do not fit on top of each other, the upper part of the tank does not have the same pivot point, really annoying), grr, but I don't have the time to write an own 3d-model format (or import any format into the engine, 3ds would suck at a similar level).
I also started the game message classes and most classes needed for gameplay are existing now, but most of the functionallity is missing. I will try a new approach this time to write that code: Unit Testing. Many smaller methods of the internal engine are already checked, but I never done large Unit Tests for a whole game. The tests should be able to run the whole game (creating units, moving around, blowing stuff up, doing graphic effects, winning, losing, etc.). I will report back how that works. Later today (when I slept a couple of hours ^^) I will start that stuff with my intern Fabian :-)
So the new date for the first Demo version of Lost Squadron is 2004-12-31. It might be playable tomorrow already a bit, but I don't think it is wise to release it so early. The first experience should be very nice and for a quick look you got the screenshots here ^^
Here is a fun link about Programming Languages and why some of them failed and others not:
Some new models, but still a lot of problems with x files (man they suck, I can't imagine anyone is actually using them for anything except test projects). Note: Don't expect that this screenshots will fully represent the final game, everything can change (just check the screenshots of the first days, there have nothing to do with the current state).
Yes! Finally I got back to the game code after all this Editor and Shader
coding and run into some problems when rendering some models with
transparency. First of all the models had to be rendered from back to
front, but even then the models with multiple alpha layers were
completly messed up. So I had to split up the alpha layers to multiple
meshes and tryed to render them back to front, but DirectX tries to
render per materials and not per meshes, so that didn't work easily.
I had another idea to just test the alpha values for 50% alpha and
then skip writing to the frame buffer and that didn't work either
(framebuffer is full of false pixels anyway). Instead of banging my head
into the wall I just steped back and thought about needing this feature
at all and no, there is no need for that in this game: I can just delete
or don't use anything with multiple alpha layers. For example the palm
had 3 layers of palm leaves, but I killed 2 of them and no everything
is working perfectly (I still have to sort objects and to render first
solid, then alpha materials, but thats pretty fast). I'm happy I got
this solved :-)
The Editor was also improved a bit and everything needed for a full
mission can be set there. As you can see on the screenshot there are
a couple of new features for the map: Roads, some more neutral objects
and some enemy units. Shadows and shaders would be nice too, but there
is no time for that right now. Maybe I will be able to put that into
the engine next week.
Moving around with the tank and aim and shoot on stuff should work tomorrow.
Effects and AI won't be complete till christmas, there will be most likely only
a couple of standard effects. Also collision detection is another big issue.
Lots of dummy objects (especially the red car), but lighting works, loading maps from editor works and roads are going to work soon too ^^ Also a lot of gameplay classes done today. More objects will be made and imported soon to improve the game feeling.
Well, this shader stuff is really annoying. I got a new shader for the landscape in a test app working and implemented some test textures there. But when changing the light to a spotlight I ran into many problems, not so easy as I thought. At least I know now how to pass all that vertex buffer data to the vertex shader, but for a ground shader with works nice with all the lights there is still some work to do and I don't have the time for that. So I will skip now all the normal mapping stuff until later when the game is complete. For meshes normal maps are working (at least with directional light), maybe I will use some of that.
Anyways, time is running out, I wrote down all the weapons, powerups and enemies today and created some classes for that, but there is nothing finished yet, so no screenie today. Sorry. Worked the last couple of hours on shader stuff anyway and I told myself it I don't get it working today, I will leave shaders out and add them maybe later.
I was working still on the Editor today, not that much editor features were missing, but a lot of other stuff eat up a lot of development time. Drawing lines for example is really bad in DirectX, either you just draw some primitives and get slow when drawing a lot of them and have a lot of overhead each time setting all states (and recovering from some crazy states the caller might have left, nothing is working as espected) or you use this stupid Line class wrapper thing, which will cut your framerate by the factor 2 or 3 (really great, no wonder noone uses it). Or you can just draw stuff with vertex buffers, but thats also very annoying because you have to create the vertex buffer and handle all that vertex creation, and also obviously not the right approach for a single line.
So I ended up writing a nice LineManager class, which collects all lines draw each frame and put them in a vertex buffer and because the lines are only changed when some big change happens, the vertex buffer can stay the same for a long time and thats really fast. Everthing gets rendered at the end of the frame (used for on screen controls and other stuff anyways). Same thing for filled boxes, color blending effects, etc. lots of helper classes.
The texture blending (as you can see in the image) was also not a piece of cake, but the blending over 5x5 vertices is now a nice technique. The textures are not really fitting good together, when you just put them besides each other, but with this blending technique it looks really good (or maybe I'm just to tired to tell anymore ^^). Another bonus is my new vertex format, which is compatible with a test shader I wrote 2 days ago (which didn't run correctly back then, I only managed to do some basic stuff). Seems like some arguments where missing and the vertex shader wasn't complaining, but crashing some time later (after couple of calls, not really funny to debug).
There isn't much time left, so maybe some features might have to be put on hold because I really want to finish the base game this week (just 1-2 missions, only basic features to see if its really as much fun as I imagine). If its playable a small demo or some sort of beta-version will be available before chrismas this week. Anyways, till new-year the game and the final demo-version should be finished, lets see. Maybe in the next couple of days things can be done more quickly because all the base classes and the complete framework are now completed.
Yup, yesterday no screen, I was too tired. The editor is now finished, only setting objects and the roads is missing, but that should be easy. All the other sub menus and UI is now complete too, even the multiplayer stuff has a UI now waiting for implementation (dunno if there is enough time this week for that, would be nice though). Time for some gameplay this week :-)
Today was Editor-Day. Our intern Fabian helped my out a little with the map file and we implemented all the UI controls for the Editor, all of them are working now, at least on the UI side. The Map Editor itself will be finished tomorrow, still a lot of smaller things to do before everything can run smoothly.
The UI needed also some improvements, so I made completly new graphics for them and updated all UI controls and added some we needed for the Editor. All this little things, like writing UI code, writing smaller classes for the ground textures, the road logic, neutral objects and the enemy units can really keep someone busy. I still hope the basic engine for this game can be finished this week, so we got next week to make some cool missions and the advanced stuff (shooting, effects, multiplayer).
About all this shader stuff from the last couple of days: I managed to get some basic shaders to work, which is really nice now, but still no clue how to implement all that spotlight normal mapping with alpha blended textures. Maybe I will just use some sort of directional light for the bump effects (or maybe a point light if I can pull that off, but then all the lighting calculation has to be done inside the shader as well, uhh complicated).
Half-time, 1 week has gone by for this project. This is a image of the editor, you can easily create
new maps or change existing maps with this nice tool :)
Some internal work for the Editor was done today and I wanted to finish up all this shader stuff, but run again into a lot of problems. Vertex Shaders are really a pain in the ass to debug, everytime anything goes wrong the whole app crashes (I catch exceptions everywhere, but DX will just fail at everything and the app has to be shut down). There are also a lot of problems with the shaders to support spot lights and some other stuff in the engine like blending textures over each other.
Because of all this problems there is no real screenshot this day (with all this shader errors Lost Squadron isn't looking pretty today ^^), but you can see my first shader version of normal mapping on the right. Tomorrow will be the last day I will try out to get this goddamn shaders to work, else I will just leave them out and finish the rest without any high level shader support and maybe add them later ...
Shader test (extra program I wrote), works ok after lot of testing finally, but shader needs lot of improvements to work correctly with spotlights.
I completed the landscape rendering class and object loading today and played around with light effects. Directional lights were pretty easy, but very boring for this top-view-camera. So I tried out Point lights and they are nice, but why not test Spot lights? Well, now I know why, they are very hard to maintain. Setting all values properly is not that easy. But I like the effect (you can even rotate the light direction).
Other than that I tried also to implement the ground normal map shader I developed yesterday for the last couple of hours, but I can't get it working. Some mul operation always crashes inside my shader and is very hard to debug. Maybe I need to debug everything with DEBUG_PS and DEBUG_VS. Well, I hope I get that working tomorrow.
A big spot light effect on the landscape. The objects are not final yet and have no effects. But lighting does work well, maybe there is even some time to implement shadow maps later this week. We will see.
A boring ground texture. You might guess there is still a lot missing and yeah,
you are right! At least a lot of things are happening in the background:
6 different high-detail ground textures with normal map support are
implemented into the engine right now, all the map, menu and game base classes
are working now. Let's see what will be finished tomorrow. The shaders
and the light effects are not implemented yet, so everything is at 100%
brightness and normal mapping isn't working yet (but it will soon ^^).
Yep, thats right, I started implementing shader support and programming a
normal mapping shader for the ground textures. You might ask, why the
hell do you do this for a 14-day project? Well, I'm crazy, that's why :-)
I finished up testing some shader effects and writing a fx file with
normal maps and multiple lights,
but I didn't manage to get that into the engine today. Tomorrow I will try
to import some objects, test out all that normal mapping and will play
around with lights and light effects (dunno if a night mission with a lot
of lights isn't total overkill and if I should stick with a simple
directional light and maybe 1-2 point lights for the tanks).
There was also a noticeable
delay when loading all ground textures (6 512x512 textures with 6 512x512
normal map textures and some other smaller textures), and thats not
nice when debugging and testing out everything every few seconds.
So I converted all textures from .jpg, .png, etc. to .dds format and
used compressed formats like dxt1 and dxt5. Now the loading is lighting fast
and I guess when not using the retail DX9 runtime the delay will not even
be noticeable (remember, over 10mb of pixel data are loaded here).
For models I will see how long I can stick with .X files. Usually a
format like this will make me angry after using it a couple of days
because it does not support some little things and is most likely not
extensible and I end up writing my own format (which can't obviously
not happen in the short timeframe of this project).
It is also important to use the proper tools for DDS files, normal map
generation and writing fx shaders (or other formats, but I like fx), which are:
- FxComposer by NVIDIA too for testing out .fx effect files and writing your own
- RenderMonkey by ATI is a really cool tool to try out shaders and
test stuff, making shaders is not a piece of cake, even with all this
tools around there is a lot of testing and modifying going on even
if you got some nice shaders working.
- NVIDIA_Photoshop_Plugins for saving DDS files and making normal maps from heightmaps or textures
- DDSViewer by NVIDIA for viewing DDS as thumbnails, but thats not really
helping that much (because windows thumbnails just suck). The DXViewer
or so by the DXSDK is also really useless because its so user unfriendly.
Also ACDSEE, IrfanView and Google Image viewer (Picasa Photo Organizer)
and any other Pic-View program I tried do not support DDS files and don't
even have plugins for that. But I found another viewer, which pretty much can't
do anything but converting and displaying every format ever invented
called: Konvertor. This thing is really crazy, don't ever try to read
the full list of supported file formats (its 840 or so). Well, navigating
suxx with this tool, but at least you can quickly display DDS files and
zoom around. Konvertor has also another really nice feature: When you
right-click on a file you will see a small preview, thats really one of the
coolest thing I ever saw in a popup-menu :-) Sad thing is: For DDS files
this does not work, only .bmp, .jpg, etc. files previews are generated, grr!
- There are also a lot of other tools involved when saving stuff in
3D Studio Max, Maya, etc., but I won't get into that.
Has nothing to do with programming ^^
I also underestimated all the classes I had to create for just rendering
the landscape, there are of course still a lot of things missing as you
can see on the screenshot. The basic layout for all the menu and game
classes is now more or less complete and I'm pretty happy with it.
Everything is still very easy to maintain and I got a good overview of
the classes. The game has to be filled up with a lot of
objects, roads, enemies, etc. in the next days. Hopefully all of this and
the basic game engine and gameplay will be finished by the end of this week,
so we have next week to test and balance the game, make some cool missions
and bugfix the hell out of it (well, the engine is only a couple of days
old now and only tested by me and my unit testing stuff).
Btw: VS2005 will get REALLY slow when you have a lot of files opened and
try to compile or work on some older file. I think some part of the
auto-recovery of files when crashing is not really optimzied. Anyways,
when you close all documents and open only a couple (lets say no more
than 10-20), VS will responde quickly again. Little annoying, but I'm now
much better of knowing that ^^
I also registered the domain www.LostSquadronGame.com, which will be
the official site for Lost Squadron. But when its up and running it will
just link to this site until we got some finished page (which is
not planed before chrismas, but as I know our graphic guy Leif, he
can't help himself and will make a page design when I'm not looking).