This week has been a long week for development, I’ve cleaned up a lot of my work and committed it to our main build so that the other members of the team could see the progress I had made. First was the finished addition of the squad struct added to the Squad Manager and working on the retreat location for leaderless squad spiders.
After some lengthy discussion with the team we decided that the wolf growling at the spiders to slow them down didn’t feel like a good mechanic because it made it almost impossible for the spiders to actually get close or hurt the child. We decided to replace this with a feature that causes the spiders to retreat to a location away from the Wolf.
The larger feature I worked on this week was implementing the Spider Queens mechanics for the end boss fight. The Queen needed to move into a reared state when growled at by the Wolf and this would cause her to become vulnerable to the Child’s slingshot. I achieved this by adding a second hitbox that was only visible and used when the spider queen was in a reared state. When she takes damage she returns to her starting point where you have to repeat the previous actions two more times.
Tomas added an extra event to the fight as we felt it was too simplistic in its current form, the spider queen now spawns a ranged spider every 10 seconds until the queen is defeated. This added some more complexity to the fight and was a welcome addition.
Lasted was the wildlife that we wanted to add to the game to give the environment a more lively feel. I was originally going to implement them using the navmesh function that finds a random point within the navmesh and then it would path to it but Bradley and Tomas has discussed this and decided it would be easier to use Splines. Tomas created the basic spline which the given actor would follow.
I tweaked this so that we could delete wildlife once they had traversed their given spline. I did this using the following blueprint.
This week following the milestone was assessing some of the problems we felt had cropped up including the Wolf being able to slow the spiders, I discussed this last week and talked about how I was going to replace it with function that would make the Spiders back off to a location based on the Wolf’s location. I have begun implementing this behaviour during this week and I am refining it to work correctly but the core functionality is ready. The difficulty for this comes with finding a position in the Navmesh that is in the opposite direction to the wolf.
Secondly Bradley felt that the Squad Manager could do with some optimisations so he put together a struct in C++ and asked me to implement it and optimise the code. I took on this task and I have struggled with trying to reduce the complexity of the code within the time frame we have available but I feel I’ve been able to make it a little simpler.
This code allows us to reuse the same collections over and over to help cut down on creating different Array’s to store data at runtime. We can store a list of spiders, store the squad’s leader and we can also store a lot more within this one data structure allowing us to keep squad information in a single place.
finally this week I worked on allowing the small spiders to retreat to a chosen point at runtime when they’re no longer part of a squad, this allows us to add an interesting behaviour to the spiders to run away and it also allows us to clean them up when they’re out of view.
Overall due to the time the optimisations have taken I haven’t gotten a lot more done this week but I have been given my task list from now until the end of the project and will now be moving onto the Boss mechanics and wildlife AI behaviours.
Thanks for reading!
This week leading up to the week 8 milestone was all about getting our features implemented and in a good condition, reducing as many bugs as possible so that the experience was as good as possible. I feel like we achieved this and with minimal issues with the game.
New features that I worked on this week were making the squad spiders retreat once they have lost their leader. I did this by getting the location of the Child and The Squads position and then finding a position in the opposite direction so that the spiders appeared to retreat. I coded this in C++ originally but during the time I had to complete this feature I was unable to get the Navmesh correctly so I instead for the purposes of the demo made the squads retreat to a specific location. This feature will be fixed this week alongside many other improvements.
Next I worked on fixing the problem the squad spiders caused for the leaders, the squad spiders were blocking the movement of the leaders making them immobile. I fixed this by borrowing a little trick that Tomas and Aleks used for the patrolling of the Leaders. I took the leaders position and made the squad spiders pick a point around the leader to patrol to, this added the feel of them scuttling around. Now the leaders can move freely without much trouble from the squads.
Two more fixes for this week was when the Wolf character growls at AI’s it would slow them down but this has prooved to be a bad implementation and next week I will be replacing it with a retreat action when the AI’s are scared. The second fix was allowing the spiders to damage the child and actually inflict their damage as insanity, I did this by calling the blueprint implementable function which calls Bradley’s C++ sanity function.
Finally for this week I added code that allows us to reset the current map to the main menu so that we can always start a fresh game, I mapped this to the select button on an xbox controller.
Throughout this week I have worked on a range of tasks for the project, some of these include converting blueprint agents to C++, bug fixing and tweaks to the gameplay.
The largest task was the conversion of the AI and Squad Manager from its blueprint state to a C++ implementation, the C++ has made it a lot easier to add to the agents in the future and has stopped us from having to search through webs of blueprint that become unmanagable and hard to debug. Bradley and I worked on the C++ conversion together he figured out the logic and I wrote the code and offered what advice I could.
We started by creating C++ classes for the three types of agent and the three controllers that was unique to each type of agent. These classes all inherited from a baseSpider class which had the very basic implementations for what each spider would do. We also created leader classes that all also inherited from the baseSpider these contained the information required for confirming things like the squadID and if they’re a leader.
We then moved onto creating the Squad Manager which would find all of the Melee and Ranged spiders for the use of assigning them as leaders and then also finding all of the swarm agents to assign to the leaders. We introduced multiple squads in this implementation unlike the blueprint version so now there can be multiple leaders and multiple squad. Squads can merge if they have lost their leader allowing the smaller spiders to be reused. This peer programming experience helped me to understand fundimental aspects of the C++ coding for Unreal Engine 4 and has given me a great starting point to continue more of my work with C++.
The rest of the week I have worked on the Child and Spiders implementing their skeleton meshes, they’re yet to be textured or animated but they’re in and the child is ready to have her basic animations implemented by either Bradley or myself. I also worked on fixing bugs within the behaviour tree’s of the agents and refining they’re movement and attacking behaviours.
Finally I have fixed a few bugs including the Wolf’s howl correctly slowing down the agents nearby, slowing the agents down in general as they were incredibly quick and tweaking the Navmesh to support better movement throughout the gameworld.
The C++ agents still needs some work so that the squad spiders run away from the player if they have lost their leader and more tweaking of movement and patrolling.