The engine is definitely shaping up - now it's to the point where you can make a level, run around & kill enemies, who do a reasonable job of fighting back.
I have been hankering to add some other weapons to the game, so I decided to add a gun that shoots Needles. Basically, it's similar to a laser gun, except that the gun shoots glowing spikes. I gave them a different through the air sound, and made them stick in the wall!
This required a few code changes, so that if the needles hit a character, they do damage & disappear, but if they hit the world geometry, then they stick, and eventually fade away.
Experimenting with this also prompted me to change the way culling works when a bolt or needle hits something.
Earlier in the project, the enemies would move randomly around the level, and shoot if they were near the player, even if they didn't have line of sight. This caused a cacophony of laser sounds & blasts that quickly caused clipping, so I added view frustum culling, so when a bolt was off-screen, it didn't generate sparks, smoke, a decal or a sound.
Now that the AI is a little smarter, they only shoot when they have a clear shot, and have ammo, etc. so this culling doesn't have to be so aggressive.
I tried expanding the bolt bounding box for the purposes of this check, but didn't solve the problems when the needles would go past the player into the wall just out of sight, but wouldn't make a sound or leave a decal behind.
I changed the culling so that sparks & smoke are not generated offscreen, since these don't last long enough to notice, but the sound, decal, and sticking needles remain. Much better.
In the process, I had to make some changes to the sound code. Before today, I had 2D sounds, or 3d sounds with some object as the sound source. In the case of a needle or laser bolt making a hit sound, the bolt itself is dead, so it couldn't be the sound source. The sparks wouldn't be made if offscreen, so they couldn't be the sound source either, and a decal is not always created depending on what is hit, and the angle of the shot ( so the texture doesn't stretch too much ).
So, I added the capability to specify a position & velocity when creating a sound, instead of a sound source. This way I can play the needle hit sound at the right spot without needing a source for it.
I also changed the needle decals so they are smaller than the laser bolts. Perhaps I should change the code so that decal size is directly proportional to weapon damage.
I also added a symbol decal. These will provide clues to the player as to the location of other levels, etc.