(February 2022 - April 2022)
Background
Back From the Future Past is a team project that I worked on along with 5 other students. My main role was the sole scripter for the team. This game is a top-down shooter with wave based enemy spawning.
The entirety of the game revolves around shooting aliens to keep yourself alive. As you kill enemies, they could potentially drop temporary power ups for your gun or yourself, with those power ups being only available for a duration. The game has no real ending, so the main goal is just to see how long the player can last fending off all the aliens after the precious hard drives.
Creating Procedural Walls
I was the sole programmer for my team. I had to coordinate with our artists and designers to develop a unique gameplay experience compared to other top-down shooters. We decided that we wanted to randomize the bounds of the walls to create interesting situations while also mixing up the players style in how they combat this. This wasn't done through randomly selecting a premade map from a list, but rather creating the walls from randomized points within a specific set of bounds for each set of points when the game begins. Down below you can see the theory for it, as well as my execution of it. I did not come up with this method for creating irregular shaped rooms. Website for method
Confronting Enemy Spawning
This part of the process seemed simple in thought but proved to be much more difficult in practice. I wanted the enemies to spawn within the bounds of the irregular room. The only constraints were that they need to spawn in the walls and be out of the camera view of the player. The method that I thought would be best was to spawn the enemies using line traces from a point within the shape and have enemies spawn on those random points on the lines but not past the impact points. I would then add a branch that would check the vector distance between the player and random point to see if it was far enough away. I ended up getting several items spawning outside the walls and the example cylinders weren't even spawning on the lines. The only time they would properly spawn on the lines is if there was only one line trace. I decided it was best to just allow enemies to spawn outside but be able to walk through the walls so that the player would still be able to progress.
Random Obstacle Spawning within Walls
I managed to figure out that the problem within my line tracing from before was in the method of spawning and not the calculation of the spawn point. I figured this out through working with spawning obstacles in a similar manner and it worked! Every single pillar is on a point along a line trace while still being within the boundaries. I am still working on making it so they can't spawn too close to the player though. I also added basic UI for Health and a countdown timer for when each wave of enemies come. I added Paragon models to the enemies which were free from the Epic Games Marketplace. I do not own those models, nor their animations.
Power Ups
During the planning phase for the game mechanics, I decided that we would want to include power ups in our game to create interesting gameplay and possibly save the player from being overwhelmed by too many enemies. The three power ups I planned to implement were: Damage Increase, Speed Increase, and Rapid Fire. Each would have a very small chance (10%) to spawn from the enemies when they are killed.
A problem that I initially had when trying to program the Damage Increase power up was that I was unsure how to call a function from within the projectile to increase it's own damage based on if the player had picked up a Damage Up. I forgot that I had set the character as an owner to the projectile so there was already a link between the player and character. This allowed me to pull the information from the character into the projectile and have it check whether damage should be increased on Event Begin Play as soon as it is spawned.
I originally wanted the power ups to stack over and over and strengthen the player along the way. This would be accompanied with the enemies getting better stats each wave. I realized that this method has the enemies scale on a definite number while the player scales based on a low chance drop. It would create unfair situations for the player most if not all the time. I changed it so that the power ups were big jumps, but temporary. Picking up the same power up resets the duration.
Icons were created by Peter Sanders & Michael Plite
The Challenges + What I Learned
The most challenging part so far was converting multiple real equations and techniques into Unreal 4. There were several times where the walls would just overlap each other and create triangle sections the player could not access because I was making tiny errors in the blueprints. There also wasn't much information on irregular shaped rooms on the web so it felt like I was shooting in the dark working on my own. I was only able to find the process in the image above but no other help than that. It was frustrating to find the issues but it helped me with learning complex math in Unreal 4. I was able to solve previous problems by tackling new ones later on. This also aided in my ability to create unique gameplay through procedural generation. Each playthrough will be different as a result of these changing boundaries and obstacles. The player could get a narrow map, a circular map, or a mixture of both. This can create unique situations such as choke points on narrow corners. It's very interesting to think about how these changes can have huge impacts on the gameplay.