Announcement

Collapse
No announcement yet.

Top Down Stealth Toolkit

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

  • #76
    Top Down Stealth Toolkit Basics: AI Perception

    The v2.0 update for Top Down Stealth Toolkit introduced a custom component driven AI Perception system tailored specifically for implementation in Stealth games. This system uses a combination of four different perception models to evaluate threats based on the new Stimulus model introduced in the update.

    Perception Models:

    1. Visual Perception: Using a combination of distance, angular, & line trace checks, the Visual Perception enables an AI agent to detect stimuli within it's direct line of sight range. It is capable for sensing Target stimuli as well as certain types of Interest stimuli like Incapacitated & Defunct allies.

    2. Aural Perception: The Aural Perception enables an AI agent to perceive & track noises created in the vicinity. It factors in the Loudness of a noise while performing the distance check operation, in order to gauge the relevance of the stimulus. This ensures that louder noises can potentially be heard by an agent, even if it was created outside the default hearing threshold.

    3. Intuitive Perception: The Intuitive Perception model is used by AI agents to evaluate stimuli based on their memory, thus negating the need to do any form of range checks. For example, a target that has evaded a Patrol Guard's line of sight can trigger the creation of a Missing Suspect stimulus using it's memory about the target's last seen location, which can then be perceived through this system with very minimal search costs.

    4. Motion Perception: Unlike the other perception models, the Motion Perception is used to evaluate stimuli that have not been directly perceived by the agent. An example of this would be a stimulus created by an entity located in close proximity to an agent, but not necessarily within it's direct field of vision. As a result, this system uses a dedicated alert meter to make sure that the agent responds to a perceived stimulus only if it stays within range for certain period of time.


    All or any of these systems can be modified or turned off from the owning class, thus facilitating creation of different types of perception behavior among two types of agents like say, a Patrol Guard & a Surveillance Camera.
    Dev blog: Unreal Possibilities
    Youtube channel
    FPS Tower Defense Toolkit Support Thread: https://forums.unrealengine.com/show...efense-Toolkit
    Top Down Stealth Toolkit Support Thread: https://forums.unrealengine.com/show...tealth-Toolkit
    Tower Defense Starter Kit Support Thread: https://forums.unrealengine.com/show...Support-Thread

    Comment


    • #77
      Top Down Stealth Toolkit Tutorial: How to create a new custom Interest Stimulus

      As mentioned in an earlier post (check out here: https://forums.unrealengine.com/show...l=1#post722820), the v2.0 update for Top Down Stealth Toolkit introduced a dedicated stimulus driven AI perception system. This tutorial will go over the process of using the aforementioned system to create a new Interest stimulus from scratch.


      The base attributes for Interest stimuli are controlled through the 'InterestStimulusDataArray' in BP_AISensoryManager class. Each element of the struct array contains details about a specific type of Interest & hence provide an avenue for easily customizing it's properties. Before going into the actual process of creating a new Interest, I'll provide a brief description of the various parameters that control that control these stimuli.

      1. InterestType: Determines the type of Interest associated with the array element.

      2. PerceptionType: Determines the AI perception model that can detect this Interest (For more on the AI Perception system, check out: https://forums.unrealengine.com/show...l=1#post724054)

      3. ThreatClass: Determines the priority level of an Interest when it comes to override requests. For example, an Interest of lower threat class will not override one of higher threat class, thus making sure that the AI retains focus on the stimuli based on their relative importance. By default, all Interests have a threat class level of 1.

      4. PerceivedThreatValue: Maintains a normalized [0.0 to 1.0] value of the threat rating of an Interest as perceived by AI agents. Higher values of this parameter will make AI bots go directly into a high alert level state. Within a single cycle of sensory evaluation, Interests with higher value of this parameter within a threat class, are evaluated first to ensure that the AI responds to the most immediate threat.

      5. PerceptionRangeModifier: Controls the range at which an Interest can be perceived by adding a distance modifier to the agent's perception checks. For example, Alarm & Gunshot noises have a value of 2.0, thus ensuring that an AI agent possessing a hearing range of 500 m can perceive these stimuli up to double the said distance.

      6. PerformRangeTestToInterestCreator: Determines if AI perception tests should conduct distance checks against the actual Interest location, or the entity that created it. For example, perception checks for alarm noises are conducted against the actual source of the noise itself, even though the Interest location would be set as the location of the entity that triggered the alarm.

      7. TrackAlertedAgents?: Determines if the Interest object should keep track of agents that have been alerted to it's presence.

      8. UseInterestCreatorLocation?: Controls whether the AI agents that detected this stimulus move towards the Interest location or the actor that created it.

      9. AutoDeactivate?: Controls the active lifespan of the Interest. For example, noise stimuli have this parameter turned on, thus making them relevant only for a single evaluation cycle.

      10. IsInteractive?: Determines if the AI agents can interact with the Interest. If turned off, the AI bots will only investigate the source location.

      11. InteractionModel: Controls the manner in which an agent interacts with an interactive Interest. For example, patrol guards will use the 'Reactivate' interaction model to wake up any incapacitated allies they may come across.

      12. SortedPriorityOrder: This parameter is set automatically at the start of a game based on the threat class & perceived threat value of the Interest. Ensures that AI Sensory Manager evaluates the Interests with higher priority order before moving on to the rest.


      Now in order to create a new Interest, first add a new entry to the enum 'EInterestStimulusType'. All that's left is to add an element to the InterestTypeDataArray for this new type, & assign the parameters mentioned above as per the requirements.
      Dev blog: Unreal Possibilities
      Youtube channel
      FPS Tower Defense Toolkit Support Thread: https://forums.unrealengine.com/show...efense-Toolkit
      Top Down Stealth Toolkit Support Thread: https://forums.unrealengine.com/show...tealth-Toolkit
      Tower Defense Starter Kit Support Thread: https://forums.unrealengine.com/show...Support-Thread

      Comment


      • #78
        Top Down Stealth Toolkit Tutorial: How to control the AI Perception model for AI agents

        As mentioned in an earlier post (Link: AI Perception Basics), the toolkit now employs a custom AI Perception system to evaluate potential threats. It's user defined properties can all be edited through the component details panel from the owning blueprint, thus facilitating creation of different threat perception models for different types of AI agents. This tutorial will go over the basic parameters that control the working of this system.

        Click image for larger version

Name:	aipercpara.png
Views:	1
Size:	302.1 KB
ID:	1130043

        Visual Perception Data:

        1. IsVisualPerceptionEnabled?: Determines if the agent can use Visual Perception to perceive stimuli.
        2. Vision Range: Determines the direct line of sight range.
        3. HalfVisionAngle: Determines the half angle for the agent's cone of vision.

        Aural Perception Data:

        1. IsAuralPerceptionEnabled?: Determines if the agent can use Aural Perception to perceive stimuli.
        2. HearingRange: Controls the maximum distance at which a sound of default loudness 1.0 (controlled through the 'PerceptionRangeModifier' parameter of interest stimuli: Breakdown of Stimulus Parameters) can be perceived by the agent.

        Intuitive Perception Data:

        1. IsIntuitivePerceptionEnabled?: Determines if the agent can use Intuitive Perception to perceive stimuli.

        Motion Perception Data:

        1. IsMotionPerceptionEnabled?: Determines if the agent can use Motion Perception to perceive a stimuli.
        2. DetectionRange: Determines the maximum range at which stimuli can be sensed.
        3. DetectionCounter: A counter that decides if the agent should respond to the stimulus [Used because this is an indirect form of perception]
        4. CounterIncrementPerCycle: Controls the rate at which the Detection Counter increases if the stimulus is in range.
        5. CounterDecrementPerCycle: Controls the rate at which the Detection Counter decreases once the stimulus goes out of range.
        6. CriticalDetectionValue: Determines the threshold point for Detection Counter, at which the agent responds to the stimulus.
        7. DisplayAlertnessLevel?: Determines if changes in the Detection Counter value need to be displayed in the game space.

        Can Perceive Interests?: Determines if the Agent can perceive Interest Stimuli. If set to false, only Target stimuli will be perceivable. [For more about the stimulus types, check out: Stimulus Types]


        Note: The Perception system has no awareness about it's owning actor & uses a custom interface to receive & send messages. So if you're using a custom AI agent, make sure that the owner class implements the BPI_SensorySystem interface & it's functions. For reference, check out the implementation of the interface functions in BP_PatrolGuard_Parent.
        Dev blog: Unreal Possibilities
        Youtube channel
        FPS Tower Defense Toolkit Support Thread: https://forums.unrealengine.com/show...efense-Toolkit
        Top Down Stealth Toolkit Support Thread: https://forums.unrealengine.com/show...tealth-Toolkit
        Tower Defense Starter Kit Support Thread: https://forums.unrealengine.com/show...Support-Thread

        Comment


        • #79
          Hi, I don't see this 'User Defined' category in any of the bots in the level. I am using UE version 4.16. How do I change the size of the vision cone?

          Please help. Thanks.

          Comment


          • #80
            Originally posted by Leebaba View Post
            Hi, I don't see this 'User Defined' category in any of the bots in the level. I am using UE version 4.16. How do I change the size of the vision cone?

            Please help. Thanks.
            Hi Leebaba, the previous update had added a lot of changes to the AI implementation & one of the key modifications was the use of custom blueprint components to handle different features like patrol movement, ai perception, vision arc display, etc. As a result, the AI Perception component [More info here: https://forums.unrealengine.com/show...l=1#post726607] now stores the parameters that define the Vision Range/Angle, which in turn is used to create the Vision Arc.

            I do not have access to my PC for the next few days, & hence can't provide screenshots to describe the solution for your query. But you can open up the BPC_AIPerception component, select the VisualPerceptionData struct & set it to 'Editable' in it's properties section. Now if you go back to the bots placed in the level, & select their AI Perception component from the details panel, it should display the VisualPerceptionData in the User Defined Section. From here, you should be able to edit the Vision Range as well as Vision Angle.
            Dev blog: Unreal Possibilities
            Youtube channel
            FPS Tower Defense Toolkit Support Thread: https://forums.unrealengine.com/show...efense-Toolkit
            Top Down Stealth Toolkit Support Thread: https://forums.unrealengine.com/show...tealth-Toolkit
            Tower Defense Starter Kit Support Thread: https://forums.unrealengine.com/show...Support-Thread

            Comment


            • #81
              Thank you for the quick response, I manage to edit it in the bots details panel.

              A couple of questions:

              1. The value of VisionRange and HalfVisionAngle keep snapping to 0.0 when I change either one of the value. By default, its set to VR=300, HVA=45. After I set the VR=600, and HVA turns to 0.0 by itself. This breaks the vision arc and the bot no longer detect the player.
              2. The vision arc mesh doesn't update visually in the editor upon changing the value in VisionRange. It would be most helpful to see how far the range reaches in the editor.

              Thank you and looking forward to your solution when you have access to your PC.
              Click image for larger version

Name:	VisionArc.JPG
Views:	1
Size:	95.1 KB
ID:	1130785

              Comment


              • #82
                Originally posted by Leebaba View Post
                Thank you for the quick response, I manage to edit it in the bots details panel.

                A couple of questions:

                1. The value of VisionRange and HalfVisionAngle keep snapping to 0.0 when I change either one of the value. By default, its set to VR=300, HVA=45. After I set the VR=600, and HVA turns to 0.0 by itself. This breaks the vision arc and the bot no longer detect the player.
                2. The vision arc mesh doesn't update visually in the editor upon changing the value in VisionRange. It would be most helpful to see how far the range reaches in the editor.

                Thank you and looking forward to your solution when you have access to your PC.
                Thanks for pointing that out. I know for certain that editing normal component variables in the editor works, but from what you've described there may be a limitation when doing the same with data stored in structs. At this point, I can't say if it's an engine or toolkit bug. I will definitely get back to you about that after further testing as soon as I get access to the PC.

                For now, I would suggest editing these details from within the BP_PatrolGuard_Melee blueprint itself. It will do the same for all Melee bots in the level, but it should allow you to test out customized vision ranges for the bots. The Vision Arcs should also auto update themselves each time you change the values in this manner.
                Last edited by Stormrage256; 07-13-2017, 01:34 AM.
                Dev blog: Unreal Possibilities
                Youtube channel
                FPS Tower Defense Toolkit Support Thread: https://forums.unrealengine.com/show...efense-Toolkit
                Top Down Stealth Toolkit Support Thread: https://forums.unrealengine.com/show...tealth-Toolkit
                Tower Defense Starter Kit Support Thread: https://forums.unrealengine.com/show...Support-Thread

                Comment


                • #83
                  Originally posted by Leebaba View Post
                  Thank you for the quick response, I manage to edit it in the bots details panel.

                  A couple of questions:

                  1. The value of VisionRange and HalfVisionAngle keep snapping to 0.0 when I change either one of the value. By default, its set to VR=300, HVA=45. After I set the VR=600, and HVA turns to 0.0 by itself. This breaks the vision arc and the bot no longer detect the player.
                  2. The vision arc mesh doesn't update visually in the editor upon changing the value in VisionRange. It would be most helpful to see how far the range reaches in the editor.

                  Thank you and looking forward to your solution when you have access to your PC.
                  Hi, I tried out editing the Visual Perception Data from the editor & was able to reproduce the issue. It seems to be an engine bug, & has already been reported through the Answer Hub a couple of weeks ago. You can check out more details about it over here: https://issues.unrealengine.com/issue/UE-46795

                  But more importantly, it seems that changes made to variables in an actor component, from the editor only gets applied when you actually start the level. But as mentioned in the previous post, all modifications made from within the actual blueprint will get applied across all instances in the editor itself. In this particular scenario, you could create publicly editable debug variables that let you test different dimensions for the Vision Arc, as shown below:

                  Click image for larger version

Name:	testvar.png
Views:	2
Size:	391.7 KB
ID:	1131054

                  The Vision Arc Manager component uses the 'RetrieveVisionRangeDimensions' interface function to update the vertices of the Vision Arc Mesh at runtime. It fetches the required parameters from the AI Perception component under normal circumstances, but introducing an additional check to see if the game is running will let us return different values in the editor & runtime scenarios. If the game is not running, then it will use the test variables to construct the arc. So by controlling these variables, you can try out different radii & arc angles. Once you're satisfied with a particular set of dimensions, you can set those values within the Visual Perception Data struct.

                  If you're using this approach, just make sure to clear out the 'VisionArcVertexArray' at Event Begin Play within the Vision Arc Manager component. This is basically to clean up any extra vertices that could possibly be created by setting custom dimensions within the editor.
                  Last edited by Stormrage256; 07-13-2017, 02:32 AM.
                  Dev blog: Unreal Possibilities
                  Youtube channel
                  FPS Tower Defense Toolkit Support Thread: https://forums.unrealengine.com/show...efense-Toolkit
                  Top Down Stealth Toolkit Support Thread: https://forums.unrealengine.com/show...tealth-Toolkit
                  Tower Defense Starter Kit Support Thread: https://forums.unrealengine.com/show...Support-Thread

                  Comment


                  • #84
                    The v2.1 update has been submitted for Marketplace review. This update features a new Global Alert Level system that controls the activation of automated security devices like lasers & turrets, as well as deployment of reinforcement patrol guards, based on the stimuli perceived by all AI agents within a level. More details about the new features & modifications will be posted through the change log once the update hits the marketplace.

                    Gameplay demo for the upcoming v2.1 Top Down Stealth Toolkit (Windows) now available at: https://www.dropbox.com/s/sco5dlqnay...20Demo.7z?dl=0
                    Last edited by Stormrage256; 08-29-2017, 06:02 AM.
                    Dev blog: Unreal Possibilities
                    Youtube channel
                    FPS Tower Defense Toolkit Support Thread: https://forums.unrealengine.com/show...efense-Toolkit
                    Top Down Stealth Toolkit Support Thread: https://forums.unrealengine.com/show...tealth-Toolkit
                    Tower Defense Starter Kit Support Thread: https://forums.unrealengine.com/show...Support-Thread

                    Comment

                    Working...
                    X