Download

Shadow Stealth - "hide in the shadows" plugin

Hi All,

Just submitted Shadow Stealth, a code plugin implementing “hide in the shadows” gameplay mechanic, perfect for thieves, assassins and alike. All the features are easily accessible from Blueprints, including very easy integration with AI Perception. No C++ knowledge needed.

See what it’s good for in the trailer:

​​​​or play with it in the example project build (win64).

Features:

  • Supports All Light types and mobilities.
  • Supports per-channel (RGB) light intensity.
  • Integrates with AI Perception component through AI Sight sense.
  • AI Perception integration is extendible with Blueprints and C++.
  • Easy setup with a handful of components. Level editor tools and predefined actors are provided for convenience.
  • Performance is independent of the size of the map and the number of lights.

Changelog:

1.6

  • Exposed light components in shadow light actors

1.5

  • Fixed packaging error

1.4

  • New named notifications
  • BP and C++ extendible AI Sight integration
  • AI Sight Target with distance multiplier (per M.O.A.dev request)
  • Workaround for UE 4.24 bug UE-86045

1.3

  • Volumetric Lightmap support
  • RectLight support
  • Fix ShadowStealthComponent tick behavior

1.2

  • Add AISightShadowSenseEnabled for enabling/disabling if AISight sense uses shadows (Shadow Stealth default) or not (AIPerception default)
  • Add new methods of calculating light intensity from multiple test sockets: max, min, mean, median
  • Add Shadow Lights and Shadow Stealth Character actors to placement mode
  • Add TestSelfLocation flag to shadow stealth component
  • Fix handling light color

1.1

  • Add getting per color channel light intensity
  • Fix handling light color

Screenshots:



If you’re in some implementation details, you can check out my GitHub projects:

Just wanted to let everybody know that the Shadow Stealth plugin is available for download on the Marketplace: Shadow Stealth in Code Plugins - UE Marketplace

How does this work? Does it have collision on all the lights, and when player hits collision then it starts tracing?

Awesome @sfider,

Nice feature set. Does the system account for lighting color? Use Case example: The player must change color to match the lighting color to be considered in stealth.

This is exactly what it does for stationary and dynamic point and spot lights. There’s a sphere collision for point lights and a capsule collision for spot lights. Stationary and dynamic directional lights are traced at all times. The intensity of the light is calculated with the same formula used by the engine in shaders.

For static lights and indirect lighting (GI) the plugin uses precomputed lighting build on the level (only Sparse Volume Lighting Sample method is supported currently).

Thanks @TechLord, and double thanks because you just helped me find a bug. I take only the light intensity into account, but I forgot about the light color and it also has an impact on the intensity. I’ll fix it ASAP and as a bonus I’ll add the light color information.

Glad to help:) Look forwards to colored lights.

@TechLord The update is waiting to be processed by Epic. I hope it won’t take more than a week. Thanks again for the help :slight_smile:

EDIT: I underestimated Epic’s response time. The update is live right now.

Awesome plugin support gameplay.

Does this support movable rect lights?
And is there a reason u used capsule collider for spot lights instead of cone collider?
Also, is it possible to change it to be a toggle ( in stealth/not in stealth) rather than the light bar that’s used now?

Hi @Vathusmoure,

Movable rect lights are not supported at the moment. It’s something I’m planning for an update in some time.

The capsule collider is a better fit for spot lights. Spot light shape is not a real cone, it’s a cone-shaped section of a sphere. To fit the spot light shape into a cone you would have to build a cone with a height equal to the spot light radius. For a large spot light angle (closing to 180) the cone would end up huge. here’s no such problem with the capsule collider and it’s also better for performance then cone. Also, the collide is only to check if we’re in the visinity of the spot light. Before performing the trace, the socket is tested against the actual shape of the spot light.

In the plugin, you are provided with a floating-point value that represents the intensity of the light falling on your character. What you’ll do with that value is totally up to you. In the example project, I’ve presented a little more complicated implementation, but in your game, you can choose to just toggle ‘stealth’ state on a set value of the light intensity. You can use events, that are built into the plugin for more convenient implementation.

If you didn’t check it up yet, please download the binary build of the example project here.
You can also read more about the plugin features and how to use them in the documentation.

Btw, thanks for taking an interest in my plugin :slight_smile:

  1. I had to set my characters visibility channel to overlap to get this to work properly. I had it on block at first but it was saying I was hidden while doing things like running and jumping. Is this ok? Everything seems to be working correctly.

  2. Is there a way to turn off the component on the player character? So that my AI can still see me. If I dont have any lights in my level, and only use skylight, my AI doesnt react to me.

  3. I noticed with the directional light, if the trace hits any 1 socket, then you are fully lit. Is this intentional, or should there be a gradual increase like with the other lights?

That being said, I really like this plugin, good job :slight_smile:

Hi @Vathusmoure

  1. This is something I missed in the documentation. Your solution is correct. You could also create a separate trace channel and configure Shadow Stealth (through Project Settings) to use it instead of the visibility channel.

  2. There is no way to switch between Shadow Stealth override of AISight Sense and the default implementation at runtime. If you don’t want to use this override, change the base class of your character to Character instead of ShadowStealthCharacter and attach the ShadowStealthComponent to your mesh component using Blueprint Editor. Do you think that the plugin could benefit from a flag for disabling the AISight Sense override?

Also, if you get 0.0 light intensity when only the Skylight is in use, please look into Documentation > Basic Usage > Scene Setup > Static Lighting, and remember to build your lighting.

  1. The light intensity value for the whole character is the maximum light intensity of Test Sockets. It works the same for both point and spot light. The behavior you see is the result of a more local nature of spot light.

Thanks for your support and all the motivating comments :slight_smile:

It would be nice to be able to toggle the stealth on/off for certain circumstances (boss fights come to mind). And there’s always things you don’t think of, so maybe other unforeseen situations as well.
For the direction light, I think I explained it wrong. If my head socket is the only thing the light sees, I get an intensity value of, say 3. If I walk into the light, so that all 5 of my sockets are exposed to the directional light. The value is still 3. There’s no difference. Its not a huge problem, just weird that if my head is the only thing lit. I have the same exposure as if my whole body is lit.

I’ll add the flag for AISight Sense override in the nearest update.

The behavior is intentional, it takes the maximum light intensity from all Test Sockets. But I see your point. In the nearest update, I’ll add some other methods to the ‘maximum’: minimum, average and median. This way you’ll be able to choose what best fit’s your project.

As for the nearest update, I’m aiming for the end of the coming week.

Sounds great, thanks!

Hi all,

The Shadow Stealth plugin had some updates lately. On September 6th UE 4.23 support has been added, and on September 9th new feature and bugfix update went live. Changes introduced with Shadow Stealth 1.2:

  • Add AISightShadowSenseEnabled for enabling/disabling if AISight sense uses shadows (Shadow Stealth default) or not (AIPerception default)
  • Add new methods of calculating light intensity from multiple test sockets: max, min, mean, median
  • Add Shadow Lights and Shadow Stealth Character actors to placement mode
  • Add TestSelfLocation flag to shadow stealth component
  • Fix AISight trace channel handling

Many thanks to @Vathusmoure on forums and to Mark on email, for support and great suggestions :slight_smile:

Just testing the new update a little bit (haven’t had much time in unreal due to WoW classic :/). So far it seems great, just wanted to say thanks for the update:)
Also had a question. How would you recommend enemies seeing you if they’re close to you (even if your stealth)? I watch a video awhile back on the Splinter Cell games. They do this by having a “Sixth Sense” so that the enemies detect you no matter what if you are in this range. So would it be best to create another sense in perception to manage this?

You could certainly make your own AI Sense, this could work nice with the rest of senses (hearing, etc.). But the easiest way would be to add a trigger to your AI character or to your player, and then act on player/AI entering the trigger.

Hi All,

Shadow Stealth is 50% off for a week :slight_smile: