This week’s focus (alongside writing my progress report & producing concept art) has been on building and polishing up the groundwork for the level design pipeline, where this means I have been refining and setting up blueprint actors to help speed up that process. Alongside that, I have also been refining the mechanics and values so that the level design process is smoother and easier to test with a framework already laid down for the character controller.
Dynamic Crouching & Sliding
My previous approach to allowing the player to crouch under objects was to utilize volumes to adjust the capsule height to fit inside the volume – this, however, was very inefficient and temperamental. To replace this I have added a dynamic crouching system which checks for the height of the space in front (and at the player’s position if nothing is found to check if they are already underneath something) and then smoothly adjusts the capsule height to match.
This works extremely well (and is limited by the capsule radius so the player can only crouch to a certain height) and goes hand-in-hand with the sliding system which makes the player crouch and pushes them along – meaning they can slide underneath obstacles without any hitches.
This section of the script is being executed every frame to constantly find and interpolate between the previous crouch height to the target crouch height – this allows for smooth movement and for it to remain dynamic.
Inside the GetCrouchAdjustmentHeight() function – a raycast (line trace) to first check if there is anything in front of the player (i.e. don’t try to adjust the crouch height if crouched in front of a wall out in the open), then check the space in front (raycast from bottom to the player’s default crouch height), and if that fails then check with a spherecast to check if the player is underneath anything already. This returns whether the hit was successful and the height at which to adjust if it is.
Locational Damage & Pistol Damage Mapping
I also laid the groundwork for applying location-based damage multipliers on the enemies through the standard damage system in order to allow for more tactical damage (which fits into the immerse sim style of gameplay). For example, hitting the head will vastly increase the damage caused, whereas shooting the foot will cause significantly less damage. This system uses scene components which store the necessary data I need and allows me to attach this data to the enemy’s skeleton bones via the socket attachment system, meaning I can also tag which bones can be dismembered (only on death currently to avoid having to create variations of animations).
This is the code which uses the built-in function for finding the closest bone to a location which I can then pass to my own function to find the closest bone up the hierarchy which has the locational based damage data. As usual, my scripting is standardized into re-usable functions (which also allow to abstract functionality into local scope) and exposed via an event to allow for execution latency and to pass in the required data I need (i.e. base damage, location hit, impulse to apply on death for visual feedback etc).
This system also adds support for blood splatters which basically extend the base particle and decal actors to allow me to spawn decals which internally handle the animation of blood, as well as spawning blood decals from particle collisions.
The pistol has also been reworked to utilize this overhauled system, as well as added features such as bullet penetration (for hitting multiple targets & adjusting damage accordingly), a damage curve to remap the damage to over the firing range, and applying an impulse to enemies upon death. This also utilizes sphere-casting to emulate the spread of the pistol and to feel the most responsive (as projectile-based can cause problems).
Building Tiler & Improved Material Overrides
The reworked building tiler system now allows for a lot more control than before so that I can easily block in spaces using existing assets, provide variation easily in a controllable manner, and override materials. I also reworked the system to tile walls, corners, and whole buildings with an option to spawn in a procedural floor & roof section at the top – this will help to add vertical gameplay into the level blockout.