Game Design, Programming and running a one-man games business…

explosions, texture swaps, allsorts…

I spent part of today adding new explosion effects to the game. Until now, all my particles have had random rotation. This makes them look natural, but for some explosion effects you want the particles to be ‘stretched’ and thus for them to be angled in the direction they face. Anyway, that’s in and looking good.

Also today I added some basic physics to debris so that when there is a big white explosive flash, it’s applied as a force to the debris which makes the explosion seem more 3D and impressive.

I’ve also been thinking about techniques to reduce the number of texture-swaps per frame, which is currently scarily high in some cases. I can’t easily use z-buffers for the game because the huge amount of alpha-blending that I do. (I tried it, and its slower). One thing I’m considering is more use of (manually assembled) texture atlases, another is to make greater use of concurrency by scheduling some tasks for processing by the CPU while the GPU is busy swapping textures.

I havent implemented resolution changing yet, but I’ll be taking everyone’s suggestions for doing so on-board on monday when I do it. I suspect I’ll display all options above a certain minimum height.

Website updated with FAQ and new screenshots

Yesterday I got the GSB website updated a bit, adding the final logo for the game and some small new screen shots and a FAQ. You can see it here:

http://positech.co.uk/gratuitousspacebattles/

And the faq is here:

http://positech.co.uk/gratuitousspacebattles/faq.html

As well as that, I also got the last few bits of GUI done, so the in-game GUI now is generally the final one, not the crappy one in the BBC video, although I’m hoping to add various bits of polish to it here and there. I also have a tutorial to do, and need to code in support for switching screen resolutions as well. From then on it’s back to play balancing and final weapons and data for the simulation.

The screen resolution system will probably support a number of fixed resolutions to choose from, if your card supports them. In the past, I’ve coded games that basically ask the card what it can do and let the player pick, but that can be hellishly awful to support, as some cards return about 100 options, and some can be obscure. Right now, the game needs 1024×768 minimum, but I might try and squash it to 600 for netbooks.

I definitely aim to support at least one stupidly big res, probably 1900 1200 res. If your video card can do it, the game will look real nice at that size.

Anti-Missile weapons

Currently there are two anti-missile weapons in Gratuitous Space Battles. Point Defence Lasers and ECM beams. The point defence laser basically tracks incoming missiles and just zap them. They always hit (at the moment) and take one out. Of course, they can be overloaded,e specially by multiple-warhead missiles, but they are pretty cool. The other one (ECM beam) does exactly the same, but rather than destroy the missile it scrambles its guidance system and there is a cool wibbly wobbly effect as it veers everywhere. In the final game, the choice between them will probably be some sort of crew/power/cost/weight trade-off.

The thing they share though, is that they can ONLY target missiles that are aimed at their ship. You can’t have an ECM frigate at the spearhead of your fleet zapping all the incoming missiles to screen your capital ships from attack.

Clearly this sucks.

The solution isn’t trivial though. There are a LOT of ships in GSB and a LOT going on. if I’m to enable anti-missile weaponry to select from any missile on the map, that will involve a lot of processing. My mind is agog with quadtrees and other methods of limiting the amount of times each weapon has to do this:

for(each missile)
{
are_you_the_closest_one?
}

etc. It would normally be a trivial thing, but it’s something that isn’t in the game yet because it hasn’t really been necessary. The question is, do I write some big generic system that every piece of taregt selection will reference to find the nearest object? if so, that involves a fair bit of re-work, and it’s likely to be a several-cups-of-tea and a free morning sort of problem.

Current Optimisation targets

Stuff that is currently slow in really hectic games:

  • The ‘smart’ sprite texture for the shield impact sprite gets created and destroyed a lot at runtime
  • The sound engine spends a lot of time looking for free sound channels or cached sounds
  • Drawing of blast textures for bullet turrets is slow somehow. Lots of small 2-primitive draws I suppose.
  • Drawing Missiles and missile glares and trails
  • Drawing debris

I love optimising, and the frame rate isn’t too shabby even with all hell breaking loose, but it would be cool to get it much better in the hope of adding some really gratuitous extra effects later on for fast cards.

Space Hulk particle test video

Now that the hull editor for the game actually does something, I managed to put it to the test by adding some particle emitters to the drifting ‘hulk’ from one of the federation cruisers. This short youtube video shows the ship being destroyed, and then you can just about make out the flickering particles on the damaged hulk. It look much better not in crappy youtube resolution.

Right now they all flicker off at a fixed LOD, but I’ll sort that out so it’s less obvious, then I can add them to all of the ships. I’m aiming for a look where people can zoom in during a battle and be impressed with the amount of silly detail I went to in order to make it all look cool.

This is fun bank-holiday-weekedn stuff. Tomorrow it’s back to php and MySQL. bah!