Spellcaster Studios

Make it happen…

Playthrough, Part VI

Today I carried on with the storyline development, but I hit a snag pretty fast…

When I started to develop the grenades, the idea was to have a boss enemy that had the machine gun and the flashbang grenade, and to alternate between them…

The problem was the way I was making the firing decisions on the AI.

Basically, every enemy had a “cycle time” for melee and ranged weapons. The weapon could then be queried to see if it should/could fire at any point in time. All weapons had such a function… This worked fine for a single ranged and single melee weapon, but when you have two ranged weapon, it doesn’t anymore.

For example, imagine you have a cycle time of 5 seconds for the machine gun and 10 seconds for the grenade, and that the grenade should fire at the end of the 10 second period, and the machine gun during the first half second of the 5 second cycle.

So, the game would decide the machine gun should fire (so it would become the active weapon), and the the cycle would end at the 5-second mark, so it would never reach the end of the 10-second cycle, which made the grenades never fire!

Sorting this one was simple (although a lot of work): I transferred the tracking of the cycle times to each weapon, so both would be kept tracked individually.

But then I hit another problem… Imagine the machine gun has a 5 second cycle, and that it would fire for the first 1.5 second. And you have the grenade with a 6 second cycle, and it would fire when it passed the 5.5 second mark.

In this case, what would happen is that the weapon selected was the machine gun, it would start to fire (so no new weapon decision was made), and then when the firing stopped (at the 6.5s mark), it would see if it could fire the grenade… But the grenade only fires at the 5.5 mark!

After a lot of going back and forth, I decided to change the way the AIs work. They now try to fire all the weapons, so they can fire the grenade while firing the machine gun. The only source of problems is the range of different weapons, but for that I always take the longest range weapon (so the enemy is safer).

After that, I could assemble the new cutscene, but I kind of forgot that I had to keep the player/enemy in the room where the showdown took place, and that took a whole bunch of code so I could “close” the doors on the lair:

screen157

Each time I think “now I just have to fix bugs and add content to be able to get to the end of the game”, I find one million small things that have to be fixed and tweaked, but hopefully it’s all to make a better game…

I won’t even comment in the amount of ideas that are on the drawer for a possible sequel/offshoot!

Now listening to “Inhuman Rampage” by “Dragonforce”

Link of the Day: This has to be one of the funniest things I’ve found on the net lately: https://www.youtube.com/watch?feature=player_embedded&v=W8X5ESeeHds

Comment