Spring Cleaning & Optimisations

I was testing the new cover mechanic when I stumbled upon a second game breaking bug. Like the first, none of my attempts to fix it worked. The original bug threw up an error about being unable to find the enemy's path, so I made sure to always check the enemy's path existed before trying to assign it, and an else condition created said path if it didn't exist.. the bug was seemingly random, it was semi-repeatable but generally it just felt like a bloody ghost in the machine.

With the emergence of a second, I realised I really needed to rip out some of this old redundant code. There was a lot of remnant code for features like body carrying, crouching ect that was causing problems. I also took this opportunity to remove redundant objects, sprites, backgrounds ect. The project had started to bloat with old stuff. For example, I had three variables that identical functions -- clearly remnants from three separate attempts to do the same thing at three different dates. Probably months apart!

I've migrated the healthy code to a fresh project file, and began optimising. Some new things!

  • Subtle "acceleration" in player's movement, makes tapping keys for tiny steps much more accurate and creates a nice wind-up when moving.
  • Enemies now have a "draw" animation for when they're undercover, so instead of having their weapon visibly out they pull it from their coat pocket and cock it ready to fire
  • Enemies now advance slowly while firing, instead of standing still
  • Enemies will become alterted if they glimpse the player enough times. You can't run back and forth constantly, even if their "spotted" timer doesn't fill they still get suspicious and after 2-3 sightings will put 2 and 2 together and assume that blur was not friendly
  • Enemies' upper bodies must be facing their movement direction before they can move, so if they need to turn around and run they must turn around first.. no more turning and moving at full speed like they're on a rollerball!
I noticed during testing that I'd only pick up weapons in the level if my primary was completely empty, and then I'd pick up an enemy machine gun and hoover up all the ammo lying around and hey presto, I have a fully armed primary weapon again. It felt.. underwhelming.

As a direct response, I've fundementally altered how pickups work. When you pick up an enemy weapon, you do not pick up all the extra ammo on them. You don't stop to take the bullets out of an enemy gun when you walk over it. Once that gun is dry, you throw it, you grab another, or you switch to your pistol.

You cannot drop or throw your pistol, but it has a lot more ammo. I'm considering infinite, but it's hard to know where to draw the line so the player can't abuse it. 

You get ~3 reloads for your main weapon at the mission start, properly calculated for shotguns so you get ( 3 x Max Capacity ) in shells (shotguns reload one shell at a time, not as a clip like others). Reloading drops the entire clip -- so no Call of Duty reloading after every burst!

This had the unexpected benefit of making shotguns more valuable, you can "top up" your ammo without wasting any, meaning you never enter a room half-loaded.

I should have some more time this weekend so hopefully another update tomorrow! 

- Rob


Popular posts from this blog

A productive day!

Excuses and a minor update

Inventory / Weapon Icons