Spaceman

This is a project about a man who has to infiltrate a space laboratory that has been taken over by cybernetically enhanced mercinaries. The goal of the game is to eradicate everyone that is there while also researching what they were working on that was so important for the mercenaries.

The game itself is a first person shooter where you need to traverse the laboratory and eliminate threaths. You can also scan the enviroment to learn more about the mercinaries and the research that was going on in there.

For this project I was the programmer, and was responsible for the functionality of the game. Some of the things I made in this project are a modular weapon system, A* pathfinding, Custom character physics, and the enemy behavior.

Modular Weapon Mechanism

Since this was a shooter I wanted to make the guns feel good to use. I did this by first researching multiple games on what effect are applied to the weapon/player when performing certain actions. My main inspiration was Borderlands 3 because friends of mine said that the game has amazing weaponfeel. I eventually added spread and recoil with compensation support, while also applying multiple effect on how the gun moves itself based on movement and inputs.

Besides making the guns feel good I wanted to make it as modular as  possible in order to easily add more types of weapons. You can easily change hard stats like damage and firerate. But also change the firetype from singlefire – burst – autofire. I also added the option to change the projectiles from a prefab or just raycasts.

I’ve made a page dedicated to this where you can read more about how this works.

 

A* grid optimization

For this project I made a new itteration of A* pathfinding. But I wanted to optimize it more in order to retain acceptable fps while fighting a high number of enemies. The way I achieved this by optimizing the grid and adding multithreading.

Optimizing the grid was somewhat tricky. The way I achieved this by trying to combine tiles when there is nothing obstructing it. This is great to skip large area’s of the pathfinding due to there being less tiles. While still retaining the detail of the grid by keeping the tile size around the edges. 

I did walk into a problem with this, I was generating the grid again each time you loaded up a scene. Because of this you had to wait a long time before you could continue to play. This is ofcourse not optimal, to fix this I opted to generate the grid before loading the scene. I did this by saving the grid inside a scriptable object that could be dragged into the pathfinding.

Besides this I added multithreading to speed up the calculation of the paths for the enemies by doing this outside of the main thread. This way the game won’t freeze when calculating.

To learn more about A* or the way I handled it in different scenario’s I’ve made a dedicated page for this where you can read more about this.

Enemies + Gore System

When making a shooter it would be a good idea to add enemies you can shoot, so thats this. I wanted to make this modular aswell, so each enemy has the same script. You can set each enemies stats and the way they behave. If they follow the player or just get him in view and within attacking range. You can also set what type of attack it has. Changing if they hit you or if they shoot a projectile.

To add a bit more flair to the enemies I also added a gore system to them. Besides blood when shooting him each limb also has it’s own health. When it is damaged enough it will explode and spew gibs and blood. I also added a bonus to this that when enemies die they can still get damage to their bodyparts from attacking them or kinetic forces. So for example if you kick an enemy into a wall with a high enough force their body will explode in a gory mess.

Failsafe

Failsafe is the AI companion of the player, she will inform you about your objective or tell you about the objects you have scanned.

The way it works is when you perform a certain action a scriptable object with text and voicelines will be loaded. Failsafe and a textbox will then display and give you the information you need. Each text in scriptable object is cut up in characters in order to display them one for one. The time this takes to display is bound to the length of the voiceline. This way the text and voice are more synced up.

Failsafes mouth is also synced up to the words she is speaking. There is a list with multiple moutshapes and characters bound to it. When each letter is displayed it will go through that list and select the right mouthshape that is used for that character.

(Failsafe art was made by Thomas Bliekendaal)