All language subtitles for 13. FSM Attack (GOOD)

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Welcome to the attack functionality.

Every tank type in this project has a different attack structure.

We will need to go through each state machine and also through the code that powers everything.

But before, we need to discuss the bigger picture of the attack, because when an agent receives a

new target, the attack state is triggered.

This happens for all the attacks.

Most likely the target is not in the firing range, so the tank needs to adjust its position to get

close to it.

Once it is closer, it will fire and then it will do a reload, also known as a cooldown.

There are some variations to this as following the aggressive.

I will follow this pattern, move the target attack and then reload.

After the reload it will try to move to target if necessary, then attack and reload the defensive.

I will follow this pattern.

Move to target, attack burst cooldown.

So this means that a series of repeated attacks, then reload, then go to cover and then finally repeat

the tactically I is going to first move to cover position, then attack, then do a cooldown and also

adjust if necessary.

And lastly, move to cover position again.

So basically everything has a cycle, but it's a little different.

So we'll go into each state machine and see how it works.

Let's start by looking at the script that powers everything after the main initialization of various

objects and systems that are required for this, we need to look at some other objects that are really

important here, and some of these are, of course, the timers because we already know the tank mover

is the system that is responsible for moving the tank and that sends a signal I'm finished moving,

but we have a couple of different timers like Reload, Burst Cooldown, go to Target.

So let's quickly go through each one of them and see what they do.

The reload timer is triggered after each shot to put the delay between them.

The burst timer is used for the defensive air to fire a sequence of projectiles and then do the reload.

The go to target timer is triggered when the location was reached and the air needs to wait a little,

let's say idle time to make it look more realistic.

The timer target search for how long the eye will actually search for a lost target and the cover weight

will know for how long the eye needs to stay behind a cover.

We also will adjust some default parameters for the final state machine in entry.

That happens only once the state enters.

We have the following things.

If it's the entry state, then this means that the state for the attack was the initial one, basically

the entry state here and only fits the entry state.

We restart the communicator and if it's any other state we'll do the following.

If the tank is in the go to state, we first need to make sure that the target is still valid because

we cannot go to a target that's destroyed by another enemy.

We will generate a new path towards it by using the nav mesh and get a simple path.

So we'll stop the tank mover in its current path and we will send the new path.

The move path the state will exit was the range between the agent and the player gets lower than the

firing range of the current.

This range is updated at every frame.

We will look at that into a second.

Once we are entering the firing state or the attack fire, we need to check the target to see if it's

still valid.

We will stop the tank mover because the next step is to fire a projectile.

So we will issue a fire command.

If the state is go to wait, we will start the weight timer.

We will, of course, stop the tank movement and then start the go to timer.

We have a random range to make the tank look like it's holding its breath for a second before continuing

to a different position.

The next state is called Search for Target State, and here the first thing to do we need to set the

target search over to false, then start the target search timer.

This timer, once it reaches zero, it means that we didn't find the target in the timer.

So it will completely remove the target from this guy's memory.

And lastly, we need to stop the tank mover and we will need to generate a path from the current position

to the last known position of the target.

And we will give this path back to the tank mover.

Of course, we need to set up the parameters for the finite state machine that is target search over

to false because we are just starting it.

The hide state is specific to the defensive way and is called.

After each reload happens the tank will do a sequence of fire, then move to cover, then fire again.

For this we need to stop the tank mover.

We need to get the new cover point.

And of course, if the cover point is not normal, so this means that it exists, we need to generate

a new move path using the nav mesh.

Give this to the tank mover.

We also need to disable the lose target from the target handler.

This will make sure that once the defensive breaks visual contact with the target, we don't actually

start the lose target timer because otherwise it will go into hiding and then it lose the target by

the time it comes back.

And we need to initialize the current cover to the last detected cover.

We will also set up the cover miscount to zero.

The attacker just position state is only used for the.

Tactical.

Thank you, I.

This state what it does is basically detects when the tactical tank guy doesn't hit the player over

and over again, which means that probably it's quite close to the building and we need to adjust the

position.

So first, of course, we need to check if the target is not now, then we need to stop.

Any movement will calculate the direction vector from the current agent to the player.

And basically we need to move in the opposite side to get a clearance between the agent and the building.

I just put minus ten here so we will get to the current tank position.

We add the new direction that you just calculated between it and the player, and we multiply this station

to minus ten, so we get a proper clearance hopefully, and then we'll move to this new position in

hopes that the adjusted position will be better from the current one in on update.

Things happen every single frame when this state runs.

If there is a target and it's valid, we need to look at it all the time.

We've our target.

Of course, you need to set other two rotations of the turret to zero so that the turret doesn't tilt

in the wrong ways.

And then we will also need to check the distance between the current agent and the target to see if

it's less than the attack range.

And if it is, then it is in the minimum range and this will be used for firing purposes.

On update.

Also the tank direct position animation happens and basically what this means is we set up the position

based on the tank third position, which is a position three D on the tank body and we need to move

on the forward axis using the turret and even forward, which is basically a float value from 0 to 1

that is animated real time when a projectile gets shot.

And also on update, if we are currently searching for the target and the tank mover has finished its

path, we don't need to wait.

We need to move the tank around to see if we can find the target.

So for this, we will generate two values that we can add to the current tank position so that the tank

can move to nearby locations and see if it finds the target.

Of course, if no target is found, then eventually the target is permanently lost.

Now we are entering the fire function and in here we of course need to instantiate the projectile.

We will also play the animation.

So first we reset the animation and then we play the turret fire.

And there are two types of attacks.

The regular one is just firing projectile and then entering the cooldown or reload.

And the second one, we will fire multiple projectiles in a burst.

And then after the maximum burst projectiles was reached, then we enter reload.

If not, we start the burst.

The burst is basically just the smaller reload, so it looks the same.

But instead of having a longer wait times.

So we fire a series of four projectiles one by one, and then have a longer time to reload all of them.

And then we fire more the busted just for the defensive tank, because the third there has more locations

that get far.

Projectiles from the reload and the burst functionalities are very straightforward.

So first we need to set is reloading to true and in the case of burst this burst cooling down through

then we start either the reload timer or the burst timer cooldowns and both of them actually are randomized

between different ranges.

This will give slightly different variations of the cooldowns to make it look more realistic.

And lastly, we set the final state machine to is reloading or is burst cooling down.

This will make sure that the final state machine is in the correct state in the instantiate projectile,

which is called here in the fire.

We need to create the new projectile and we will use the new instance of the projectile prefab which

is seen in Godot.

And we will add this to the root of the scene.

The next step is, of course, to get the fire point and the tank can have one or more fire points depending

on its structure.

This code will cycle through multiple target points.

In the case it's only one.

Then it will just give the same one over and over again, if not to give the next one and then the next

one.

And then it'll go back again to the zero.

We also initialize the visual effects, the smoke and the muzzle for each projectile shot.

And lastly, we will initialize the projectile.

And this is the interesting part because we have three projectiles and each behaves completely different

from the previous one.

And some might need some parameters, others might need different ones.

I opted to include all the parameters for every single projectile, and this is because by doing this,

even though some projectiles once initialized will receive parameters that they don't use, we can use

one initialized line and then we can shop the projectiles here to whatever we need.

And we don't need to have three different initialize sequences like this.

One, two, three, of course, with ifs between and check the projectile type because all of them share

the same header.

So this is quite cool and this is very maintainable for a project.

And this part of the script handles a lot of callbacks from various systems and timers.

So for example, unfinished moving is actually called by the tank mover and it will start the.

Overweight timer.

If that's the case and if it's the tactical enemy type, then we'll set the should adjust position to

false.

On projectile miss is actually called by the projectile and this is most used for the tactical thank

you to adjust its position and this one needs to know if the current hit object was actually the terrain

and not the building.

Because if it's the terrain, then we won't continue because it's not actually a miss.

We only go through here if the object was a building or another object that was between the enemy and

the tank, we will start increasing the miscount because if we reach the maximum miscount, then we

will set the final state machine to adjust the position.

We will also use the cover miscount.

So this next step is that we, even if we try to adjust the position locally in the same cover for,

let's say three times, if the cover is still bad, then we need to change the cover entirely so we

count, discover, miscount.

And if this one gets reached, then of course we set it to zero because we need to make sure that it

works again and again.

But we will stop the should adjust position and we will call is cover bed and this will actually trigger

a change of cover to hopefully a better one that can actually reach the player on finished.

Reloading is actually going to set the easy loading to false and then depending of the enemy type,

it will either do the reloading for the aggressive and the tactical air, but for the defensive it will

trigger the attack hide because after each single reload the defensive I will go into hiding unburnt

cooldown finished.

We need to set the burst cooldown parameter to false and then we need to inform the final state machine

by setting the parameter as well as to the correct one on go to target.

Finished is basically called by the timer when we already have some wait time and the current new target

and we need to stop that wait time on its target search over is called when the timer for the target

search has time out to zero.

And lastly on the cover timeout is called when the cover timer gets zero and we need to call the trigger

for the final state machine.

Also, we need to set the target handler to enable lose target again.

No, let's check each individual state machine based on the tank and they'll start with the aggressive

one in here.

It might look like it's a mess, but it's actually a calculated miss.

One entry happens when we actually acquire the target and on this branch should retreat is false because

we don't want the enemy to retreat.

The go to functionality will generate a path towards the target and we'll try to move the rider.

And if the target is in range, then we will trigger the attack fire and after the attack fire if everything

is fine.

So this means that it still has the target, it shouldn't retreat, then it will go to attack cooldown.

Of course the parameters here need to be that it is reloading.

The target is still in range and it's not retreating and once the cooldown finishes it will set.

The parameter is rolling to false and it will enter the fire state again.

And basically, if it is in range, these two states will bounce back and forth until the enemy kills

the player.

In the case that the target is not in the firing range anymore and this is false, it'll go to wait

and it will wait some time and then it will trigger go to the target at some point.

This or this might actually go to the target, but might lose the target.

And in this case, the target will be false.

And in this state attack, such target will enter.

And here the I will go to the last known position of the target and then it will randomly search around

to see if a target was found.

If the target is found, then this will be true and it will go back to go to if it's needed.

And if the target is a range, it will go directly to the fire.

And if such target state finishes with no target in sight, then the search is over and we exit this

state probably heading over to patrol state.

And this is the final state machine for the aggressive AI.

Now let's look at the defensive one.

So the defensive valley has a similar state machine because it still enters, it still goes to the target.

If the target in range, it starts to fire.

But the fire sequence first will bounce between fire and the burst cooldown.

This will happen for as many projectiles we can launch per session, and once the session is over,

we will go into the cooldown.

The cooldown is finished.

Instead of going directly back to fire, we will go into hiding.

So this means it will pick a cover point and to try to go there once a certain time passes, we will

end the hiding and go to the target again.

And once the target is orange, go to fire, then the burst cooldown, then fire again.

Cooldown I go to and it will go to this loop until eventually the target that might be lost or might

be in search target mode.

So this is the defensive enemy.

And lastly, we have the tactical enemy and this one has the most different state machine because once

it enters, it will actually go into hiding and hiding.

In this case, it will pick a cover point that is relatively far away from the player.

And after it's safe, then it will trigger.

The fire in firing mode, of course, will go to cooldown.

And once the cooldown is finished, the fire mode can also detect that the projectiles haven't hit the

player for a while.

So this means that we might have a building that might actually interfere between our shots.

And in this case, the adjust position is called.

The adjust position basically creates for the vector between the enemy and the player and then moves

in the opposite direction so that it'll give the enemy a bigger clearance from the building.

If after a couple of adjustments of the position, the fire still hits the building, then it will try

to change the cover.

So it will go through this cover battle and then it'll stop location.

This means that the cover will be swapped for hopefully a better one.

And here it doesn't happen.

Anything just is just a small transition state because the cover still gives the same functionality

from attack height and then it'll go back to fire and go to cooldown and then check if the position

is to be adjusted or not and do this back and forth.

Once the target is lost, we will enter the search target state, which is similar to the other two

enemy types.

And if the target was found, of course we need to go back to cover and then start the fire sequence.

But if the target was not found, then we will head over to exit and probably go to the patrol state.

We shouldn't worry about the tactical UI because this one has a huge range, so most likely it will

get the target back again.

Also, one difference from the other two eyes is that this doesn't require the direct line of sight.

It would be much more likely to find the player than the other two.

And basically these are all the state machines for the three enemy types.

I hope you like them.

Let me know in the comments section down below.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.