0% found this document useful (0 votes)
93 views20 pages

Ai Enemies - Assault Soldier: Documentation

This document provides instructions for configuring and using a Blueprint character class for an assault soldier enemy in Unreal Engine. Key steps include: 1. Install the soldier assets and configure spawn settings and physics. 2. Create or modify a soldier character Blueprint class - change the mesh, animations, and weapon. 3. Configure the spawn system and AI behavior parameters, such as health, detection distance, and idle delays. Animation and damage systems are also customizable. The assets include everything needed to create platoon of configurable soldier enemies to populate levels in a first-person or third-person game.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views20 pages

Ai Enemies - Assault Soldier: Documentation

This document provides instructions for configuring and using a Blueprint character class for an assault soldier enemy in Unreal Engine. Key steps include: 1. Install the soldier assets and configure spawn settings and physics. 2. Create or modify a soldier character Blueprint class - change the mesh, animations, and weapon. 3. Configure the spawn system and AI behavior parameters, such as health, detection distance, and idle delays. Animation and damage systems are also customizable. The assets include everything needed to create platoon of configurable soldier enemies to populate levels in a first-person or third-person game.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

AI ENEMIES – ASSAULT SOLDIER

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.

Plug and play.

1 Installation and configuration


1.1 Configure BP_BaseAISpawner
1.1.1 BaseAISettings
1.1.2 BaseAIPhysics
1.1.3 BaseAIRagdollSettings

2 Create or modify an Assault Soldier


2.1 Create a new Character
2.2 Modify an existing Character
2.2.1 Change Skeletal Mesh
2.2.2 Configure Character's animations , particles and sounds
2.2.2.1 BaseAIAnimations
2.2.2.2 BaseAIParticles
2.2.2.3 BaseAISounds
2.2.3 Change the Character's Weapon
2.3 Change the Character's Projectile and the damage to apply

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)

• Place one or more BP_BaseAISpawner in the scene

(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.

• Select a BP_BaseAISpawner in the scene


• Go to the Details Panel and locate the following groups: BaseAISettings, BaseAIPhysics,
BaseAIRagdollSettings.

(1.1.1)BaseAISettings : Complete the fields with appropriate values.

• BaseAICharacter : Character to Spawn(select existing one).


• Enemies : Define enemies(other characters) of the Character.
• Health : Initial Health. (note:amount of damage will depends on projectile Damage parameter)
• ActionRadius : (units) Filter Target Points within the specified radius starting from
BaseAISpawnerlocation. Note: when TargetPoints Array is not empty this parameter is not considered
by the system.
• TargetPoints : TargetPoint array . Leave empty if you want to use ActionRadius parameter to filter
Target Points.

• SpawnNum : (num) Max number of spawns.


• RespawnDelay : (seconds) Delay after first spawn - after this value the system check if previously
spawned Character is destroyed. If yes then re spawn new instance of the Character in the scene.
• SpawnDistanceToPlayer : (units) Spawn Character only if distance to player is lower than this value.
• UnSpawnDistanceToPlayer : (units) When distance from the Character to player is greater of this
value then Character destroy itself.

• 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

• RechargeAfter : (num ) Execute Reload animation after this value .


• WarnNoEnemies : If checked then warn if the enemy array is empty after the character is spawned.

(1.1.2)BaseAIPhysics :

• EnableRagdollOnDeath : If checked then BaseAIRagdollSettings are considered, otherwise Animation


Sequences of death are considered (DIE_FRONT , DIE_BACK and DIE_FROM_FALLING)

(1.1.3)BaseAIRagdollSettings : Fill the fields with appropriate values.

• 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 ).

(2) Create or modify an Assault Soldier

(2.1) Create a new Character

• 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.

(2.2) Modify an existing Character:

(2.2.1) Change the Skeletal Mesh :


Open Details Panel of the Character Blueprint to change the Skeletal Mesh

• All humanoid characters must be rigged to the Epic Skeleton.


The mesh must have a Physics Asset set up :
see https://docs.unrealengine.com/en-us/Engine/Physics/PhysicsAssetEditor for details
(Note: You can opt to use a SkeletalMesh not rigged to the Epic Skeleton. In this case fill
BaseAIAnimations fields of the Character class with appropriate Animation Sequences.)

• Skeleton must have a WeaponSocket attached to hand_r with


Location(-11,621268 4,870091 -2,797044)
Rotation(4,826419 16,407269 78,466751)
(or adjust manually)
(2.2.2) Configure the Character's animations , particles and sounds :

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

(compile other animation fields with appropriate Animation Sequences)


(2.2.2.2) BaseAIParticles :Fill the fields with appropriate values.

• ParticleBlood : Particle to spawn when projectile hit the character

• ParticleOnFire : Particle to spawn when the character execute fire event.


(2.2.2.3) BaseAISounds :Fill the fields with appropriate values.

• OnFireSound : (Sound Base) The Sound on Fire.


• OnHitSound : (Sound Base) The Sound on Hit. (from engine version 4.22)
• OnDeathSound : (Sound Base) The Sound on Death.(from engine version 4.22)
• OnReloadSound : (Sound Base) The Sound on Reload.(from engine version 4.22)

(2.2.3) Change the Character's Weapon

Open Details Panel of Character's Blueprint to change the Skeletal Mesh of the Weapon

(2.3) Change the Character's Projectile and the damage to apply

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:

• EffectParticle : (Particle) The particle on impact.


• SoundOnImpact : (Sound Base) The Sound on impact.(from engine version 4.2
• Damage : Damage amount
• DamageRadius : when > 0 then method ApplyRadialDamage is called
• TracerPlayRate : tracer play rate
• TracerPercentage : tracer spawn percentage
• Scale : scale of projectile mesh
• Speed : projectile speed
• HiddenInGame : hide or show the projectile mesh
• To change projectile tracer particle open Blueprints/System/BaseTracer and setup
ParticleSystem.

• 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

Create a new Blueprint class and assign BaseAIObjective as Parent Class.


Open any Blueprint class and attach the created BP_Objective to the mesh(just drag
BP_Objective from Blueprints folder under the mesh )

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

See level 5 of the demo project for details


(4) Blueprints

• BaseAICharacter : Super class of the system. Implements common functions.

• BaseAISoldier : A Blueprint which has BaseAICharacter as Parent class. Implements an


Artificial Intelligence that simulate a generic assault soldier behavior.

• BaseAIProjectile : Implements a customized projectile .

• BP_BaseAISpawner : Configurable spawner. It spawn any BaseAICharacter classes.

• BP_BaseAITargetPoint : A Blueprint which has TargetPoint as Parent class.

• BaseAIController : A Blueprint which has AIController as Parent class.

• BP_Soldier : A Blueprint which has BaseAISoldier as Parent class.

• BaseAIObjective : A Blueprint which has BaseAICharacter as Parent class. Implements an


Objectives System.

(5) The AI Algorithm (synthetic explanation)

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.

(6) All Templates Support


AI Enemies natively supports First and Third Person Templates. If you want to implements this pack in
the other Templates (included VR) then you can use the Objective System(see paragraph 3 of the
documentation for details).
Follows some samples to setup the No Character Based Templates.
VR support

VR support
Vehicle support

(7) System Warnings


– Invalid BaseAICharacter to Spawn BaseAISpawner : this field is required and cannot be
empty. (Actor to spawn must have BaseAICharacter as parent class)

– Unspawn Distance must be greater than Spawn Distance BaseAISpawner :


(UnSpawnDistanceToPlayer values must be greater than SpawnDistanceToPlayer)

– Enemies Array is Empty BaseAISpawner : enemy array cannot be empty

– Controller NOT Found BaseAISoldier : (AI Controller Class must be BaseAIController)

– 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]

You might also like