Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Needles & Symbols

Sign in to follow this  



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.

Sign in to follow this  


Recommended Comments

Guest Anonymous Poster


How about making the spikes 'reflect' from walls, depending on the hit angle.

Also, different material hardness affecting the spike behaviour (stick or just bounce off) would make a nice small effect, but if you don't have a material system and other uses for the parameter it might not be worth it..

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!