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

Level-of-detail in particles and debris

It took me a while to get support for this in. I still need some decent tools to get my particle effects placement faster and easier.

Anyway…. there is now some basic LOD support for particle emitters and the debris particles. That means I can have buckets of both and only render what I need (although tragically you still need to update a lot of it for consistency sake). here’s a screenshot showing debris increasing as you zoom in. It doesn’t look like I’m zooming in the way I cropped the screens, but I am :D

It’s faked a bit with a sudden detonation, so the screen looks a bit sparse, but it looks very cool in the game :D. It’s nice that it fades into view rather than having any popup.

I’ve been adding in hulk textures for all the frigates today, doing texture-atlases for the fighter hulks, and re-rendering some of them to prevent black jaggies around them at low zoom, designing some more AI fleets and generally fixing and tweaking.

Fighter Hulks and some aborted stuff

I spent most of Saturday wasting my time on code that I reverted. Long long hours were spent working on bloom effects and shadows for ships passing over each other.  Eventually both were rejected. The bloom code simply didn’t look that good, and the shadow stuff proved to be hideously involved and likely very slow. I know people might assume you can do it simply by just rendering the ships to a separate render target complete with shadows, then slotting in the background later, but you can’t, due to laser and particle effects lying ‘between’ ships and also needing to be blended with the map background at render time.

Anyway… who cares :D

What I *have* got working is hulks for fighters. Previously a destroyed fighter was just obliterated by a fairly low res particle effect. The effect still needs improving, but now destroyed fighters linger as debris. Crucially, the fighter hulk maintains its momentum for a while, so they look like their engines just got shot out, and they also drift faster than the big lumbering cruiser hulks. This all looks a bit nicer than before where they just vanished. I also went through and got 4 variants of hulk done for each fighter.

Now I’m rendering out a few more loading screens, and later I’ll work on some improvements to particle stuff. Monday onwards will be ai-fleet design and general game balancing.

Another gratuitous day

7.10am Awoken to sound of suicidal duck crashing into bedroom window and leaving comical imprint. AGAIN.
8.00am Arguing with banks on the phone. very annoying
8.30am checking games news websites and dealing with emails
9.00am decided that today I will fix this crash bug that gives me a ‘corrupted heap’ error
9.25am I have reproducible steps to identify the bug, and know its to do with deleting ships before starting a new battle. It’s less clear whether or not its a specific thing being deleted, because in typical heisenbug fashion, nothing seems to trigger it when I step through the code.
9.29am Aha, if I quite the battle immediately before restarting, it doesn’t happen, so its the deletion of some memory allocated at some point mid-battle. but what? I should have used smart pointers (C++ thing)
9.45am Fixed! There was code when a repair module was deleted for it to grab the module it was repairing and tell it that it was no longer repairing it. The problem was that the target module may have been deleted before the repair module was, so when they both get deleted when the fleet is deleted, it caused a crash.
10.00am Fixed some layout issues on the deployment interface, now working on a better ECM beam effect
10.10am Discussing music with my musician over MSN, explaining the different alien races.
10.46am Everything works fine, but when ships with ECM turrets cloak, the ECM turrets don’t cloak with the ship. hmmmm….
11.00am Croissants
12.50pm Still tweaking and fiddling trying to get an ECM beam that looks ok. Resorting to normal beam laser effects now.
1.05pm Thats enough on ECM beams. I spotted some badly placed turrets on federation eagle cruiser, so moving those.
1.30pm The ECM shock weapon doesn’t seem to work, in that affected ships still fire weapons. Investigating…
3.30pm Investigating a sound bug.
4.10pm Working on better visual debugging data for my sound system, to track down what is going on here.
4.25pm Some sound channels do not seem to update, and some seem to be ‘mystery’ sounds which I have no idea where they came from. bah..
6.25pm Still working on the sound code. Debugging has led me to find all sorts of things that were not set up right, but I still have some sounds that ‘linger’ or don’t play.
7.10pm Everything looks like its working now, following some serious re-writing and tidying of the way sound channels get allocated and re-used. I need food and maybe a game of company of heroes.

Lightning!

I’ve been tweaking and fixing a few small things lately, sounds that do not play, some graphical problems, and some bugs caused by recently introduced new features (I managed to screw up the way shields worked when I added cod to make ‘stacked’ shields less effective.

In amongst this, the only true ‘new’ feature that has gone in is the alliance ‘lightning gun’. It’s basically just a beam laser, but drawn entirely differently. 10 minutes of reading photoshop tutorials got me up to speed with rendering lightning, and then a bunch of rendered strips of lightning later, I wrote code which works out how many ‘chunks fit in a beam, and stuck together a string of them so the ship looks like its electrocuting its enemies.

The code isn’t that simple, because you want the beam to zig zag everywherem, but hit its origin and target exactly, which is a bit fiddly. I also had it change which bits of lightning to use every 10th of a second so it looks like it flickers, and had to ensure that multiple beams from the same ship start at different points so you can’t tell the same texture pattern was being used.

Having said all this, the biggest effort was picking out a sound effect for it, which I’m still not happy with and am not confident is playing right. 30 minutes of previewing sounds of electrical static is a bit wearisome in 86 degrees in the indoors with an overheating PC by your legs.

All good fun I guess.

Better Damage Effects

I have a vaguely usable hacked together damage editor which means I can make a few improvements to the ships now. I’ve only done 1 so far, but with the tools in place the rest shouldn’t take more than a day. Here is a screenshot showing a federation cruiser and the changes:

A) This shows that some damage has knocked out the lighting on the warp nacelle. This is actually just visual and does not correspond to engine damage, that would be a nightmare, but it still looks better than them staying on :D Also, two of the tiny orange lights have been knocked out by another hit (bottom A)

B) These tiny impact ‘scars’ are new. By having a lot of these scattered around the ship, the targets selected by enemy ships seem less predictable and more random, although they are pre-assigned in truth, and then scrambled in order.

C) My editor lets me easily add ‘permanent’ smoke or spark effects to each damage texture, so they don’t seem too similar. Most major impacts result in a complex smoke and flames emitter anyway, but only some of those smoke effects stay around for the lifetime of the ship.

This screenshot was taken using my debugging hacks, so it’s not really representative. Normally a ship hit this much would be flying through a lot of debris and maybe hulks from other ships, so it would look a bit better :D

Comments?