AI detection based on amount of light

Hi everyone. I'm new to Core, although I am not new to programming or game engines. I'm excited to write my first game in Core.

I want to create a stealth game, where players need to sneak by NPCs without being detected. I want staying in the shadows to be a key part of the strategy of the game. Can AI detection be affected by the amount of light shining on a player? Is there an API for determining the amount of light at a particular location?



I do not know of a way of detecting light levels. The best I could suggest would be to use triggers to set a lighting variable for the player based on the last trigger entered, this would require you to hand place a potentially large number of triggers (which are basic shapes).

Thank you, @RedQuad. I'll try that, if there's no better solution.

A simple way would be just to check line of sight from light sources to the player and vision from the ai to the player with raycasts.

A more complex way would be to figure out how to compare images from a CameraCapture from the perspective of the enemy AI.

I would take two images from the same perspective and point in time, one with the player in the scene and one with the player filtered out of the scene. Then use some sort of compare to see if the player stands out against the background in someway.

Otherwise, you could try to take a CameraCapture of the player and try to figure out the difference between the player model standing in normal light to compare with shadow and use that as a reference. Using pixels of the image of the player and checking the average light level through that means.


1 Like

@Wolf, thank you for the interesting suggestions. I appreciate the time and thought you put into them. However, I've moved on to a new game I'm developing using Unreal Engine 5.