Stealth based mechanics

Hey guys, I was wondering whether anyone would know how to create a stealth based system so that when you are in darkness enemies cannot see you? Also, a cover system and sound based detection. Wanted to create a stealth based game for my final year at university, similar to Splinter Cell, and was wondering whether this could be done using blueprint?

I found something that was done in UDK using code, but I am unsure whether you can transfer this across to UE4, any ideas?

Thanks :slight_smile:

I’m interested in solutions for determining how visible a player is based on shadows/lighting as well.

Any luck thus far? Unfortunately, because UE4 is so new there’s not many tutorials or solutions for a noob like me :’(

One way you could do it is like this.

Make a Blueprint for your light.
Add the light source and other stuff.
Add a sphere to the Blueprint as well.

When the player overlaps this sphere, do a linetrace from the lightsource to the player(maybe 3 point on the player? Head, torso, Feet?).

If there is no hit from this linetrace, there is line of sight, and they are in the light.

Combine this with the distance from the light to determine how much light hit them(find the equation on wikipedia, it’s just square falloff).

This is obviously not 100% perfect, but it is very workable, and not that hard to implement.

@Rasped, that’s a good solution, though I don’t typically like doing stuff that requires an extra process per-whatever (per-light in this case) as that quickly gets cumbersome.

It does give me an idea, though, which is that you could use the light position + radius, if those are available, for a regular ole sphere intersection test or the like. Different types of lights might need to do a different volume than a sphere, though.

Also there’s the issue of coverage. You don’t want the character to be binary visible or hidden, since one sliver of the character being inside the test volume would evaluate to being visible.

The beauty of computers… do it once, and you can do it every time. So it won’t be cumbersome. If you’re thinking computional wise… Put in a delay and test every 0.5 seconds instead of tick.

And the system I described won’t have to be binary.

If you have 3 point you detect to, you can weight each point. Head 20%, Torso 50% and legs 30% for example.
Couple this with distance… 100 units away vs 250 units away vs 500 units away. Different distance, different visibility.

This would create a pretty Thief like system and feel I am almost certain.

If you on top of this add something that takes your speed into account it would be very very detailed actually.