Ai Enemies - Assault Soldier: Documentation
Ai Enemies - Assault Soldier: Documentation
Artificial Intelligence
Support : [email protected]
documentation
Character Blueprint with the behaviours of a generic Assault Soldier. Animations are synchronized to
the character's movements around 8 axes. Death and Fall animations can be managed via Animation
Sequence or configurable Physics. Spawn system included.
Preface:
This pack contains some Blueprint Classes and assets able to reproduce the behaviours of a generic
Assault Soldier . Ideal for player's enemies or allies in a First Person and Third Person Project . It's
also possible to create different groups of enemies. Behaviour is configurable to reproduce different
scenarios. All animations are replaceable. A Spawn System will help you manage resources to
spawn. Assault Soldier can interact with all other Characters in the scene.
3 Objectives System
4 Blueprints
5 The AI Algorithm
6 All Templates support
7 System Warnings
(1) Installation and configuration
• Copy the folder ...Content/AIEnemiesSoldier from pack to your Content Folder (or Migrate the
folder).
• Add NavMeshBoundsVolume to your Map (if you do not already have one)
Ensure that NavMeshBoundsVolume cover the entire area of your Map. (Press P in Editor to
view areas covered).
• In the Content Browser locate the folder AIEnemiesSoldier/Blueprints
• Place one or more BP_BaseAITargetPoint in the scene and ensure that Targets are reachable
by the Character inner NavMeshBoundsVolume. Look at Z Location of BaseAITargetPoint and
place it around the half height of the Character's capsule starting from the ground plane
and, in each case, never place in a Z location higher than capsule height.(avoid to put it
on the ground because Target Points is a sort of eyes of the character and it should not be
hidden by the ground plane)
(1.1)Configure BaseAISpawner Note : for a quick setup you could just compile the fields BaseAICharacter and
Enemies. At this point BaseAISpawner is ready to spawn the defaults.
• Behavior : Generic behavior of the Character. See paragraph (5) of this document.
• Risk : (percentage) Set this value between 1 to 100. Greater values mean that the Character increases
exposure to enemies (default value 50 - balanced) .
• SpawnIfSecure : If checked then the spawn occurs only if the player is not traced.
• UnSpawnIfSecure : If checked then the despawn occurs only if the player is not traced.
• UseAnimationBlueprint : If checked then BaseAISoldier_AnimBP is used, otherwise Animation Asset
system is used.
• Unbreakable : If checked then the projectiles won't affect health.
• FriendlyFire : If checked then allow friendly fire. (Note: for full functionality you have to manage apply
IgnoreActorWhenMoving in your projectile spawn function, specifying allies to ignore. See section
note[1] in this document for details).
• AlwaysLookAtEnemy : When unchecked then the Character looks at the enemy only if the enemy is
detected.
• IDLE_Delay : (percentage) Higher values increase the waiting time when TargetPoint is reached , before
start to walk again.
• FireDelay : (seconds) Lower values increases Fire frequency
• BaseAIProjectile : the projectile to spawn on fire.
• ProjectileImprecision : (num) Lower values increases projectile precision.
• SpawnProjectileTracer : (bool) Spawn projectile tracer (from ver. 4.26).
• TraceEnemyImprecision : (percentage) Lower values increase the probability to detect enemies.
• DestroyDelay : (seconds) Waiting time after death and before execute destroy().
• SecurityDistance : (units) Security distance to enemy. Try to maintain defined distance to enemy.
• DetectionDistance : (units) Detect Enemy only if distance to enemy is lower than this value
(1.1.2)BaseAIPhysics :
• PhysicsImpulse : (impulse) Intensity of the additional impulse to apply to the Character when it Hit the
projectile.
• PhysicsImpulseType : Force the Character to fall in a specified verse ('Default'- the falls depends
on the projectile direction ).
• HitBoneName : Specify the Bone on which to apply the impulse (leaving at None, the system will
calculate this value. It will depends on the projectile impact ).
• Create a new Blueprint class and assign BaseAISoldier as Parent Class. Now new Character is
created.
• Note : when you create a new character , you have to add it in the Enemy
Array(FirstPersonBP/Blueprints/FirstPersonCharacter/BaseAISettings/PL Enemies) of the First
Person Blueprint if you want the character as player enemy. Also see the variable PL Ignore
Allies of First Person Character(If checked then all the Characters not specified in the variable
PL Enemies will be ignored by the Player Fire) . See note[1] of the documentation for details.
In Details Panel of the Character modify the values of sections BaseAIAnimations and
BaseAIParticles if needed and leave the values of sections BaseAISettings and BaseAIRagdoll
as is as , BaseAISpawner will overwrite them.
Note : You can opt to direct spawn of the Character, without using BaseAISpawner ; in this
case consider modifying also BaseAISettings and BaseAIRagdoll.
(2.2.2.1) BaseAIAnimations :
*IMPORTANT NOTE : to take advantage from Animation Blueprint , you need to assign
BaseAISoldier_AnimBP to your created character :
1)Create a new animation Blueprint from skeletal mesh of the created soldier.
2)Assign BaseAISoldier_AnimBP as Parent class of the created Animation Blueprint
3)Assign created Animation Blueprint to you Character Mesh
4)Make sure useAnimationBlueprint is cheched in BaseAiSpawner
SpeedWalk : Velocity of the character's movement when Walk animations are executed (use it to
synchronize Character velocity with the animation scale)
• SpeedRun : Velocity of the character's movement when Run animations are executed (use it to
synchronize Character velocity with the animation scale)
• FallingDuration : Duration of Falling_down animation
• StandingDuration : Duration of Standing_up animation
• HitDuration : Duration of Hit animation
• RealoadDuration : Duration of Reload animation
Open Details Panel of Character's Blueprint to change the Skeletal Mesh of the Weapon
The Character try to spawn a BaseAIProjectile on Fire event. You can Create a new Blueprint
class and assign BaseAIProjectile as Parent Class. Now new Projectile is created.
• You can change projectile to spawn in BaseAISettings of the Character.
• Also look at BaseAISettings of new projectile class to set:
• Use the ApplyDamage method in your player projectile to apply damage to NPCs (See
FirstPersonProjectile for details).
• Note : If you need to spawn your custom projectile(not a BaseAIProjectile) then you have to
modify the Blueprint function ..Blueprints/System/BaseAICharacter/SpawnProjectile
(3) Objectives System (see Level 5 of the demo project for details)
Through the Objectives System , the character can attack any blueprint in the scene
Ensure the mesh is inner the capsule of the objective otherwise the character can't shoot it.
Assign the objective as an enemy of your character in BaseAISpawner
What the algorithm do is to select one of the Target Points in the scene and then try to move
the Character on it. Selection of the Target Point to move to is a probabilistic process , it
mainly depend on setting parameter 'Behavior' of the Character and can be influenced by
other parameters and some runtime variables. The Result will be always probabilistic. Finally
the algorithm reproduces a behavior of a generic Assault Soldier . The character always try to
find and destroy the enemy.
So, the final scenario depends on position of the Target Points in the map, number of
Target Points, enemies location and setting parameters.
VR support
Vehicle support
– BaseAITargetPoints not found in Action Radius BaseAISoldier : (Ensure the Targets are in
defined Action Radius starting from BaseAISpawner location or define an Array of TargetPoint )
note[1] :
If you want to avoid the player projectile hitting an ally (not enemy) character when FriendlyFire is
disabled for the character , then you need to implement IgnoreActorWhenMoving in your player class
when the projectile is created. You can manage this in your custom player class (for a complete
sample see FirstPersonBP/Blueprints/FirstPersonCharacter contained in the pack project and follow
sections script Ignore Allies). In every case specify an Array of enemies for the player in
BaseAISettings and set the variable PL_IgnoreAllies.
Also use the ApplyDamage method in your player projectile to apply damage to NPCs (See
FirstPersonProjectile for details).
.
General notes:
Folders FirstPersonBP , FirstPerson and Geometry contained in the pack are from customized Ue4 First person
template . If you use this pack in your existing project template then you can not consider above folders.
Important/Additional Notes:
Assault Soldier natively interacts with Character Class . Other dynamic objects in the scene will be
ignored unless managed by the Objectives System.
Support : [email protected]