Ghost AI - Horror game

Hi there. I have a question. Pretty big one tbh. I was making my game, Its a 2 player horror game, And I needed to make an AI for it. The issue is that Its a ghost, and I don’t know how to make it that advanced. A few of the requirements should be that:

1 - The player must not be in the same position (an area or radius around them, I prefer radius but then I dont know how to stop make it moving with the character) for more than 30 seconds, I don’t think this is the hard bit though.

2 - The ghost will roam areas, but it want it to be jumpscare style, not like granny or anything, something more horror, Like maybe phasmaphobia, You see the ghost run past you, then you see it in the mirror, and it suddenly disappears, After a while it follows you like normal. I have no Idea how to do this, so anything would help, Preferably someone teaching it, or even suggestions or if anyone does make the AI.

3 - The AI can be damaged a bit with a single-use weapon and faints temporarily, but then wakes up a few minutes later.

4 - The AI should be able to detect a light source from the player from a slightly further distance, which I can do, just a bit difficult.

5 - There will be a minimap, and there should be a “buzzing” or static effect in a small radius around the ghost, on the map specifically, As it would help the players to find the ghost’s approximate location.

6 - After around half the game is done, then I would like to add venom/slimey eyes in the walls, looking at the player. This should tell the AI the location of the player, essentially acting as “cctv”. Its to make the game more difficult.

Thanks, Looking forward to everyone’s help.

P.S. I have no clue about optimising a game for both pc and mobile, so When the time comes I’ll probably ask again. Thanks again. I have done the Day-Night cycle, weather system, and the clock to tell the time, the goal is to survive the whole night basically. From 6 PM to 6 AM.

Hello there YORU8843, welcome to the Unreal community and thank you for posting.

This is quite a lot to cover as you have previously stated. To be honest you may have to break this up into separate questions as each one may need specialized attention.

I read your requests and I broke them down into a basic form. It sounds like you need:

  • Events.
  • AI.
  • Weapon(s).
  • CCTV (yay for cameras/render targets).

These overarching subjects cover everything but the mini-map. Which brings me to suggest your attention be brought to the Horror Engine. Its fun out of the box, its very optimized, and best of all, its free!
Horror Engine has a pretty neat event system you can use as a reference for some of your requests.

For the eyes telling the AI where the player is: You might want to consider just using a Blackboard/Behavior tree for general navigation. The documentation I am linking here has a great starter guide on this.

The dripping part of the eyes:
You may want to look into either Material Functions or Niagara. To turn them, you could use something as basic as a ‘SetActorRotation’ to get you by for now.

The AI running past the player can be handled in Horror Engine’s event system, provided you have an animBP to handle the locomotion part.

The Horror Engine handles some CCTV but if this is not sufficient, here is documentation on cameras/rendertargets.

I hope this information provides you a good starting point and happy hauntings!


try to get everything working with just text first. If you can do that, the rest won’t be so hard.

Just go one step at a time.

If you have no clue about optimizing for both pc and mobile, don’t think about it. Forget mobile, just try to get the basics of the game working first.

The principle is to solve the big problems first, then work down to smaller problems. Biggest problem is getting all the moving pieces talking to eachother so that events fire in the right order and you can effectively play the game from start to finish, even if all the output is just print logs.

From there you can just dive into each little event/feature one at a time, but it won’t be such a huge braintwister because the game is already essentially built. You are just changing how it looks and feels at that point.

If you don’t segregate your responsibilities this way, it will became too mentally taxing to finish.

1 Like

I understand some of it, for example the cctv, Weapons… giwever I am partially cofused about the AI running past the Player, and with the eye dripping, I was hoping to use something less instesive than particle effects. I plan on optimising it for mobile later, so I was thinking of a material not procedurally generated, maybe the eye is inside the wall and over time i can make it move out of the surface using curves for time/location from origin. Another issue with this would be the randomly generated eyes, I would want them to be all over the map, however this would be an issue with the corners of walls, etc.

I appreciate you help and it has helped a lot no doubt about it. I will also check out the Horror engine. Just wondering, are there any good tutorials for it?

edit: I had a look at locomotion, Don’t really understand the concept, I’m thinking something more like if the ghost is in a certain radius close to the player, have a pre-made video file or animation with a temporary character set up in certain trigger zones. That would work, except then the ghost would be too close and may be seen, or the ghost will attack at that distance


Yes you are right in the sense that i should just get the game running first, however with the eyes I mentioned before, It will be too difficult to optimise for mobile later on if I use particle effects, procedural materials, etc. I plan on making it cross-play between pc and mobile thats why.

Also with the time management and ordering what to do first or sorting out tasks, I think you are totally correct about that, I never managed to finish a game before that, however this time I made a whole list of what to do first, then next, etc. It helps a lot.

With text based gameplay, the issue is I don’t know how to make the AI at all yet, so I have no idea how to make a ghost AI like phasmaphobia, Like Granny, thats doable, but I’m thinking top of the line AI which gives more adrenaline than playing tag with an AI looking like its scary.

Thanks a lot tho, I appreciate the help