Download

Requesting Opinions on AI

Hello, so I’m pretty new to this and I have a pretty good idea about how I want my enemy’s AI to work, but I’m not sure if I’m biting off more than I can chew. I’ve developed AI in other, mind you more simplistic, engines. I don’t think what I want to do is gonna be too complex but I could be wrong.

The main points of action are:

-There is no combat, the player’s only option will be to sneak past or run away from the enemy
-There will be 1 - 2 kinds of enemies that will spawn randomly and disappear after X amount of seconds (both enemies will behave the same, and will only .
-The enemy will have a line of sight, when it sees you it will begin chasing you.
*The player will have a flashlight, and the enemy will only be able to see you while the flashlight is on.
-If the enemy catches you, you will restart to your last checkpoint.

So what do y’all think? Am I being too ambitious? I would love to hear some opinions.

This is very doable. Lets deconstruct per point what you can use from the engine:

-There is no combat, the player’s only option will be to sneak past or run away from the enemy
So the player only needs movement controls.

-There will be 1 - 2 kinds of enemies that will spawn randomly and disappear after X amount of seconds (both enemies will behave the same, and will only .
You can set a timer to periodically spawn enemies and set a lifespan (fixed value or randomly generated value) on the spawned enemies by calling SetLifeSpan. Perhaps make it prettier by adding spawn and despawn animations.

-The enemy will have a line of sight, when it sees you it will begin chasing you.
You can let each enemy periodically (every frame or once every X frames) do a line trace towards the player’s position to determine whether he has line of sight. Alternatively, you can use the AI Perception system to detect players entering a monster’s line of sight.

For the monster to chase you, you can add a NavMeshBoundsVolume to your map and build navigation. With the nav mesh generated, you can call MoveToActor on AIControllers to have the monsters chase after the player.

The player will have a flashlight, and the enemy will only be able to see you while the flashlight is on
To make the monster only react when the player’s flashlight is on, add an extra check in the above “AI”.

-If the enemy catches you, you will restart to your last checkpoint.
Give the monsters a collision volume that overlaps with the “Pawn” collision channel so it will detect players touching it to trigger the game over logic.

All very doable, good luck!

All right cool, thank you very much! :slight_smile: