Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,030 --> 00:00:02,220
Let's look now at the cover system.
2
00:00:02,430 --> 00:00:09,150
This is the system that checks the available cover positions for the current year agent and if it returns
3
00:00:09,150 --> 00:00:09,720
a good one.
4
00:00:09,780 --> 00:00:12,330
The cover system is made out of two parts.
5
00:00:12,360 --> 00:00:17,850
The cover system script, which is found in every instance, and the building script which is found
6
00:00:17,850 --> 00:00:21,190
in every building instance, starting with the cover handler.
7
00:00:21,210 --> 00:00:24,540
The main functionality here is get retreat point.
8
00:00:24,630 --> 00:00:30,150
It can also receive a parameter of a cover that we want to exclude from our search.
9
00:00:30,210 --> 00:00:33,330
Firstly, we need to go through the list of buildings.
10
00:00:33,480 --> 00:00:39,870
To do this, we actually need to get the buildings and they're nicely placed in a good group called
11
00:00:40,020 --> 00:00:40,650
Buildings.
12
00:00:40,680 --> 00:00:46,830
And of course, we do require a target because if you don't have a target, then we don't have a relative
13
00:00:46,830 --> 00:00:49,560
position that we can check to get the cover from next.
14
00:00:49,560 --> 00:00:51,560
We need to set up our strategy.
15
00:00:51,570 --> 00:00:53,010
And there are two strategies.
16
00:00:53,010 --> 00:00:59,400
The first one is get the closest available cover and the second one is get the furthest in case of the
17
00:00:59,400 --> 00:00:59,880
tactical.
18
00:00:59,880 --> 00:01:04,010
Thank you, which needs to take a lot of space between it and the player.
19
00:01:04,020 --> 00:01:09,960
And based on this, the cover distance is either nine and nine or zero, and this will be used to compare
20
00:01:09,960 --> 00:01:13,710
it with the first pick to make sure that the first pick always gets used.
21
00:01:13,860 --> 00:01:19,980
Next, we need to iterate through every single building and then we query that building to get the best
22
00:01:19,980 --> 00:01:20,400
cover.
23
00:01:20,400 --> 00:01:26,490
And of course we need to provide the players position to get the cover from the player and we also compute
24
00:01:26,490 --> 00:01:32,610
the distance from the current enemy to that position because based on that distance, we will adjust
25
00:01:32,610 --> 00:01:33,450
our strategy.
26
00:01:33,450 --> 00:01:37,890
If no cover was found or the cover was excluded, then we will skip it.
27
00:01:37,890 --> 00:01:44,430
If the cover was already used, we will skip it as well because we don't want to use the same cover
28
00:01:44,430 --> 00:01:46,200
multiple times in a sequence.
29
00:01:46,230 --> 00:01:52,110
Next, we actually get the cover based on the strategy and if it's the closest, then this means that
30
00:01:52,110 --> 00:01:57,060
the distance between the enemy and the cover needs to be smaller than the font cover distance.
31
00:01:57,060 --> 00:02:02,070
And from the step above, we actually set this to a high number, so we make sure that the first position
32
00:02:02,070 --> 00:02:03,150
is always received.
33
00:02:03,150 --> 00:02:08,160
And then we set up the font cover and we update the cover distance with this the same thing, but in
34
00:02:08,160 --> 00:02:14,010
reverse, help us to the furthest with one specification that we also need to make sure that the distance
35
00:02:14,010 --> 00:02:20,820
is smaller than the detection range because otherwise we will enter the search target state instead
36
00:02:20,820 --> 00:02:22,520
of actually shooting the player.
37
00:02:22,530 --> 00:02:28,500
After all of this passing of the buildings and covers, if we have found a cover then we need to initialize
38
00:02:28,500 --> 00:02:30,090
less detected cover with it.
39
00:02:30,090 --> 00:02:32,830
We also added to a list of used covers.
40
00:02:32,850 --> 00:02:36,300
This will prevent using the cover multiple times in a sequence.
41
00:02:36,390 --> 00:02:36,630
Then.
42
00:02:36,630 --> 00:02:39,030
Then we complete opposition from the cover position.
43
00:02:39,030 --> 00:02:44,850
We offset it a little on the x and z axis just to give it a more dynamic engagement.
44
00:02:44,850 --> 00:02:50,580
Instead of the eye going to the same place twice for the same cover, the add cover to last used function
45
00:02:50,760 --> 00:02:57,180
basically adds this cover to a list of used covers and based on the max number of used covers, we will
46
00:02:57,180 --> 00:02:58,380
remove the first one.
47
00:02:58,380 --> 00:03:02,610
So we will keep cycling in and out all our covers and your cover.
48
00:03:02,620 --> 00:03:06,840
So in this way we make sure that we can use older covers but not newer ones.
49
00:03:06,990 --> 00:03:10,020
And this list is actually specified here.
50
00:03:10,020 --> 00:03:15,630
So this is the list of just covers and we can specify the number of maximum used covers to seven.
51
00:03:15,630 --> 00:03:19,260
So we need to use seven covers before we can use the first one.
52
00:03:19,680 --> 00:03:22,680
Of course, you can change this value to make it as you like.
53
00:03:22,710 --> 00:03:27,060
Let's now look at the building and see how an actual cover is chosen.
54
00:03:27,060 --> 00:03:33,540
So going inside the building and checking its 3D shape, we find out we have this cover element that
55
00:03:33,540 --> 00:03:37,320
contains four covers because I just picked the four sides of the building.
56
00:03:37,320 --> 00:03:41,730
So we have cover one, two, three and four, and those are rigid bodies because we need to check the
57
00:03:41,730 --> 00:03:45,420
collisions against them and they have a collision shape, which is a box shape.
58
00:03:45,420 --> 00:03:52,590
We also have the cover and this we will actually get moved to the player's position and it will be adjusted
59
00:03:52,590 --> 00:03:59,160
so that it will go through one or a different cover to make sure that it's visible or not from the player's
60
00:03:59,160 --> 00:03:59,820
point of view.
61
00:03:59,850 --> 00:04:01,410
Let's look now at the code.
62
00:04:01,410 --> 00:04:03,810
First we get the list of all the cover points.
63
00:04:03,810 --> 00:04:06,990
So basically get the note cover and get all the children.
64
00:04:07,140 --> 00:04:12,960
We also need to disable the collision shape of this and we will only enable it once we are checking
65
00:04:12,960 --> 00:04:14,910
that particular cover position.
66
00:04:14,910 --> 00:04:19,410
If it's good or not, the main functionality here is get the best cover.
67
00:04:19,410 --> 00:04:24,000
So first we will use this variable font cover and we will set that to now this should be filled with
68
00:04:24,000 --> 00:04:26,850
either a good cover or will continue with no.
69
00:04:26,940 --> 00:04:31,470
Next, the covering needs to change position and it will be changed to the player's current position.
70
00:04:31,500 --> 00:04:34,230
Next, we iterate through every single cover.
71
00:04:34,230 --> 00:04:37,140
Then we of course need to enable the condition shape.
72
00:04:37,140 --> 00:04:39,370
It's kind of redundant because it's disabled false.
73
00:04:39,370 --> 00:04:40,440
So basically it's enabled.
74
00:04:40,500 --> 00:04:47,610
Then we make the cover a look at the new cover position and also we force a request update to make sure
75
00:04:47,610 --> 00:04:49,830
that discovery works properly.
76
00:04:49,830 --> 00:04:55,800
What this does is basically checks if there is colliding and if it is colliding the cover, then this
77
00:04:55,800 --> 00:04:57,060
means that the cover is bad.
78
00:04:57,060 --> 00:04:59,550
But if it's not colliding to cover like in this.
79
00:05:00,030 --> 00:05:03,590
That it's probably colliding an obstacle like, let's say, a building.
80
00:05:03,600 --> 00:05:05,430
So this means that the cover is valid.
81
00:05:05,430 --> 00:05:10,650
And once we find the valid cover, we initialize the found cover of it and we break the execution of
82
00:05:10,650 --> 00:05:11,370
this for loop.
83
00:05:11,460 --> 00:05:16,630
Lastly, we return the font cover so that it can be used by the cover system in the enemy.
84
00:05:17,040 --> 00:05:19,230
Basically, this is how the cover system works.
85
00:05:19,260 --> 00:05:24,960
Of course it will be used by the retreat functionality and by the attack functionality in the case of
86
00:05:24,960 --> 00:05:25,830
the defensive tank.
87
00:05:26,190 --> 00:05:29,340
Let me know what you think about this system in the comments down below.
88
00:05:29,430 --> 00:05:30,510
Assuming the next one.
9092
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.