AI Programming (Unreal Engine 5)
This was my capstone project for the Game Design and Interactive Media major. My team and I worked on this project for about 9 months.
The game is a first-person roguelite dungeon crawler. The player is put into a procedurally generated dungeon consisting of isolated rooms where they must go in, defeat the enemies within, acquire loot, and repeat. The combat revolves around the player drawing "runes" in their spellbook to cast spells. The game was made in Unreal Engine 5.
I was one of two AI programmers responsible for making the enemies. I spent most of my time focused on the flying enemy. Since Unreal Engine does not have any built-in tools for 3D navigation, I had to implement the enemy's pathfinding. I ended up deciding to use the A* algorithm as a simple, lightweight, and scalable way to generate paths for the flying enemies to follow when moving through our world. I used a simple 3D grid to break up the rooms into cells that could be marked as "occupied" or "open" for the purposes of the A* algorithm.
I did run into some issues with performance as paths had to be calculated frequently and the navigation grid ended up being rather large. To combat this I did two things: move the pathfinding calculations to a separate thread to avoid blocking the game thread and created a "SimpleFlyTo" function that could be used to avoid using A* when moving small distances.
Some other tasks I had to do in relation to the flying enemy include: ensuring all behavior was compatible with Unreal's behavior tree system, having it target the player through Unreal's environment query system, and implement its model and animations.
Aside from working on the flying enemy, I also implemented our enemy spawning system. It works by having a pool of enemies and a certain "budget" where each enemy is worth a certain number of points (i.e. If enemy A is worth 1 point, enemy B is worth 2 point, and the total budget is 3 points; valid spawns would include either two As and one B or just three As). Aside from implementing this system in-engine, I also made a document intended to show designers how to use and modify the system. This document is linked below.
Main Menu
Two of the flying enemies I worked on
Visualization of enemy pathfinding. The enemy started at the node at the top and was pathing to the node at the bottom.
Visualization of the grid used to perform A* pathfinding. The green dots represent grid cells that are open while the red dots represent grid cells that are occupied.
Options for testing various functions involved in pathfinding.
Result of "Test Async Get Path" from the previous image. The green dot is the starting point. The red dot is the end point. The yellow dots make up the sequence of nodes that form the shortest path from the start to the end.