This Gadget is a direct recreation of the famous OCP gadget from Splinter Cell. It is used for disrupting electronic devices for some amount of time like - lights, cameras, radio, tv etc. Here I have created this gadget mainly for disrupting lights to work hand in hand with the Shadow Detection System. But of course I have created a scalable solution which can be expanded with more electronic items.
Because the system is tied to a pistol mesh attached to our character, the system is set in the BP_Bot class. Input action event is triggered which will do a forward line trace originating from the pistol. There is a circle attached to the pistol which acts like an indicator to visualize if an electronic device is successfully disrupted.
Why do we need the circle? - A traditional crosshair won't be present for this gadget which is replaced by a red laser because of the below reasons:
The scene is highly contrasting with a lot of black and white areas, it is difficult for the player to spot the crosshair all the time.
The players will have to aim carefully and patiently as the laser moves with the pistol, and the Aim animation makes the player move their hands very subtly.
These restrictions help in balancing the power of the gadget which I will talk about more below.
The code will check if the Hit Object implements the EmpInteractionInterface and accordingly visualize through the circle. The interface function is also called on the Hit object which will then execute the disruption behaviour for the amount of time passed with the function.
Interface allows us to achieve two main things -
Highly scalable, modular and time saving solution. With this design, only one line trace and a function call can disrupt any kind of electronic device as long as it implements our interface function. In order to add more electronic devices, one only has to create an Actor blueprint, Add the mesh, and implement the interface function and define what it does.
Because we are passing the disruption time from the character blueprint, there will be a consistency among all the electronics. Upgrading skills which allow players to increase the disruption time for all gadgets can be easily implemented as only one variable at one place is to be increased and the disruption time will update for all electronics.
Balancing the Gadget -
A pistol capable of disrupting electronic devices for a period of time is a really powerful gadget which often can be abused by the players to make the game easy. It is essential to out balance the gadget and to prevent it from becoming overpowering.
After a successful disruption, the pistol cannot disrupt any other electronic device for a period of time. Hence an input lock is done after calling the interface function until the Re-charge/Regen Time passes out.
The absence of an crosshair and addition of a laser helps balancing the game even more as now players have to patiently and carefully aim before shooting.
First things first, in order to even test this gadget we'll need a gadget first. When implementing an Aiming Locomotion, the general or most common way is to integrate an 8-way directional movement with proper Aim-Run Animations. Because I am doing this for learning purposes, I went for a different and more restrictive approach.
REASON for a Restrictive Approach
I wanted to experience a situation where one is bound by constraints and limitations
Getting a deep understanding and experience of Unreal Engine's toolset was my main goal