background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "Я сделал ИИ для Aim Lab и она его уничтожила :3"

input logo icon
Cover of audio
Please wait. We're preparing links for easy ad-free video watching and downloading.
console placeholder icon
Table of contents
|

Table of contents

0:00
Идея
0:25
Что такое Aim Lab и зачем бот?
0:55
Начинаем писать код (захват экрана)
1:35
Первая задача (определение целей)
1:55
Варианты решения задачи
2:29
Цветовые маски
2:55
Совет про скейлинг HSV
3:30
Проверяем код (маску)
4:03
NMS и объединение по пересечениям
4:32
Мой рекорд в аим лабе
4:50
Вторая задача
5:20
Как работает мышь на уровне ОС и в играх
6:42
Как играет смещает прицел
7:10
Проблема перемещения мыши
7:48
Разбор проблемы
8:37
Следим за руками (считаем углы)
10:25
Про машинное обучение
12:27
Конвертируем координаты из 2D в 3D (пытаемся)
13:35
ПАМАГИТЕ
13:57
Костыли наше всё!
14:49
Первый боевой тест
15:28
Второй боевой тест
15:57
Итоги
Video tags
|

Video tags

aim lab
аим лаб
кс
source
сурс
чувствительность
sensitivity
cs go
кс го
king dm
fispect
кинг дм
нейросеть
ии
я сделал ии
я сделал игру
opencv
компьютерное зрение
computer vision
боты
браузер
counter strike
python
нейроэволюция
фид форвард
сделал игру
unity
web gl
кс:го
ксго
s1imple
симпл
navi
хауди
хо
хауди хо
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:02
told myself that if I don’t make a Bot
00:00:05
that will be at least in the top 10 And they have
00:00:08
a lab, then I won’t upload the video to the
00:00:10
channel, and since you can watch it now, I
00:00:13
must assume I have something
00:00:15
all- it turned out like this Today I
00:00:18
will tell you how I made one of the
00:00:20
most complex and coolest bots for aim
00:00:23
in just a few days. Well, if
00:00:25
someone suddenly doesn’t know what A im paw is,
00:00:28
then this is such a very popular game,
00:00:30
especially among e-sportsmen who
00:00:33
can train and improve your
00:00:35
aiming skill or aiming in the game
00:00:38
Well, the reason why I decided to make a
00:00:40
Bot is essentially only one. It’s stupidly fun,
00:00:43
interesting, and one more thing. To be honest, I
00:00:46
wanted to get into the top 10, and since there are still
00:00:49
four situations there,
00:00:51
it’s worse for me I definitely won’t do
00:00:55
this. To begin with, as usual, I wrote the
00:00:59
simplest code for capturing screenshots from the
00:01:01
screen. Because my bot will
00:01:03
use one of the areas of
00:01:05
artificial intelligence for its
00:01:07
work, namely computer vision, it’s
00:01:10
kind of like human vision, only it’s
00:01:13
computer vision, that is, in fact, the bot will be
00:01:16
see the same thing as a person and
00:01:18
somehow the readers will write the
00:01:20
game process into memory, we won’t have it at all; we
00:01:23
’ll only have a picture from the game on our hands. Well,
00:01:26
as you can see, capturing from the start produces
00:01:28
approximately 50 FPS at Full HD resolution and
00:01:32
this is very cool However, we are
00:01:35
not processing this image in any way yet and
00:01:37
perhaps the first task that we
00:01:40
now face is to somehow determine the
00:01:42
position of the goals in the picture, while as
00:01:45
you see our goals - these are blue balls,
00:01:47
their color does not change in any way during the game,
00:01:50
which of course makes the task much easier for us,
00:01:52
so
00:01:54
why not do it personally?
00:01:57
Three different options immediately come to mind: we
00:02:00
could use the
00:02:01
After hotkey program and its imatech method,
00:02:04
which allows you to find a given picture on the screen; you
00:02:05
can also create your
00:02:08
own hard ask for the
00:02:10
Open CV computer vision library and also,
00:02:13
in principle, no one is stopping you from
00:02:15
training an entire neural network to
00:02:17
detect objects, in this case
00:02:19
blue balls, however, I successfully sent all three options
00:02:22
to the landfill Since I had already
00:02:24
decided in advance to use a more
00:02:26
adequate approach, namely color
00:02:29
masks. Well, the essence of this method is
00:02:31
that what we First,
00:02:33
we convert the image into the
00:02:35
hsl color space and then determine the
00:02:38
lower and upper boundaries of the color mask
00:02:40
in order to ultimately exclude all colors from the image
00:02:43
except those that fall into our
00:02:46
color mask and And you don’t have to
00:02:48
worry. If you don’t understand anything, I didn’t
00:02:51
understand anything either However, this garbage
00:02:53
works and the only thing that is enough for us is I
00:02:57
want to say that you, like me, need to
00:02:59
be more careful and take into account that the
00:03:01
skelling of the hss in different programs can be
00:03:03
different, for example in Photoshop or Color
00:03:06
pickery, the conditional blue color will be equal to
00:03:08
180 While in the Open CV library
00:03:12
that The Color will be in the value
00:03:14
90 That is why, to determine these
00:03:17
very color boundaries, I used a
00:03:20
small cheat sheet with the designation of
00:03:22
colors in the xss space, respectively, the
00:03:24
blue color of the balls we need is
00:03:27
approximately 90 So if we
00:03:30
run the code now, we will get the following result
00:03:33
As you can see from the picture were
00:03:35
Absolutely all colors except those defined in
00:03:38
our mask are excluded and thanks to this we now
00:03:41
see only balls, which means we can already
00:03:44
draw boxes for detected targets in the
00:03:46
game. It now looks like this,
00:03:48
but this method has one
00:03:52
big drawback, and this is
00:03:54
the amount of garbage or incorrect
00:03:56
definitions for example, here for some reason a
00:03:59
small square was detected inside
00:04:01
another one. Although this should not be the case. In order
00:04:03
to fix this, we
00:04:06
need to somehow filter the detected
00:04:08
boxes. And for this, I personally used
00:04:11
two simple algorithms, the first is nms
00:04:14
or but the maximum is interrogated. And the second is a
00:04:17
union by intersection together This
00:04:20
gave results and now there are
00:04:23
practically no incorrect definitions, which
00:04:25
means that we now have in our hands the
00:04:27
coordinates of the targets in the picture, this is already
00:04:30
something. By the way, when I myself try to
00:04:32
score as many points as possible in Wimlab,
00:04:35
I get a maximum of 60 or 70,000
00:04:39
if any of you played on this map,
00:04:41
then write in the comments How many points
00:04:44
did you manage to score? I think everyone in
00:04:46
the comments will be interested to know,
00:04:49
well, we continue And the next Step in our
00:04:52
reliable, like a Swiss watch in this
00:04:55
regard, is to move the sight in the game
00:04:57
so that it automatically I was aiming at
00:04:59
the balls and I just said
00:05:02
the word sight and not the cursor for a reason. Although it
00:05:06
would seem that there is no difference at all, but
00:05:08
it turns out there is a difference and it is very
00:05:11
big, and this difference is
00:05:13
so big that moving the sight
00:05:16
in the game to the desired target just won’t
00:05:18
work. will always miss
00:05:20
and I will now explain why, look at the
00:05:24
operating system level, the mouse
00:05:26
works in two modes of movement,
00:05:29
namely absolute and relative;
00:05:31
besides, for the operating system there is no such thing
00:05:34
as a pixel; instead,
00:05:36
conventional units called T-shirts and
00:05:40
T-shirts are used, this is a unit that determines the
00:05:42
minimum detectable shift mice, as a
00:05:45
rule, the T-shirt is equal to 1/10 mm, which in
00:05:48
practice moves the mouse cursor by 2
00:05:50
pixels for each unit of this same
00:05:52
T-shirt. Next, you need to understand such a thing that
00:05:56
in games, in order for the sight
00:05:58
to move freely 360 degrees And
00:06:01
this would not move the mouse cursor beyond borders of the
00:06:04
game window, as a rule, two
00:06:07
approaches are used, the first approach involves
00:06:09
constant teleportation of the mouse cursor from
00:06:12
one edge of the screen to the other. When the mouse
00:06:15
approaches it, the second one works even
00:06:17
more rigidly and simply blocks the
00:06:20
mouse cursor at one point. And between frames it
00:06:23
simply detects the cursor displacement for
00:06:25
detection. Well, It is also necessary
00:06:28
to understand that the world in the game is a 3D
00:06:31
space, if on your desktop you
00:06:33
only have two axes, these are X and Y. Who in the game
00:06:36
already has three of them because the game is like a three-dimensional one,
00:06:39
it goes without saying x y z and this is how to
00:06:43
shift the aim in the game game
00:06:46
the engine converts mouse movement into so-
00:06:48
called angles, and not to mention the fact that the
00:06:51
player’s field of view itself is in three-dimensional
00:06:53
space, but how is it limited by these
00:06:56
same angles, which are also called
00:06:58
fullv or fieldofue or viewing angle
00:07:01
Well, why am I actually doing this? I’m
00:07:04
explaining everything now. the point is that if we
00:07:08
found a ball in the picture at
00:07:10
certain coordinates, then we can’t
00:07:12
just move the cursor along these
00:07:14
coordinates and expect the sight in the game
00:07:17
to target this ball.
00:07:19
And it doesn’t work like that, and that’s all because
00:07:22
Aim paws like almost everything other
00:07:25
games Shooters use the second approach to
00:07:28
detect mouse movement, that is, the game
00:07:30
simply blocks the cursor at one point and
00:07:33
it does not move from there. Or, to
00:07:36
put it in simpler words, they don’t even
00:07:39
care what you are there or where you
00:07:40
move it, it completely ignores the
00:07:43
absolute movement of the mouse at all
00:07:46
[ __ ] it
00:07:48
and probably the only game I
00:07:51
know in which the absolute placement method works is
00:07:55
counter-strike Global Offensive Although I
00:07:57
must admit I’m very surprised Why
00:07:59
Valve still hasn’t closed this shop
00:08:02
here the Source game engine reads the
00:08:05
absolute movement of the mouse and
00:08:07
converts it into angles for you turning the
00:08:09
sight in the game However, we are not in
00:08:12
cs:go now and therefore such blessings of humanity
00:08:14
as absolute movement of the mouse are
00:08:17
not available to us. This means that we can
00:08:19
only move the mouse relatively and
00:08:22
at the same time we still need to figure out how to
00:08:24
convert the mouse coordinates from 2D
00:08:27
space into the angles of rotation of the sight in
00:08:29
3D space and it seems like the task
00:08:32
sounds easy But in reality it’s not so
00:08:36
simple but Let’s start with the
00:08:38
simplest thing, let’s determine the angles and the actual
00:08:41
value of the pixels based on 360
00:08:43
degrees. Later for this I went into the
00:08:46
game settings and looked at what is currently
00:08:48
installed, then I went and registered
00:08:51
We will need it in the code for
00:08:53
calculations.
00:08:54
We also need to go into the game and define a
00:08:57
certain focus point here, and at
00:09:00
this moment carefully watch your
00:09:02
hands. We know that the game resolution is
00:09:05
now 1920 by 1080 pixels, with
00:09:08
horizontal off V equaling 106 26 A
00:09:11
vertical 7374 This means the rotation angle
00:09:15
from the focus point to the screen border
00:09:17
is 106.26 / 2 or
00:09:21
53.13°. Now through the code we move the mouse with
00:09:24
different values ​​until the
00:09:26
crosshair hits the screen border from the focus point
00:09:28
and this value I
00:09:31
got equal to 2.420 pixels, in other
00:09:34
words we need to move the cursor in
00:09:36
relative mode by 2420 pixels
00:09:39
to get a shift of the game sights by 53
00:09:42
and 13 °. This means we can now simply
00:09:45
divide
00:09:47
2.420/53 13 and get a value of
00:09:50
45.54 pixels which will be the
00:09:53
value of pixels per 1 degree if we
00:09:56
multiply it by 360 we get
00:10:00
16400 or the required movement in
00:10:03
pixels to shift the sight a full
00:10:05
360 degrees and we can it’s even very
00:10:09
easy to check this if we write a
00:10:11
shift of 180 degrees in the code and in the game. As
00:10:14
you can see, the sight will also shift
00:10:16
each time exactly 180 degrees
00:10:19
horizontally, which means that our
00:10:22
calculations turned out to be correct and we solved the
00:10:24
first half of the problem. In general, this is a
00:10:27
very cool solution You encounter such problems in code
00:10:29
especially often
00:10:31
in machine learning. And by the way, if
00:10:35
you like the field of machine learning and
00:10:37
want to develop in this direction,
00:10:39
then pay attention to the profession of a data
00:10:42
scientist; in short, this is someone who builds
00:10:44
mathematical models and algorithms that
00:10:46
simplify solutions to problems for business and
00:10:49
users, at the same time, learning machines are
00:10:51
actively used and in games, take for
00:10:54
example even our current implementation
00:10:56
of aimbota for the imlab game, here we used
00:10:59
computer vision, which is one of the
00:11:02
many branches of machine learning,
00:11:04
so to become a specialist you
00:11:07
need not just to study, but also
00:11:09
to practice a lot and in The
00:11:11
online service of digital professions Yandex
00:11:13
workshop will help you with this and they give you the opportunity to take the
00:11:16
water part of the course for free, while
00:11:19
Yandex workshop has three courses
00:11:21
Data Sansa and all of them are for beginners
00:11:24
Data Science specialist - this is a basic
00:11:26
course where you have everything to master a new
00:11:29
profession here you will Learn the basic
00:11:30
concepts of data analysis Detoscience specialist
00:11:34
plus for those who want to
00:11:36
dive deeper into the machine and training and
00:11:39
data analysis and data science Booth camp - This is a
00:11:42
program for those who want to
00:11:44
quickly master the profession And depending
00:11:46
on the chosen program you will complete From
00:11:49
16 to 25 educational projects and two real
00:11:53
projects from the order of subscribers and in the end
00:11:55
you will have a portfolio for
00:11:57
employment; training allows you to
00:12:00
become a Junior Data Science specialist from scratch;
00:12:02
master pyton data analysis and
00:12:05
machine learning; at the same time, already at the start of your
00:12:07
career, salaries start from 60 thousand and
00:12:10
increase with experience, follow the
00:12:13
link under the video or scan the QR code from the
00:12:15
screen and start learning for free. And
00:12:18
using the promotional code hauti, Yandex workshop has
00:12:20
prepared for you a five
00:12:22
percent discount on the full course until December 24.
00:12:26
Okay, then we need to somehow,
00:12:30
as I already said, convert those same
00:12:33
coordinates of detected targets from 2D
00:12:35
space to rotation angles in 3D
00:12:38
space, and to be honest, I have no
00:12:41
idea how to do this,
00:12:51
this is transferring values ​​through percentages. That
00:12:55
is, for example, if the conditional shift of
00:12:57
detection by X is 10 out of 100,
00:12:59
then it is 10 percent and since we
00:13:02
it is known that half the screen is 53 and 13
00:13:05
degrees. Then it’s enough just to get
00:13:07
10 percent of this value and we
00:13:10
’ll get the value of the same shift
00:13:12
but in degrees. Unfortunately, this
00:13:16
sounds beautiful only in theory; in practice,
00:13:18
the sight often goes past the target, although not
00:13:21
very much the second thing I came up with was to
00:13:23
actually make a table for
00:13:25
converting one coordinate grid
00:13:27
to another. But firstly, I was too lazy to
00:13:30
program it. And secondly, it’s still a
00:13:32
crutch, although it’s quite interesting, and I’ll
00:13:34
honestly tell you, hand on heart,
00:13:38
I tried to google it, and even more than
00:13:41
one day, but I couldn’t find at
00:13:43
least some useful
00:13:45
information on how to do this. Therefore,
00:13:48
if any of you are rummaging around or have
00:13:51
ideas, welcome to the comments
00:13:54
enlarged, I don’t know how to solve this yet
00:13:57
problem Well, since I need at least a
00:13:59
slightly working solution, I settled on the
00:14:02
first option, adding a crutch to it in the
00:14:05
form of a correction table so that at
00:14:07
different angles of rotation the sight would not recoil
00:14:10
so much And although this, frankly speaking,
00:14:12
looks funny in the game, the aiming
00:14:15
finally worked and the sight it is almost
00:14:18
always correctly aimed at the target and for
00:14:21
convenience, I also added in the code
00:14:23
the display of red dots, that is, the places
00:14:25
where the bot is trying to aim, and ran
00:14:28
the very first test. As you can see,
00:14:30
aiming, in principle, works well
00:14:32
and the bot shows good results.
00:14:34
However, it sometimes misses and this
00:14:38
is read out in the game as a decrease in points,
00:14:40
so I quickly added in the process of
00:14:42
detecting color under the sight and if
00:14:45
the sight was suddenly updated incorrectly, then
00:14:48
shooting does not happen Well, then I
00:14:51
finally launched the very first combat of
00:14:54
our Bot and As you can
00:14:56
see for yourself, it copes very
00:14:59
well on the first try in 60 seconds the bot
00:15:02
managed to score as many as 138 thousand points and
00:15:06
immediately take 22nd place in the ranking, but as
00:15:09
you remember, my goal is the top 10 and
00:15:12
if I don’t make a Bot that can
00:15:14
take the top 10, then I won’t release the video,
00:15:17
so I’ll continue and made
00:15:19
several improvements to the code, the most important
00:15:22
of which is the detection of the nearest
00:15:24
target, so it will be easier and faster
00:15:26
to aim, and finally, the final
00:15:30
combat test of the Bot looks like this
00:15:33
from here By the way, we can also
00:15:35
conclude that a person is simply not capable of
00:15:38
scoring more than 100,000 points, and ginger at
00:15:40
least on this map And this
00:15:43
means only one thing: the leaderboard in the top is
00:15:45
full of bots and cheaters, and my bot,
00:15:49
although still very crude, was able to score
00:15:51
143,000 points and take the Top 10 on
00:15:55
this Wimlap map. It should be
00:15:58
understood that this is not a bot in in the classical
00:16:00
sense, since our code does not read or
00:16:03
write the processor in the game memory, and all
00:16:06
that it has on hand is just a
00:16:08
picture from the game, and all that we use
00:16:11
to operate the Bot is computer vision,
00:16:14
which is one of the bus
00:16:16
learning farms and is also widely used in
00:16:19
artificial intelligence about and I haven’t
00:16:22
forgotten yet if anything I’ll leave the source code for this
00:16:24
lesson in the description under the video,
00:16:27
maybe someone will be interested in how you
00:16:29
poke it or maybe even improve it,
00:16:32
otherwise I’m waiting for your royal likes
00:16:35
of course subscribe to the channel and
00:16:37
turn on the notification bell and
00:16:39
also write comments, at least
00:16:42
because I read everything. And it also helps a lot to
00:16:44
promote the video on YouTube. In short, you
00:16:47
understand good luck and always remember the more
00:16:49
difficult the task, the more experience it
00:16:52
will bring you
00:16:54
[music]

Description:

Делаем ИИ бота для игры Aim Lab. Компьютерное зрение в деле :3 https://practicum.yandex.ru/data-scientist/ — выберете для себя подходящую программу курса «Специалист по Data Science» в Яндекс Практикум. Промокод "ХАУДИ" на скидку 5% до 24 декабря 2022 года. 🆇 Исходный код бота 🆇 https://github.com/Priler/aimlabbot 🆇 Главы 🆇 0:00 - Идея 0:25 - Что такое Aim Lab и зачем бот? 0:55 - Начинаем писать код (захват экрана) 1:35 - Первая задача (определение целей) 1:55 - Варианты решения задачи 2:29 - Цветовые маски 2:55 - Совет про скейлинг HSV 3:30 - Проверяем код (маску) 4:03 - NMS и объединение по пересечениям 4:32 - Мой рекорд в аим лабе 4:50 - Вторая задача 5:20 - Как работает мышь на уровне ОС и в играх 6:42 - Как играет смещает прицел 7:10 - Проблема перемещения мыши 7:48 - Разбор проблемы 8:37 - Следим за руками (считаем углы) 10:25 - Про машинное обучение 12:27 - Конвертируем координаты из 2D в 3D (пытаемся) 13:35 - ПАМАГИТЕ 13:57 - Костыли наше всё! 14:49 - Первый боевой тест 15:28 - Второй боевой тест 15:57 - Итоги 🔵 Наш TELEGRAM: https://t.me/howdyho_official Наш ВК: https://www.vk.com/howdyho_net Сотрудничество https://vk.com/topic-84392011_33285530 💗 Музыка предоставлена YouTube Audio Library.

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "Я сделал ИИ для Aim Lab и она его уничтожила :3" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "Я сделал ИИ для Aim Lab и она его уничтожила :3" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "Я сделал ИИ для Aim Lab и она его уничтожила :3" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "Я сделал ИИ для Aim Lab и она его уничтожила :3" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "Я сделал ИИ для Aim Lab и она его уничтожила :3"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "Я сделал ИИ для Aim Lab и она его уничтожила :3"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.