Pain & Prototyping


Author: Tyler Clardy

Date Posted: 5/2/2024

This week was a whirlwind of activity for me, mostly revolving around bugfixing, adding new abilities, and adding new gameplay systems. I intend to talk about some of the more noteworthy additions, and some of the challenges they posed, here.

To start with, this week I added a fully fleshed-out currency system and ammo system, then finished the stamina system as well as the damage & death system. The ammo and currency systems both required significant changes to the GAS code, and while I was in there I discovered I had overlooked a bunch of needed functionality for broadcasting and applying changes to the attributes. This was a lucky find and saved me some head-scratching that definitely would've happened down the line when working with various attributes. 

I added 11 SFX, 2 VFX, and a new musical track to the project and implemented all of them, before moving on to finishing the HUD, creating an ammo pickup & health pickup, and fixing various bugs. A notable bug from this bunch was with the overlap events on the Spike Trap. It was animating really unreliably and acting funny when interacted with in our testing level. I came to realize it was because the player was generating overlap events too and causing the trap to deploy and retract its spikes at unexpected times. I figured out this was due to the trap's logic checking for overlaps with any BaseCharacter, the class that all our enemies inherit from too. Once I switched this to check for specifically overlap events with the enemy it began to work great.

Lastly, I added several new player abilities - a reload, a melee kick, and the beginnings of our Spawn Trap system. The kick gave me some serious trouble, in that the basic functionality worked fine and did not take too long to make, but I really wanted to apply a knockback effect to the enemy after damage was dealt. I intended the kick to have low damage, and be more for moving enemies into traps or defenses. The knockback effect took me multiple tries across 2 days, but ultimately I got it working using the simplest method - Adding impulse directly to the targeted enemy's Movement Component using the opposite of the player character's forward vector. I was even able to add a little bit of an up effect by taking the player characters up vector, multiplying it by a scalar, and multiplying the result with the forward vector before doing the original calculation. This made it look much nicer. 

The final thing worth mentioning is the Spawn Trap system. When I first started implementing this feature I approached it all wrong. The idea was sound, but I massively overcomplicated it and ended up working for almost 2 hours before realizing my mistake, ultimately having to revert many changes, delete several additions, and start creating the system again from scratch. I originally created a small cylinder with a box collider attached to it as part of the player blueprint, then set it to have no collision at all and the box collider to only generate overlap events. Next I setup the onBeginOverlap to turn the targeting cylinder red, and the onEndOverlap to turn the targeting cylinder green - intending this to be a visual indicator of whether the player would be allowed to place a trap in this location. This caused bugs with pickups and already placed traps, as I had not fixed the spike trap overlap bug yet - so it was still detecting player collisions. The targeting cylinder was hidden from view during play, until you began the Spawn Trap ability with the 'Q' button. But even when it was hidden it was generating overlap events as the player, causing it to activate things several feet in front of the player character with no indication as to why they were activating. Caused me quite a headache solving that one.

In the end, I found myself completely stuck when attempting to spawn a trap at the location of the targeting cylinder. I spent ages trying various methods of doing so and was met with very limited success. No matter what I did it seemed completely broken at worst, and very janky at best. Thankfully, while researching online, I discovered GAS has a built-in, but seemingly poorly documented, way of doing this already - visual targeting aides and all! I ended up scrapping much of the work that had been done previously, including the targeting cylinder and the overlap changes I had made to fix its use, and implementing the GAS method instead. After some fine-tuning, I was on to a winner.

This week's sprint was an important one, and I am very pleased with what I accomplished as well as the state of the game. Between my work on the gameplay, abilities, HUD, and SFX and my teammate's work on the menus, AI, enemies, and gameloop we have ended up with an extremely solid prototype. I am excited to see where we can take Space Defenders in the coming months. Lots to look forward to!

Leave a comment

Log in with itch.io to leave a comment.