Delta Engine Blog

All about multiplatform and game development

Lost Squadron, Day 19: Shoot'em'up

Day 19:
Some effects in action, the shoot line helps you to see where you shooting at (will be improved with a special texture, its just a line now). Some 3D to 2D converting is also not correct and needs some fixing. In the next days I will try to bring together all the completed parts and start with the mission design in the beginning of the next week.
Ratta ratta, peng peng, boom!


Yeah, hey now. This time I had way to much fun when generating this screenshot, now it is actually possible do aim with the tank and shoot at stuff (with all the new effects and sounds). It is a lot of fun.

Warning, this is a long post (I've written it in the last 2 days), but I have a nice idea: Content links, just click on them to jump to a section:

Troubles with IIS

I had some trouble the last few days with my IIS (Internet Information Server, the thing producing ASP.NET web sites), it keept crashing and hanging up with out of memory errors (this page was down a couple of times, sorry!) Really strange, that thing is running for over an year now and I never had much troubles with it. The memory usage was also pretty high (total ~900MB, IIS worker process alone had ~400 MB), I guess this has something to do with dasBlog using .NET 2.0, dunno (there are no errors logged anywhere). I had a lot of page hits this week after all the posts on other blogs about me.
The memory consumption of IIS goes constantly up and I had over 200MB mem usage again after a couple of hours, hmm? Don't wounder if the site is down or you get some errors, may happen because of these memory errors ...

I also optimized the page from 50 entries max to 10 and cut down the number of entries you will see on the start page. I hope that helps a bit, my server is really crappy and old and needs a lot more memory (had only 256MB, but I upgraded to 512MB recently, but its slower memory. I guess I need a gig or 2, lots of other services are also running on that server). I also changed the app pool to a special one and set some timeouts for requests and processing, maybe this will help (had no problems since that change).

RenderState errors

Another annoying thing is the RenderState property of the DirectX device, it will tell you you can "get and set" some state like FogEnabled, well you can set it, but if you try to get the state it will just throw an exception. A lot of RenderState gets will throw an exception actually, I'm really impressed by that. Great work not to mention any of these things in the docs (the docs are pretty useless anyway, most descriptions are trival anyway and IntelliSense helps you just as much).

Light-Effects in DirectX

The light effects for the effect engine were pretty easy in DirectX, I remember this was very hard to do in OpenGL (had to invert the alpha color, and with different color settings everything got messed up, so a lot of special cases had to catched and handled).

Basically this code is used (the light effect is a white texture with a spotlight effect in the middle as the alpha channel):

Device.RenderState.AlphaBlendEnable = true;
Device.RenderState.SourceBlend = Blend.DestinationColor;
Device.RenderState.DestinationBlend = Blend.SourceAlpha;

Now make sure both the color channel and the alpha channel will modulate from the texture color and the diffuse color. Switching back to normal SourceAlpha - InvSourceAlpha causes also no troubles with that. I like that :)

DirectX OutOfVideoMemory

Another problem I did have the last days when unit testing was running out of video memory all the when creating the DirectX device (getting D3DERR_OUTOFVIDEOMEMORY exceptions) after ~10 tests. When restarting VS, everything worked again for some time.

I worked with that problem all week and found no solution, I changed a lot of debug settings and changed some parts of the code, but nothing helped and there wasn't any solution for out of video memory exceptions posted anywhere (my card has 128MB, how can I run out of vid mem after a couple of tests?). Then I saw that some part of the screenshot generation code wasn't finished and I saw the presentParams.SwapMode was set to Flip instead of Discard (Discard is somewhat faster, but Flip allowed me to easily catch the back buffer for the screenshot generation). I changed that, reduced the back buffer count to double-buffering and reduced the resolution for tests from 1024x768 to 800x600 and never had any Out of Video Memory exceptions since then. Maybe they happen after over 50 or 100 unit test runs, but then I can just restart VS and it is not as annoying as before.

VS2005 needs a lot of RAM

But VS2005 consumes still a lot of RAM (>800MB, I got only 512MB ram on my dev machine). I guess I have to buy some more RAM soon, everything gets very slow and crashes more often when all the ram is used (and I can't work without VS2005 anymore). Restarting VS helps, but with that much complex unit tests the memory comsumption goes up very fast again. For example todays screenshot is actually just a unit test with around 50 lines of code, making very simple unit tests helps a lot to force you to refactor and simplyfy your code constantly.

Todays Links

The links for today are The Z Buffer and Managed world, both great Managed-DirectX sites.

If any StarCraft fan reads this, the guys from did have a lot of troubles with their hosting partner and left the partner. was one of the greatest StarCraft community sites ever IMO, the new site is called Looks like the crew will continue their great work there, so check it out (the site has still some bugs because it is new): Good luck


I'm now going to visit the Tropical-Islands resort (new big thing here in germany) with my brothers and some friends :) Development will continue tomorrow.