The enemies in U.R.S.T. are driven by a lightweight but highly capable state machine. It is made to be identical to retro shooter games such as DOOM and Hexen. However they don't just blindly walk toward the player, they utilize 180-degree cone vision, line of sight raycasting, and built in strafing logic to dodge and weave as they chase their target.
The enemy system is designed to be as flexible as possible. Instead of duplicating complex code for every enemy, enemies are created using Custom Resources similar to the Weapon system. This means that the enemy system is split into two parts:
RetroEnemy.tscn): Handles the physics, navigation, and state machine.RetroEnemyResource.tres): A custom resource that holds the enemy's health, damage, sprites, and many more.Brief Video Guide: https://youtu.be/Oa7AARwOMIQ
You should never (and I mean it!) directly edit the base RetroEnemy.tscn file. Instead, you create new enemies by inheriting it and plugging in a new resource file. Here is quick and easy 3 steps to create a new enemy, it takes seconds to do it:
Step 1: Inherit the Base Scene
res://Core/Core_Prefabs/RetroEnemy.tscn.User_Assets folder (for example MutantGuard.tscn).Step 2: Create the Enemy Resource
User_Assets folder and select Create New > Resource.RetroEnemyResource and create it (name it for example MutantGuardStats.tres).Step 3: Connect Them Together
MutantGuard.tscn scene.MutantGuardStats.tres file into the Stats slot under "Enemy Settings".You now have a brand new functional enemy ready to be customized (Yay!).