Backrooms
Backrooms was a small project I took upon myself in order to keep working in Unreal over the last month of summer before school. Taking inspirations from Slender, the player has to collect 7 pages to escape the Backrooms. I did all of the coding while downloading assets from the UE Marketplace. It was a lot of fun, and I learned how to use AI and Decision Trees in the process!
Click to Scroll!
The main takeaway from this project is learning how to create basic AI using Decision Trees. The basics of this tree are based on one variable: if the Enemy can see the Player. This is done using an AI Perception asset attached to the Enemy Controller. If the Enemy cannot see the player, the AI checks another Boolean. If the Enemy saw the Player before it no longer sees them, then the Enemy goes to the Last Known Location of the Player. After that, the basic patrol of the AI initiates. ClearFocus ensures that the AI doesn't see any Player, and following that GetTargetLocation grabs a random point in the level to travel towards. This is done by picking a random index from an array of Patrol Points placed in the Level. MoveToFast takes that Patrol Point's location, and the Enemy travels towards it. Once the Enemy reaches it, it then picks a new Patrol Point and the cycle continues.
If the Enemy spots the Player, then the AI moves to the right side of the Decision Tree. The AI Focuses straight on the Player, and immediately following that gets the location of the Player in World Space. From there the Enemy runs the same MoveToFast command once again, but this time the location is the Player's location. If the Enemy reaches the Player, then the Enemy attacks the Player. If the Player gets out of sight from the Enemy, the Enemy continues moving to the last point it saw the Player, then either resumes chase if it sees the Player again or otherwise returns to Patrolling.