Mortar Pro Plugin  Version 2
Modular Turret Plugin
All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Introduction

Mortar Pro Plugin simplifies the development process by providing a ready-to-use solution for creating autonomous turret guns. Developers no longer need to spend countless hours coding and debugging complex turret functionalities from scratch. The plugin streamlines the implementation process, saving valuable time and effort.

1. Core Plugin Made in C++: By leveraging the power of C++, the Mortar Pro Plugin ensures efficient and optimized performance for the autonomous turret guns. The plugin's codebase is designed with speed and efficiency in mind, allowing for smooth and responsive turret behavior without compromising on performance. Each asset ,c++ class /structure/Enum is having MortarPro as Prefix to avoid any naming issue.

2. Seamless Integration: Integrating the Mortar Pro Plugin into Unreal Engine 5 is a straightforward process. The plugin seamlessly integrates with the existing Unreal Engine tools and workflows, ensuring compatibility and ease of use. This enables developers to quickly implement and iterate on their autonomous turret gun mechanics.

3. Customization and Flexibility: The Mortar Pro Plugin offers a high level of customization and flexibility. Developers can tailor the autonomous turret gun mechanics to fit their specific game requirements. They have the freedom to adjust factors such as firing rate, targeting behavior, projectile properties, and more, allowing for unique and varied gameplay experiences.

4. Clean and Documented Code: The plugin's codebase is meticulously structured and well-documented, making it easy to understand and navigate. This ensures that developers can easily customize and extend the functionality of the plugin according to their specific requirements.

5. Plugin Documentation: The Mortar Pro Plugin comes with comprehensive documentation and video setup that provides detailed explanations of its features, functionalities, and usage. This help developers through the installation and integration of the plugin, making it easier for them to get started and utilize its features effectively.

6. Quality 3D Assets, Textures, Materials, FX: The Mortar Pro Plugin includes a collection of high-quality Demo 3D assets, textures, materials, and special effects. These assets are designed to enhance the visual appeal of games and provide developers with a wide range of options to create stunning and immersive environments.

7. No Need to Learn C++: One of the advantages of the Mortar Pro Plugin is that game developers do not need to learn C++ programming language just to use the plugin. The plugin provides pre-built functionalities that are neatly exposed in blueprints and can be easily accessed. This allows developers to focus on the creative aspects of game development rather than spending time learning a new programming language. However, it's worth noting that while developers can use the plugin without knowledge of C++, those who are proficient in C++ can extend the functionality of the plugin.

8. Optimized for Performance: The plugin also provides techniques for pooling ,aggregated tick manager and significance manager for performance benefit.

Autonomous turret guns can significantly enhance gameplay and immersion in various game genres, including first-person shooters, tower defense, and action-adventure games. The Mortar Pro Plugin empowers developers to create dynamic and challenging encounters for players, adding depth and excitement to their games.

Version 2 update

The plugin has been updated to Version 2 and contains additional features like

1. Beam Aiming Component - In addition to the Burst Aiming and Semi-Automatic Aiming Component, there is a Beam Aiming Component that will fire a projectile in a continuous manner like an electric/laser beam or a flamethrower.

2. Beam Projectile - This class of projectile is for the Beam Aiming Component. There are two Blueprints for the same: BP_MortarProLaserBeam and BP_MortarProFlame.

3. Target Component - To allow shooting at a custom target on a mesh, there is a MortarProTargetPointComponent. Using this component, Mortar Pawn will know the target point on a mesh so that it can shoot it.

4. Split Projectile Optimization - With the Plugin Update, projectile splitting has been made efficient to avoid doing extra sphere traces.

5. Optimization of Physical Based Projectile - With the Plugin Update, the movement of physically based projectiles has been improved by removing Extra Collision Volume (Repel Volume) and has been replaced by a much more efficient way to ignore collisions between projectiles.

6. Significance Manager - With Version 2 Update the plugin comes with Significance Manager, which is used for Physical Based Projectile Movement. Using this component, the tick rate for Projectile Movement can be changed based on distance which is configurable. User can even turn on/off Niagara Effects based on Significance Value.

7. Niagara VFX Changes - Niagara VFX has been slightly optimized to improve the performance of certain projectiles.

Before you proceed please note currently plugin supports only single player.

Installation

Plugin is made to for Unreal Engine 5.3 and for each new Engine update plugin will be updated in a timely manner. To use plugin you have to buy from epic market place https://www.unrealengine.com/marketplace/en-US/product/mortar-pro-plugin . I wanted to make sure that the plugin is affordable for all users, which is why I have kept the price at a reasonable rate.

Downloading

After buying and downloading the plugin from Epic Store enable plugin in the plugin browser from editor. After restarting there will be a Plugins Folder. There are two main folders in this plugin. Content - Containing All the blueprints, Meshes and Materials related to the plugin. Source - Source Code for the Plugins. There are four folders

  • Fx - This contains Niagara effects and all its related resources,
  • Mortars - This contains Mortar Pawn setup including Blueprint,meshes,materials and textures.
  • Projectiles - This contains setup related to Projectiles like Blueprint,meshes,materials and textures.
  • Showcase - This folder is only for demo purpose and not to be used in actual gameplay. In this there are two levels provided where user can get more information about the working of the plugin.
Plugin Folder

 

Note - If you are not able to view source code for plugin then all the temporary folders of your project like Binaries, DerivedDataCache, Intermediate, Saved and Project.sln and then generate visual studio files by right clicking Project.uproject

Plugin Components

The plugin contains 28 C++ classes, 16 Blueprint classes, 30+ Materials,50+ textures,15+ Niagara effects.

C++

All of the 28 classes belong to 5 groups

  1. AI - This group contains classes related to AI and behavior tree.
  2. Components - This group contains classes which are static mesh component or actor component. Like TeamComponent, HealthComponent, AimingComponent,Significance Component,Target Component.
  3. Projectiles - This group contains projectile classes. There are three categories of projectiles Physical Based Projectiles, Line Traced Projectiles and Beam Based Projectiles which also does line trace.
  4. Misc - This group contains utility classes like classes for Subsystems.
  5. Common - This group contains classes that are common like MortarPawn,MortarProPoolable Actors and Viewport classes.

Details of the classes will be shared later in the section.

Following are the c++ files that are used in the plugin

Header File Group Description
MortarProPawn Common This is Main Class of the Mortar Plugin which will be spawned at a game level. Derives from the Pawn Class which will contain all the other components. All the mesh setup has to be done here including the total times the actor will be respawned.
MortarProPoolableActor Common This is a class for poolable actors like projectiles. This provides functionality for deactivation and activation from pool. These actors are never destroyed rather deactivated from world and to use they are activated. This class provides basic functionality and it is up to child classes to extend the functionalities.
MortarProViewportClient Common This is a class used for Updating player viewport coordinates. Derives from GameViewportClient This class is used By Significance Manager to manage tick rates of ProjectileMovementComponent. The class has to be set in Project Settings.
MortarProAIController AI This is the mind of AI which will be responsible for detecting other actors and setting up keys for the blackboard. This Derives from AIController By default MortarProController is configured for hearing and sight perception with default parameters. More senses can be added via blueprint provided or in the C++ class itself. Blackboard and behavior tree has to be set here. After creating a derived blueprint from MortarProAIController, Mortar Pro should possess the derived blueprint. All this is done in the demo shared. It also has functionality to target friends/neutrals based on team id but for this to work AI Controller should have all the three option to detect enemy, friends and neutrals to be true.
MortarProAIBaseTaskNode AI This is the base class for Behavior Tree Task Node Which inherits from UBTTaskNode. All Behavior Tree tasks should inherit from this class. This class checks some conditions and selects the best enemy among the detected actors. This best enemy then can be used by other tasks as the main Target.
MortarProShootingTask AI This is the Behavior Tree Task node for Shooting a target. This class inherits from MortarProAIBaseTaskNode. On successful detection of target, it will tell MortarPro Actor to point and shoot the target else it will move to default position
MortarProAIIdleTask AI This is the Behavior Tree Task node for idle behavior when no target is there. This class inherits from UBTTaskNode
MortarProBarrelMeshComponent Components This is a StaticMeshComponent which is the topmost part of the Mortar Pro Pawn From where the Projectile will fire. The projectiles spawn through the socket that has to be set in the static mesh in editor. MortarProBarrelMeshComponent will allow Elevate. Elevation speed, maximum angle, minimum angle of barrel can be set here.
MortarProTurretMeshComponent Components This is also a StaticMeshComponent This is the Middle Part of the Mortar Pro Pawn on which the Barrel will be attached. This allows rotation along Z axis. Maximum speed of rotation of turret can be set here.
MortarProGenericMeshComponent Components This is a StaticMeshComponent. This is an optional component that allow users to add more meshes to mortar pro pawn which can rotate along y axis (like minigun rotating while firing) or can have a recoil effect. Their speed and recoil offset can be set here. In the example shared all the blueprints are having two MortarProGenericMeshComponent that are attached at Gun Holder which is a Mortar Pro Barrel Mesh Component.
MortarProTeamComponent Components This is an ActorComponent which is responsible for assigning a team to any actor. Each team has an id, a color and a name. Actors with same team id are friends, actors having 0 as id are neutrals and actors with opposite ids are enemies.
MortarProHealthComponent Components This is a generic ActorComponent Class for health-related functionalities. Functionalities like current health, maximum health and other health related functionalities are set here. Also provides functionality to avoid same team damage.
MortarProAimingComponent Components This is an ActorComponent which is responsible for aiming the barrel to the desired location and other fire-related things. This component provides a lot of features for shooting and it is encouraged to explore them by going through the blueprints shared or code. Some of the features are setting projectiles for each socket. Each socket can have different projectile classes. Functionality for shooting projectiles, Firing sound can be set here along with shots spread degree. It maintains firing state that is Default,Reloading,Aiming,Locked,OutofAmmo,Cooldown and BurstShootingCoolDown, BurstShootingBurstFiring and Beam Firing. It also provides many events that can be handled in blueprint for more functionalities.
MortarProSemiAutoAimingComponent Components This is an ActorComponent which derives from MortarProAimingComponent. MortarProPawn can have MortarProSemiAutoAimingComponent or MortarProBurstAimingComponent or MortarProBeamAimingComponent as aiming component, and all of which provide different shooting functionalities. MortarProSemiAutoAimingComponent provides shooting capability where the gun fires in semi automatic manner with a delay as reload time. All default parameters that MortarProAimingComponent provides can be set here. In the example shared, all blueprints are using this shooting component except BP_MortarProMinigun(MortarProBurstAimingComponent), BP_MortarProLaserBeamGun(Mortar Pro BeamAiming Component) and BP_MortarProLaserBeamGun(Mortar ProBeamAimingComponent)
MortarProBurstAimingComponent Components This is an ActorComponent which derives from MortarProAimingComponent. This shooting component provides functionalities for burst firing. Users can set burst rate, burst duration, cooldown duration, cooldown timer rate. This class also provides many events which will be shared later in documentation. Just like Just like MortarProSemiAutoAimingComponent all default parameters that MortarProAimingComponent provides can be set here. In the example BP_MortarProMinigun which is using MortarProBurstAimingComponent.
MortarProBeamAimingComponent Components This is a third type of Aiming Component.Using this component the Mortar Pro Pawn can shoot continuous beam like in case of Laser/Electric Beam or a flamethrower. BP_MortarProLaserBeamGun and BP_MortarProFlameThrowerGun are present in the plugin which are using MortarProBeamAimingComponent.
MortarProProjectileMovement Components This is a projectile movement component. The component is used in Projectiles that move physically. Using this component the ticks of the component is registered with MortarProAggregateTickSubsystem which helps in performance as the ticks are aggregated.
MortarProSignificanceComponent Components This is an Scene Component used for configuring Significance on any actor. Using this component, users can manage the tick rate based on significance values that are Highest, Medium, Lowest and Hidden. These values are set based on distance and the user can not only set tick rates but can also turn on/off certain effects. In the plugin using this component, the projectile movement tick rate is managed to give performance benefits.
MortarProTargetPointComponent Components This is a Scene Component that helps in identifying the point on a mesh to shoot at.
MortarProBaseProjectile Projectiles This is the base class for physical as well as hit scan based projectiles. It's kind of abstract class and the functionalities have to be extended in the child classes.
MortarProPhysicalProjectile Projectiles Inherits from MortarProBaseProjectile. This class is for projectiles that move using projectile movement. Users can set here the Niagara launch blast, Niagara trail. Users can also set Niagara impact effect, damage as well as sound effects for different surfaces. Speed of projectiles have to be set here by which it will be fired. Also homing missile functionality is there by which it will chase the target actor
MortarProMineProjectile Projectiles This Class inherits from MortarProPhysicalProjectile Class. This class allows Projectile to blast with delay explosion. This is a projectile that will travel in an arc based on gravity scale set. For this to hit at right target Enable Gravity should be enabled in MortarProAimingComponent which allows essential calculation to take place for finding right direction to spawn projectile at. In addition to all the default behavior of MortarProPhysicalProjectile it also provides Niagara explosion effect that will happen after a delay on hitting a target.
MortarProSplitProjectile Projectiles This Class inherits from MortarProPhysicalProjectile Class. This class allows Projectile to get split into multiple projectiles and hit multiple target.
MortarProLineTraceProjectile Projectiles This Class inherits from MortarProBaseProjectile Class. This class does a line trace to target for hitting. There is no projectile movement component involved for movement. This class of projectile is best suited for projectiles that are spawned in huge numbers and don't require trail effect and movement in a level like bullets.
MortarProBeamProjectile Projectiles This Class inherits from MortarProBaseProjectile Class. This class of projectile is meant to be used for Beam Aiming Component and it does multiple line traces or box trace for hitting a target. There is no projectile movement component involved for movement.
MortarProActorsObject Misc It is derived from UObject which stores TArray of Actors.
MortarProPoolSubsystem Misc This class is derived from UWorldSubsystem and is responsible for managing the pool of the projectiles. Users can set count for each projectile in the BP_MortarProPoolSubsystem.
MortarProAggregateTickSubsystem Misc This class is derived from UWorldSubsystem and is responsible for aggregating the ticks of registered objects for performance benefit. Here we use to register ticks of projectile movement component.

Blueprints.

There are 16 Blueprints provided excluding the one provided as demo. Blueprints are present in Mortar and Projectiles folders. Following are the necessary blueprints -

  • Blueprint deriving from MortarProPawn - Pawn that will be spawned in a game. Here we will setup all the meshes.

Blueprint deriving from MortarProBaseProjectile - Projectile that will be spawned by MortarProPawn on firing.

  • Blueprint deriving from MortarProPoolSubsystem - Blueprint class that allows user to set the pool size for each projectile class.
  • Behavior Tree Blueprint - Behavior tree that we will setup for the AI.
  • Blackboard - Blueprint that stores the key for detected actors.
  • Blueprint Deriving from MortarProAIController - Blueprint class where we will set reference for Blackboard and behavior tree.

For showcase following are the blueprints present in MortarProPlugin.

Blueprint Name Module Description
BP_MortarProLaserGun,
BP_MortarProMissileLauncherGun
Pawn Blueprint deriving from Mortar Pro Pawn C++ Class This is the blueprint that will be placed in the world. User have to setup StaticMesh before using finally in level. These blueprints show the behavior of semi auto shooting mode without gravity projectile.
BP_MortarProBombLauncher Pawn Blueprint deriving from Mortar Pro Pawn C++ Class. This blueprint shows the behavior in case of gravity projectile and it will shoot target in an arc while considering gravity.
BP_MortarProBurstModeMiniGun Pawn Blueprint deriving from Mortar Pro Pawn C++ Class. This blueprint shows the behavior of Burst shooting mode.
BP_MortarProLaserBeamGun Pawn Blueprint deriving from Mortar Pro Pawn C++ Class. This blueprint shows the behavior of Beam shooting mode.
BP_MortarProFlameThrowerGunGun Pawn Blueprint deriving from Mortar Pro Pawn C++ Class. This blueprint shows the behavior of Beam shooting mode.
BP_MortarProAIController AI Blueprint deriving from MortarProAIController C++ Class. Things like AI Senses, blackboard asset, behavior tree asset has to be set up in it
BP_MortarProLaserProjectile,
BP_MortarProMissileProjectile,
BP_MortarProSplitPayload
Projectiles Blueprint deriving from MortarProPhysicalProjectile C++ Class. These are simple non gravity projectiles and go in straight direction. Speed, Homing Missile, delay, damage amount, effects can be set here along with other movement properties.
BP_MortarProGravityBomb Projectiles Blueprint deriving from MortarProMineProjectile C++ Class. It is gravity enabled. All the properties that can set in normal projectiles can be set here except speed. Speed will be calculated by ShootingComponent when enable gravity is on.
BP_MortarProSplitMissile Projectiles Blueprint deriving from MortarProSplitProjectile C++ Class . In addition to all the properties of MortarProProjectile, split count, delay and projectile to spawn can be set here.
BP_MortarProBulletsLineTrace Projectiles Blueprint deriving from MortarProLineTraceProjectile C++ Class . This class does only Line Trace towards the target location Instead of physically moving the projectile. Should be used where physical movement is not required like bullets.
BP_MortarProLaserBeam Projectiles Blueprint deriving from MortarProBeamProjectile C++ Class . This class does continuous box Trace to hit the target.
BP_MortarProFlame Projectiles Blueprint deriving from MortarProBeamProjectile C++ Class . This class does 7 line traces continuously to hit multiple targets.
BP_MortarProPoolManager Misc Blueprint deriving from MortarProPoolSubsystem.In this blueprint the number of resources that can be spawned are specified

Other Assets.

Although the plugin is mainly about C++ but for demonstration purposes it also includes static Meshes and materials and effects.

  • Niagara Systems - There are 15+ Niagara effects for firing, death, launch blast etc.
  • Materials - There are about 30+ Materials for Mortar guns, projectiles.
  • Textures - There are about 50+ textures which contains AO, albedo, normal maps, metallic, roughness map for Mortar Pro Pawn. The textures used for Mortar Pro Pawn are 4k ,for effects it is mainly 2k.
  • Meshes - There are about 14 meshes including meshes for Mortar Pro Pawn ,projectiles. Each Mesh is of high quality and game ready.
  • UI - 1 Health bar to denote health as well as team of actor.

Show Case

Besides the main content ,plugin also comes with Showcase folder that has its own level,assets and materials. There are two Level provided.

  1. Overview - This level shows the overview of various features and functionalities.
  2. Demo - This level contains demo of Mortar Pro Pawn.