With weapons and damage in place, the next step is enemies: actors that take damage from the player, chase or attack, and react when they die. This lesson gets you to a basic enemy: health, damage handling, simple AI (move toward player or shoot), and death so your FPS has real threats to fight.
You will finish with at least one enemy type that the player can shoot, that can hurt the player (or move toward them), and that dies and cleans up correctly.
Why enemy AI comes next
Until now you had a moving player and a weapon that hits geometry or test actors. Adding enemies ties everything together: your damage system gets a real target, your level gets a goal (clear the room), and you can tune difficulty and feel. Start with one simple enemy type; you can add more behaviors and varieties later.
We will use Unreal's Character or Pawn for the enemy (so it can use the same damage flow as the player), an AI Controller (or simple Blueprint logic) for behavior, and the same Apply Damage / health pattern you used in Lesson 6.
Step 1: Enemy pawn and mesh
-
Create an enemy Blueprint
- Base it on Character (or Pawn if you prefer). Name it e.g.
BP_Enemy_Grunt. - Add a mesh (capsule or a simple placeholder shape) so you can see the enemy in the level.
- Ensure the enemy has collision so your line trace from the weapon can hit it. Use a capsule or a collision component that matches the mesh.
- Base it on Character (or Pawn if you prefer). Name it e.g.
-
Add health
- Add a variable Current Health (e.g. 100). In Event Any Damage (or your custom damage interface), subtract the damage value from Current Health. When Current Health ≤ 0, run death logic: play a death animation or effect, disable collision, destroy the actor (or set a "dead" state and hide/ragdoll).
- This reuses the same damage pipeline as in Lesson 6: when the player's line trace hits this enemy, call Apply Damage; the enemy's Event Any Damage (or interface) handles the rest.
-
Place the enemy in the level
- Drag
BP_Enemy_Gruntinto your test level. Confirm the player can shoot it and that health decreases and the enemy dies when health reaches zero.
- Drag
Pro tip: Use the same damage type or interface for the player and enemies so one weapon can hit both. Only the hit actor's response (player HUD vs enemy death) should differ.
Step 2: AI Controller and behavior (chase or patrol)
-
Create an AI Controller
- Create a Blueprint class based on AIController. Name it e.g.
BP_EnemyAIController. - In your enemy Character/Pawn Blueprint, set AI Controller Class to
BP_EnemyAIControllerso the enemy is possessed by it when spawned.
- Create a Blueprint class based on AIController. Name it e.g.
-
Simple chase behavior
- In the AI Controller (or in the enemy Blueprint if you keep logic there), get a reference to the player pawn (e.g. Get Player Pawn or Get Player Character).
- Each tick or on a timer: if the player is valid and in range, use Move To Actor (or Move To Location with the player's location) so the enemy walks toward the player. You can use the Navigation System (NavMesh) so the enemy pathfinds; bake a NavMesh in your level so the AI can find a path.
- Optionally: only chase if the player is within a sight range or agro radius (e.g. 2000 units). Beyond that, the enemy can idle or patrol.
-
Patrol (optional)
- Add two or more target points or spline points in the level. In the AI Controller, alternate Move To between them when the enemy is not chasing the player. This gives a simple patrol so the level feels less static.
Common mistake: Forgetting to add a Nav Mesh Bounds and bake the NavMesh in the level. Without it, Move To may not find a path and the enemy will not move.
Step 3: Enemy attack (melee or shoot)
-
Melee
- When the enemy is close to the player (e.g. distance < 150 units), trigger an attack: play an animation, and on a specific frame or after a delay call Apply Damage on the player with a small radius or a short line trace from the enemy forward. Then cooldown for 1–2 seconds before the next attack.
- You can use a Behavior Tree with a "Close range" decorator and an "Attack" task, or simple Blueprint: if distance to player < 150 and not on cooldown, play attack and apply damage.
-
Ranged (shoot)
- When the enemy has line of sight and is in range (e.g. 1000–2000 units), spawn a projectile or perform a line trace toward the player. Apply damage to the player on hit. Add a fire-rate cooldown so the enemy does not shoot every frame.
- Reuse the same damage and health system: the player is just another actor that receives Apply Damage.
-
Damage to the player
- Ensure the player Blueprint (or a component on it) handles Event Any Damage (or your damage interface): subtract from player health, update HUD, and trigger death or respawn when player health ≤ 0. That way both the player's weapon and the enemy's attack use the same pipeline.
Pro tip: Start with one attack type (melee or one shot). Get that feeling good before adding more enemy types or complex behavior trees.
Step 4: Perception and awareness (optional)
- Use AI Perception (e.g. sight config) so the enemy only chases or attacks when it "sees" the player (within cone and range). When the player leaves sight, the enemy can stop chasing or return to patrol.
- Alternatively, keep it simple: if the player is within agro range, chase; if in attack range, attack. You can add perception in a later pass for stealth or alert states.
Step 5: Death and cleanup
- When Current Health ≤ 0:
- Disable the enemy's collision (or set collision to "NoCollision") so the player and projectiles do not hit a dead body.
- Stop movement (clear Move To, or set velocity to zero).
- Play a death animation or ragdoll, or simply Destroy Actor after a short delay so the body disappears.
- Optionally spawn a pickup (health, ammo) or trigger a game event (e.g. wave cleared).
- Do not run chase or attack logic when the enemy is dead; check a "Is Dead" flag at the start of your AI or behavior logic.
Step 6: Mini challenge – enemy checklist
Before moving on, verify:
- [ ] The enemy has health and takes damage from the player's weapon; at 0 health it runs death logic (and no longer blocks or moves).
- [ ] The enemy moves toward the player (or patrols) using the NavMesh.
- [ ] The enemy can damage the player (melee or ranged) when in range.
- [ ] The player can die (or lose health) when hit by the enemy.
- [ ] Dead enemies do not keep attacking or blocking the level.
If the enemy does not move, check NavMesh and that the AI Controller is possessing the pawn. If the enemy does not take damage, ensure the weapon's line trace can hit the enemy's collision and that Apply Damage is called with the correct hit actor.
Troubleshooting
Enemy does not move: Ensure a NavMesh is baked in the level and that the AI Controller is set on the enemy. Check that Move To is being called with a valid target (player or patrol point).
Enemy does not take damage: Confirm the enemy's collision is enabled and on a channel the weapon trace uses. Ensure the enemy handles Event Any Damage (or your damage interface) and subtracts health.
Enemy attacks but player does not take damage: Ensure the player (or a component on the player) implements the same damage handling (Event Any Damage or interface) and that the enemy's attack calls Apply Damage with the player as the target.
Enemy keeps moving after death: In death logic, clear any active Move To and set an "Is Dead" flag; at the start of your AI tick or behavior, return early if Is Dead is true.
What is next
With a basic enemy that takes damage, moves, and attacks, you have a complete combat loop. In Lesson 8: Level Design & Environment Creation you will build spaces that use these enemies: cover, sightlines, and flow so your FPS levels feel intentional and fun.
For more on AI and behavior in Unreal, see the Unreal Engine 5 AI Documentation and our Unreal Engine Guide. Found this useful? Bookmark the course and try adding a second enemy type or a simple spawner. When you are ready, head to Lesson 8 for level design.