AI Perception with Day & Night Cyclus

I try to make a shooter game with some extra features, so I implemented a day and night cyclus, the night is really dark. For AI there is no difference in sensing the player. Is there a way to reduce AI Perception sight radius in Blueprints? Or does anybody have another idea, how to implement this? Thx in advance

I tried to do something like this, but couldn’t figure out how to do it through blueprints. I guess you can’t, tried to fiddle with source code of perception system, but then decided to make another approach - just made several siblings AiControllers with different perception settings. So when the night comes I just switch AIController_day to AIController_night, that has smaller sight range. It’s not very flexible system, but at least it works.

Thanks, that is at least a starting point. I tried 2 AIPerceptions in one Controller, but it didn’t work either.

There are no out of the box approaches that will determine light levels for you.
You will need to roll your own.
The simplest is to use some sort of curve that modifies the strength of any and all sight input based on the time of day.
That doesn’t take care of being in light for some other reason though :frowning:

In those cases, you may want to approach things in a way similar to Thief and The Dark Mod : read the pixel data from a rendered object (such as a cube).

Hope that helps.

I’m 99% certain that theif did not bother reading pixel shading but hooks into the pre-existing calculations to tell what Will or Will not be lit before it actually is lit.

one could modify the engine to produce the same result, afterall, the engine does make the same calculations to determine how the mesh will be lit.

However, engine modification are not at everyone’s reach.

The way this is commonly done is by backtracking to all nearby light sources for pre-determined parts of the body to check if they are visible or occluded.

in short, you have sockets on your mesh, an array of lights you can loop through if within a certain range you run a line trace.
if the linetrace results in a hit before the end point is reached you can assume that the area is - at least partially - in shadow.

You use this information to scale the sensing strength.

Thank you both for your explanations. I needed to read it 3 times, at least to understand, what you are talking about.:slight_smile:
I am afraid, that exceeds me knowledge after 1/2 a year with UE4. But I keep that in mind.

See if this is more practical:

Found this in my bookmarks - haven’t tried it, but for what its worth: UE4-Light-Detector