Announcement

Collapse
No announcement yet.

Stealth game, light and shadow, level of light behind player

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Stealth game, light and shadow, level of light behind player

    Hello Community! I'm new here and starting to learn UE4. I have an idea for stealth game with system simular to this in Thief - hiding in shadows, etc. I know it's possible, I saw some tutorials, but there is one thing I would try to implement and can't find anything about it. In Thief when player was in the shadow he wasn't visible for AI, even when there was well lit wall behind him. Dark silhouette on bright background is pretty visible, but AI wasn't taking it into account. Is it possible to make AI compare amount of light on player character with amount of light behind him on AI's line of sight? Maybe it could take average from some portion of background behind character, but wouldn't that be too much to calculate? Where to start with solving that problem? Is it even solvable?

    #2
    An easy way to solve that, is to make TriggerVolumes on the areas where the player would be hiding in the darkness (in the Map).

    When the player enters those dark spots (and trigger the volumes), you could enable a boolean (i.e. bIsInHiddenInShadow), then on the pawn sensing of the enemies, just have them to check that bool to see if the player is hiding in the shadows.
    You could go a bit further and only enable the said boolean with the player is crouching (i.e.: bIsCrouching AND bIsHiddenInShadow -> set bPlayerInvisibleToEnemies)
    UE4 Jam Entries:
    March 2016
    September 2016
    Epic MegaJam October 2016
    December 2016

    Comment


      #3
      Thanks for reply, but i thnik this doesn't solve this problem. Let's say player is standing in one spot, on his right is well lit wall and on his left is wall in shadow. If AI is looking at player form lit wall side, it sees dark silhouette on dark wall background - player is not visible. If AI is looking from dark wall side, it sees dark silhouette on bright wall background - player is visible. I think that player visibility must depend not only from spot where player is standing, but also from spot from which AI is looking at him. Your way gave me an idea: I could set in big vertical objects like walls a bool parameter defining that object is in shadow. When player is in shadow, AI can check bool parameter of first encountered object behind him. This sounds good, but what about dynamic lights and shadows then? Also I'm not convinced that placing those trigger volumes everywhere where shadows are is a good idea. Its like 01 system, visible or not. I'd like to use some inbetween states too. I think detecting amount of light should be involved

      Comment

      Working...
      X