Game & Level Designer
Tim Andersson
Technical Design
Here are a few solutions and designs for features built using Unreal Engine 4 Blueprint.
Some are solutions to problems encountered, others are features I wanted for my projects
and some are to make my work more efficient.
Resource Spawning Volume
Summary
Problem:
- I didn't want to hand place hundreds of trees and rocks
- Predetermined spawn points would reduce gameplay quality
Solution:
-
A box volume that could be initialized with resource types and abundance parameters.
Project: Stardew valley style RPG
In my project the player could gather resources like wood and stone and forage for mushrooms and seeds. Rather than placing predetermined spawn points by hand I wanted resources to be spawned randomly automatically.
Here's what I did:
-
I created a box volume and a function to grab important data from its position and dimensions.
-
Then I created a ray cast function that would return a success if it hit terrain.
-
A for loop performs a series of ray casts from the top of the box bound downward to its bottom.
-
If it hits terrain it will use an algorithm to fetch assigned resources from a data table and spawn a resource node at the location.
-
Resources are assigned a rarity rating that is used against a dice roll. This adjusts the abundance of certain resources.
Ledge Climbing
This function uses three line traces to see if the player can reach a place to stand on
Summary
Solution:
-
By using line traces, timelines and the power of vector math, the player can climb ledges.
Issues:
-
The check for viable climb position function uses line traces which does not check if the player can actually fit and can go through large meshes, pulling the player out of bounds.
-
I did not know that a capsule trace feature existed when building this feature, which could be used to check if the player realistically could climb toward its target location.
Project: Immersive Sim FP RPG
Inspired by Thief and System Shock 2, I wanted to bring back the hold space to climb ledge feature. This has not been easy and I have built several itterations and the current one still has issues.
Here's what I did:
-
While the player holds the space button and is in the falling state a line trace checks in front of the player for collision.
-
If it hits, a check for viable climb position function is called. This function uses three downward line traces in front of the player to look for ground to stand on. If at least two line traces hit floor to stand on success if returned, and the final position is an average of all succeeded ray casts.
-
If a position is found, the player is set to a climbing state, disabling movement and is pulled up to its target position through a series of timelines, lerping its position.
-
If the player releases space at any time, all climb operations cease and the player is returned to its default state.
AI Horde Optimization
Summary
Problem:
-
Having the desired amount of enemies would be expensive in an open world
Solution:
-
A system to construct and despawn enemies in each area if the player was present
-
To avoid stuttering enemies are only spawned each tick
-
The AI in itself is not too expensive
-
The enemy's last location and HP is remembered when it's despawned
Project: Open World Project
In one of my open world projects I wanted to have swarms of hundreds of enemies in each area. I foresaw eventual problems with having thousands of active enemies all over the world, so I decided to build a system that would spawn and despawn them when the player entered or left the zone.
Here's what I did:
-
Firstly I built a cheap AI that had a moderately low update frequency.
-
I created an AI Manager class with a Name variable as a tag for the area and a box volume to sense if the player is present
-
I created a Enemy spawn class, also with a Name variable to tag its area.
-
When the player entered the AI Manager box volume it would enable tick and send a spawn AI event to every Enemy spawner with the same Area tag, which would populate the area with one enemy per tick to reduce stuttering.
-
If the player left the area, each spawner would remember its enemies position and remaining HP and then despawn its enemy.
-
If an enemy was killed, it would destroy its own spawner.