Настройка И.И. с более продвинутым поведением
Материал из CryWiki Russia
Eis (Обсуждение | вклад) |
DCamer (Обсуждение | вклад) |
||
Строка 1: | Строка 1: | ||
{{В процессе перевода|дата=7 Марта 2011|автор=1}} | {{В процессе перевода|дата=7 Марта 2011|автор=1}} | ||
- | |||
- | [[ | + | == Настройка И. И. с более продвинутым поведением == |
+ | |||
+ | [[Файл:Sandbox SimpleAI image001.jpg]] | ||
=== Введение === | === Введение === | ||
- | Это учебное пособие покажет | + | Это учебное пособие покажет вам, как разместить врагов на карте и указать им, куда они могут идти или где могут скрываться. По умолчанию они запрограммированы стрелять в игрока, как только он попадёт в зону их видимости. |
- | Типы характеров искусственного интеллекта , их взаимодействие с оружием, как далеко они могут видеть и слышать, | + | Типы характеров искусственного интеллекта, их взаимодействие с оружием, как далеко они могут видеть и слышать, продвинутое поведение, такое как групповая тактика, переговоры между ИИ, использование транспортных средств и взаимодействий с сложными объектами, описано в других обучающих программах и справочной библиотеке. |
- | ===Добавление | + | === Добавление противника на карту === |
- | + | ||
- | + | ==== Размещение ИИ на ваш уровень ==== | |
- | [[ | + | Для размещения ИИ в '''[[Панель инструментов Sandbox 2|RollupBar]]''' выберите '''Objects''' затем '''Entity''', в папке '''AI''' выберите '''Grunt''' и перетащите в окно перспективы. |
- | + | [[Файл:Sandbox_SimpleAI_image003.png]] | |
- | + | ||
- | [[ | + | ==== Снабжение ИИ оружием ==== |
+ | Для снабжения ИИ оружием нажмите кнопку '''…''' в поле '''EquipmentPack''' откроется диалоговое окно пакетов экипировки. Для получения дополнительной информации о настройке пакетов экипировки, прочтите учебное пособие по '''[[Настройка пакетов экипировки|Equipment Pack]]'''. | ||
- | + | [[Файл:Sandbox_SimpleAI_image005.png]] | |
- | + | Важно: Чтобы изменения вступили в силу нажмите кнопку '''Reload Script''' (расположена ниже свойств сущности) чтобы Grunt начал использовать выбранный пакет оружия. | |
- | + | [[Файл:Sandbox_SimpleAI_image007.png]] | |
- | + | ||
- | + | ==== Архетипы противников ==== | |
+ | Все ИИ-персонажи Crysis размещены как архетип-объекты, это означает, что настроить параметры нужно всего один раз, чтобы использовать на разных уровнях. Чтобы увидеть параметры, которые они используют, просто нажмите на окно '''Entity Archetype''' (в следующем скриншоте текст CAMPER/CAMP.Light_Rifle). | ||
- | + | [[Файл:Sandbox_SimpleAI_image009.png]] | |
- | + | ||
- | + | ==== Генерация навигации ИИ ==== | |
+ | Даже на равнинном ландшафте, убедитесь, что вы генерируете новую навигацию ИИ, хотя бы один раз после создания карты, а также после любых изменений на ландшафте. | ||
- | + | [[Файл:Sandbox_SimpleAI_image011.png]] | |
+ | Навигация ИИ может быть сгенерирована нажатием элемента '''Generate All Navigation''', из меню '''AI'''. | ||
+ | ==== Тестирование результатов ==== | ||
+ | Перейдите в режим игры ('''CTRL+G''') и подойдите к ИИ, если вы всё правильно настроили, то ИИ будет стрелять в игрока, когда он его увидит или услышит. | ||
- | + | [[Файл:Sandbox_SimpleAI_image013.jpg]] | |
- | + | ||
- | + | === Настройка навигации === | |
- | === | + | ==== Введение ==== |
- | + | Чтобы ваш ИИ работал правильно на вашем уровне, вы должны настроить различные типы навигации. | |
- | + | ||
- | + | Введение '''ai_DebugDraw=79''' в '''консоль''' покажет вам, настроена ли уже триангуляция, это означает, что ИИ сможет найти свой путь из одной точки в другую не натыкаясь на препятствия. | |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image015.png]] |
- | ==== | + | ==== Растительность ==== |
- | + | ИИ автоматически обходит объекты растительности, если всё настроено правильно. | |
If you want them to hide behind a tree, you just need to set the '''Hideable''' flag in the '''Vegetation''' properties. | If you want them to hide behind a tree, you just need to set the '''Hideable''' flag in the '''Vegetation''' properties. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image017.png]] |
Next, adjust the '''AIRadius''' of the '''Vegetation''' so the AI knows how big the Vegetation object is. | Next, adjust the '''AIRadius''' of the '''Vegetation''' so the AI knows how big the Vegetation object is. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image019.png]] |
AI will automatically walk around physicalized entities such as vehicles. | AI will automatically walk around physicalized entities such as vehicles. | ||
- | ==== | + | ==== Cliffs and big solid objects ==== |
- | Typing '''ai_debugdraw 85''' in the '''Console''' will display all areas that are too steep to climb (red) and areas that may cause sliding when you try to walk on them (green). | + | Typing '''ai_debugdraw 85''' in the '''Console''' will display all areas that are too steep to climb (red) and areas that may cause sliding when you try to walk on them (green). |
Now we need to surround all such areas carefully with ForbiddenAreas (see section below). | Now we need to surround all such areas carefully with ForbiddenAreas (see section below). | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image021.png]] |
- | ==== | + | ==== Forbidden areas ==== |
You need to surround each internal waypoint region with a [[Sandbox_ForbiddenArea|ForbiddenArea]], this way the AI will not try to walk through walls and other objects. | You need to surround each internal waypoint region with a [[Sandbox_ForbiddenArea|ForbiddenArea]], this way the AI will not try to walk through walls and other objects. | ||
Строка 81: | Строка 82: | ||
Click on '''AI/[[Sandbox_ForbiddenArea|ForbiddenArea]]''' and create a shape around the area you want to make impassable (for example the external walls of a building). Select '''[[Sandbox_ForbiddenArea|ForbiddenArea]]''' from the menu as shown below. | Click on '''AI/[[Sandbox_ForbiddenArea|ForbiddenArea]]''' and create a shape around the area you want to make impassable (for example the external walls of a building). Select '''[[Sandbox_ForbiddenArea|ForbiddenArea]]''' from the menu as shown below. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image023.png]] |
Once your [[Sandbox_ForbiddenArea|ForbiddenArea]] is created and your level triangulated, it will not be possible for the AI to walk through the walls. | Once your [[Sandbox_ForbiddenArea|ForbiddenArea]] is created and your level triangulated, it will not be possible for the AI to walk through the walls. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image025.png]] |
- | ==== | + | ==== Setting up waypoint regions in internal areas ==== |
To make the AI go through doors and navigate inside the building you need to add a Waypoint Region. You need to extend one section of this Waypoint Region outside of the forbidden area, as an entryway for the AI, as below. | To make the AI go through doors and navigate inside the building you need to add a Waypoint Region. You need to extend one section of this Waypoint Region outside of the forbidden area, as an entryway for the AI, as below. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image027.png]] |
The 3 things you need to setup a Waypoint Region are: | The 3 things you need to setup a Waypoint Region are: | ||
Строка 100: | Строка 101: | ||
* AIWaypoint Entry/Exit points | * AIWaypoint Entry/Exit points | ||
- | You need to surround each waypoint region with an AI Navigation Modifier | + | You need to surround each waypoint region with an AI Navigation Modifier «Human Waypoint». (The blue shape). |
Click on '''AI/[[Sandbox_AINavigationModifier|AINavigationModifier]]''' and create an area shape of that type. | Click on '''AI/[[Sandbox_AINavigationModifier|AINavigationModifier]]''' and create an area shape of that type. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image029.png]] |
- | By default the NavType is set to | + | By default the NavType is set to «Human Waypoint» so no need to modify anything. |
Place '''AI/AIpoints''' inside your area. You will see they turn blue once they are in a valid area. | Place '''AI/AIpoints''' inside your area. You will see they turn blue once they are in a valid area. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image031.png]] |
- | At the place where AI should be able to enter and exit the area change the type of the '''AIPoint''' to '''Entry/Exit''' (a door symbol will be displayed instead of the blue ball. | + | At the place where AI should be able to enter and exit the area change the type of the '''AIPoint''' to '''Entry/Exit''' (a door symbol will be displayed instead of the blue ball. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image033.png]] |
One part of the AINavigation modifier area should be outside the forbidden area shape (red line) so the AI can reach the point. | One part of the AINavigation modifier area should be outside the forbidden area shape (red line) so the AI can reach the point. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image035.png]] |
To generate the connection between all points select the '''[[Sandbox_AINavigationModifier|AINavigationModifier]]''' shape you placed and set '''Auto-Dynamic''' in the '''Waypoint Connection Parameters'''. | To generate the connection between all points select the '''[[Sandbox_AINavigationModifier|AINavigationModifier]]''' shape you placed and set '''Auto-Dynamic''' in the '''Waypoint Connection Parameters'''. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image037.png]] |
And finally click on one of the points and press the '''Regen Links''' Button: | And finally click on one of the points and press the '''Regen Links''' Button: | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image039.png]] |
All Points should now be connected like this and the AI will be able to navigate inside the area and enter/exit it at the points where you set the specific entry and exit points. | All Points should now be connected like this and the AI will be able to navigate inside the area and enter/exit it at the points where you set the specific entry and exit points. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image041.png]] |
See the section below on how ForbiddenAreas and Waypoints should be setup in terms of placement. | See the section below on how ForbiddenAreas and Waypoints should be setup in terms of placement. | ||
- | ==== | + | ==== Flight Navigation ==== |
- | You need to surround every area where you want something to fly with an AI Navigation Modifier shape called Flight. | + | You need to surround every area where you want something to fly with an AI Navigation Modifier shape called Flight. You also need to give this area a height.<br /> |
- | Water Navigation<br> | + | Water Navigation<br /> |
- | You need to surround every area where you want something to navigate on water (i.e. boats) with an AI Navigation Modifier shape called Water. | + | You need to surround every area where you want something to navigate on water (i.e. boats) with an AI Navigation Modifier shape called Water. |
- | ==== | + | ==== Paths and Roads ==== |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image043.png]] |
- | Create an '''AIPath''' with the '''Road''' box ticked, and vehicles will automatically have a strong preference to use the road/path. | + | Create an '''AIPath''' with the '''Road''' box ticked, and vehicles will automatically have a strong preference to use the road/path. AI can also be made to follow the path using the AIFollowPath flowgraph node |
- | ==== | + | ==== External Hide Points ==== |
To make AI hide at specific spots you have to place AIAnchor (outside of waypoint areas). | To make AI hide at specific spots you have to place AIAnchor (outside of waypoint areas). | ||
- | Place an '''AI/AIAnchor''' next to any solid object. Now, notice the two red bars in front of the hide point, which indicates if the AI can use a crouch/hide animation, or a left/right strafe animation. The red line on the front of a hide point shows that there is left an right enough space the strafe left and right. | + | Place an '''AI/AIAnchor''' next to any solid object. Now, notice the two red bars in front of the hide point, which indicates if the AI can use a crouch/hide animation, or a left/right strafe animation. The red line on the front of a hide point shows that there is left an right enough space the strafe left and right. Make sure the Green Area is not blocked by anything, so that the AI can actually use it. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image045.png]] |
- | ==== | + | ==== AIPoint Type Hide Points in Nav Areas ==== |
The same concept for AIAnchors applies to the AIPoint Hide Points. | The same concept for AIAnchors applies to the AIPoint Hide Points. | ||
So, change one waypoint within a nav area to a Hide Point, by changing the '''Type''' in the '''AIPoint Properties'''. | So, change one waypoint within a nav area to a Hide Point, by changing the '''Type''' in the '''AIPoint Properties'''. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image047.png]] |
+ | |||
+ | [[Файл:Sandbox_SimpleAI_image049.png]] | ||
- | |||
+ | === How to setup AI correctly – Advanced tips === | ||
- | === | + | ==== Forbidden Areas ==== |
- | + | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image051.png]] |
- | Here the forbidden area is placed too far away from the actual object. | + | Here the forbidden area is placed too far away from the actual object. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image053.jpg]] |
- | Instead place them closer the the edges of the objects. This avoids that the AI might slip in the gaps. Now the AI navigates way better around these objects. | + | Instead place them closer the the edges of the objects. This avoids that the AI might slip in the gaps. Now the AI navigates way better around these objects. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image055.jpg]] |
- | Do not place two forbidden areas so close to each other. Even if the AI can‘t fit through, the navigation will still trace a path in between. | + | Do not place two forbidden areas so close to each other. Even if the AI can‘t fit through, the navigation will still trace a path in between. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image057.jpg]] |
- | Instead delete one forbidden area. Make one big forbidden area which contains both objects. | + | Instead delete one forbidden area. Make one big forbidden area which contains both objects. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image059.jpg]] |
- | Do not place objects close on the edge of a forbidden area. Otherwise the AI circles around the hide objects and can slip in the forbidden area. | + | Do not place objects close on the edge of a forbidden area. Otherwise the AI circles around the hide objects and can slip in the forbidden area. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image061.jpg]] |
Place the hide objects either inside the forbidden area or outside of the forbidden area. Make sure that if the AI circles around the hide object it doesn‘t slip in the forbidden area | Place the hide objects either inside the forbidden area or outside of the forbidden area. Make sure that if the AI circles around the hide object it doesn‘t slip in the forbidden area | ||
- | Large open sided structures should not have one big forbidden area around them. | + | Large open sided structures should not have one big forbidden area around them. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image063.jpg]] |
Rather, place smaller forbidden areas around them. | Rather, place smaller forbidden areas around them. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image065.jpg]] |
- | ==== | + | ==== Hide Anchors ==== |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image067.png]] |
The AI hides at the hide anchor if an enemy is the cone. The more AI guys you have the more hide anchors you have to place. Do not place hide anchors for just one direction. Place them for all possible directions. | The AI hides at the hide anchor if an enemy is the cone. The more AI guys you have the more hide anchors you have to place. Do not place hide anchors for just one direction. Place them for all possible directions. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image069.jpg]] |
Place hide anchors at the sides of an object not only at the edges. Sides provide better cover than edges. | Place hide anchors at the sides of an object not only at the edges. Sides provide better cover than edges. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image071.jpg]] |
- | For thin objects place hide anchors close to the edges so the AI can leave their positions quickly. Do not forget to place them on both sides pointing at each other | + | For thin objects place hide anchors close to the edges so the AI can leave their positions quickly. Do not forget to place them on both sides pointing at each other |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image073.jpg]] |
- | Place hide anchors only at position where the AI has real cover. The front and the back of e.g. a car provide less cover. The middle provides better cover. | + | Place hide anchors only at position where the AI has real cover. The front and the back of e.g. a car provide less cover. The middle provides better cover. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image075.jpg]] |
- | Normaly edges of a house provide less cover. First place hide anchors close to the edge pointing directly in the direction. Then place hide anchors with 45� rotation slightly away from the edge. | + | Normaly edges of a house provide less cover. First place hide anchors close to the edge pointing directly in the direction. Then place hide anchors with 45� rotation slightly away from the edge. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image079.jpg]] |
- | If you do not have enough hide anchors for many AI guys you can increase the hide anchors. The basic hide anchors are most important. Then you can increase the number hide anchors with the 45� ones. | + | If you do not have enough hide anchors for many AI guys you can increase the hide anchors. The basic hide anchors are most important. Then you can increase the number hide anchors with the 45� ones. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image081.jpg]] |
- | If you have long objects do not place hide anchors in the middle, otherwise the AI has to move to far to change position. Only if there is other cover in the area can place them in the middle. | + | If you have long objects do not place hide anchors in the middle, otherwise the AI has to move to far to change position. Only if there is other cover in the area can place them in the middle. |
- | ==== | + | ==== Waypoints ==== |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image083.jpg]] |
- | For two rooms it is enough to place these two waypoints. From every corner of the rooms the AI can reach the closest waypoint. The link gives the AI the possibility to switch rooms. | + | For two rooms it is enough to place these two waypoints. From every corner of the rooms the AI can reach the closest waypoint. The link gives the AI the possibility to switch rooms. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image085.jpg]] |
- | Place waypoints at the edges of objects. The AI will have no problems going around and never gets stuck. | + | Place waypoints at the edges of objects. The AI will have no problems going around and never gets stuck. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image087.jpg]] |
- | The AI in this example is at the wall and is looking for the closest waypoint. Accidently the closest waypoint is behind an obstacle. In the new engine the AI would still find the correct one but it costs more performance. Instead place the waypoints with the same distance next to thin objects. | + | The AI in this example is at the wall and is looking for the closest waypoint. Accidently the closest waypoint is behind an obstacle. In the new engine the AI would still find the correct one but it costs more performance. Instead place the waypoints with the same distance next to thin objects. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image089.jpg]] |
- | Take care when you link waypoints. The links should never go through or go very close to physical objects. | + | Take care when you link waypoints. The links should never go through or go very close to physical objects. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image091.jpg]] |
- | Avoid waypoints that are to close to links. If two AI gyus start moving they might collide because the links are running to close next to each other. | + | Avoid waypoints that are to close to links. If two AI gyus start moving they might collide because the links are running to close next to each other. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image093.jpg]] |
- | Avoid such crossing links at object corners. AI might run into each other at intersections. | + | Avoid such crossing links at object corners. AI might run into each other at intersections. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image095.jpg]] |
- | You can easily solve this by adding a new waypoint at the edge (You should have a waypoint at the edge anyway). | + | You can easily solve this by adding a new waypoint at the edge (You should have a waypoint at the edge anyway). |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image097.jpg]] |
- | If you have alternative routes think how it would look like if you would walk exactly along the lines. Sometimes it is better to use more waypoints to simulate a more natural movement like the right example. | + | If you have alternative routes think how it would look like if you would walk exactly along the lines. Sometimes it is better to use more waypoints to simulate a more natural movement like the right example. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image099.jpg]] |
- | If you have a room first place all waypoints at all edges of objects. Only do this with objects you can‘t walk over. | + | If you have a room first place all waypoints at all edges of objects. Only do this with objects you can‘t walk over. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image101.jpg]] |
- | Then you look for waypoints which are to close to each other. If they are close together use one waypoint instead of two for cleaner navigation and less chance for the AI to get stuck. | + | Then you look for waypoints which are to close to each other. If they are close together use one waypoint instead of two for cleaner navigation and less chance for the AI to get stuck. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image103.jpg]] |
After the waypoints place the hide points, follow the general rules from the hideanchors. | After the waypoints place the hide points, follow the general rules from the hideanchors. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image105.jpg]] |
- | Hidepoints are also part of the navigation, merge hidepoints and waypoints if they are too close to each other. | + | Hidepoints are also part of the navigation, merge hidepoints and waypoints if they are too close to each other. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image107.jpg]] |
- | If all navigation points are placed, start linking them. | + | If all navigation points are placed, start linking them. |
- | [[ | + | [[Файл:Sandbox_SimpleAI_image109.jpg]] |
This waypoint in the middle may not provide perfect movement but it is better then AI getting stuck. | This waypoint in the middle may not provide perfect movement but it is better then AI getting stuck. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image111.jpg]] |
- | The red lines show bad links: either the links go through/close to geometry, or they are too close other links. It is okay if the AI first has to take 1-2m step(s) before walking in the right direction. That is better than AI getting stuck. | + | The red lines show bad links: either the links go through/close to geometry, or they are too close other links. It is okay if the AI first has to take 1-2m step(s) before walking in the right direction. That is better than AI getting stuck. |
- | ==== | + | ==== Result ==== |
Having all this setup properly the AI will be able to walk to any point and fight against the player. The better you place the waypoints, hide points the more realistic and challenging it will be for the player to fight against the AI. | Having all this setup properly the AI will be able to walk to any point and fight against the player. The better you place the waypoints, hide points the more realistic and challenging it will be for the player to fight against the AI. | ||
- | [[ | + | [[Файл:Sandbox_SimpleAI_image113.png]] |
- | [[ | + | [[Категория:Official:Basic - Gameplay Setup]] |
== See Also == | == See Also == |
Версия 11:34, 8 марта 2011
Статью пометил сам автор статьи.
Содержание |
Настройка И. И. с более продвинутым поведением
Введение
Это учебное пособие покажет вам, как разместить врагов на карте и указать им, куда они могут идти или где могут скрываться. По умолчанию они запрограммированы стрелять в игрока, как только он попадёт в зону их видимости.
Типы характеров искусственного интеллекта, их взаимодействие с оружием, как далеко они могут видеть и слышать, продвинутое поведение, такое как групповая тактика, переговоры между ИИ, использование транспортных средств и взаимодействий с сложными объектами, описано в других обучающих программах и справочной библиотеке.
Добавление противника на карту
Размещение ИИ на ваш уровень
Для размещения ИИ в RollupBar выберите Objects затем Entity, в папке AI выберите Grunt и перетащите в окно перспективы.
Снабжение ИИ оружием
Для снабжения ИИ оружием нажмите кнопку … в поле EquipmentPack откроется диалоговое окно пакетов экипировки. Для получения дополнительной информации о настройке пакетов экипировки, прочтите учебное пособие по Equipment Pack.
Важно: Чтобы изменения вступили в силу нажмите кнопку Reload Script (расположена ниже свойств сущности) чтобы Grunt начал использовать выбранный пакет оружия.
Архетипы противников
Все ИИ-персонажи Crysis размещены как архетип-объекты, это означает, что настроить параметры нужно всего один раз, чтобы использовать на разных уровнях. Чтобы увидеть параметры, которые они используют, просто нажмите на окно Entity Archetype (в следующем скриншоте текст CAMPER/CAMP.Light_Rifle).
Генерация навигации ИИ
Даже на равнинном ландшафте, убедитесь, что вы генерируете новую навигацию ИИ, хотя бы один раз после создания карты, а также после любых изменений на ландшафте.
Навигация ИИ может быть сгенерирована нажатием элемента Generate All Navigation, из меню AI.
Тестирование результатов
Перейдите в режим игры (CTRL+G) и подойдите к ИИ, если вы всё правильно настроили, то ИИ будет стрелять в игрока, когда он его увидит или услышит.
Настройка навигации
Введение
Чтобы ваш ИИ работал правильно на вашем уровне, вы должны настроить различные типы навигации.
Введение ai_DebugDraw=79 в консоль покажет вам, настроена ли уже триангуляция, это означает, что ИИ сможет найти свой путь из одной точки в другую не натыкаясь на препятствия.
Растительность
ИИ автоматически обходит объекты растительности, если всё настроено правильно.
If you want them to hide behind a tree, you just need to set the Hideable flag in the Vegetation properties.
Next, adjust the AIRadius of the Vegetation so the AI knows how big the Vegetation object is.
AI will automatically walk around physicalized entities such as vehicles.
Cliffs and big solid objects
Typing ai_debugdraw 85 in the Console will display all areas that are too steep to climb (red) and areas that may cause sliding when you try to walk on them (green).
Now we need to surround all such areas carefully with ForbiddenAreas (see section below).
Forbidden areas
You need to surround each internal waypoint region with a ForbiddenArea, this way the AI will not try to walk through walls and other objects.
Click on AI/ForbiddenArea and create a shape around the area you want to make impassable (for example the external walls of a building). Select ForbiddenArea from the menu as shown below.
Once your ForbiddenArea is created and your level triangulated, it will not be possible for the AI to walk through the walls.
Setting up waypoint regions in internal areas
To make the AI go through doors and navigate inside the building you need to add a Waypoint Region. You need to extend one section of this Waypoint Region outside of the forbidden area, as an entryway for the AI, as below.
The 3 things you need to setup a Waypoint Region are:
- AI Navigation Modifier Area
- AIWaypoints (of various types)
- AIWaypoint Entry/Exit points
You need to surround each waypoint region with an AI Navigation Modifier «Human Waypoint». (The blue shape).
Click on AI/AINavigationModifier and create an area shape of that type.
By default the NavType is set to «Human Waypoint» so no need to modify anything.
Place AI/AIpoints inside your area. You will see they turn blue once they are in a valid area.
At the place where AI should be able to enter and exit the area change the type of the AIPoint to Entry/Exit (a door symbol will be displayed instead of the blue ball.
One part of the AINavigation modifier area should be outside the forbidden area shape (red line) so the AI can reach the point.
To generate the connection between all points select the AINavigationModifier shape you placed and set Auto-Dynamic in the Waypoint Connection Parameters.
And finally click on one of the points and press the Regen Links Button:
All Points should now be connected like this and the AI will be able to navigate inside the area and enter/exit it at the points where you set the specific entry and exit points.
See the section below on how ForbiddenAreas and Waypoints should be setup in terms of placement.
You need to surround every area where you want something to fly with an AI Navigation Modifier shape called Flight. You also need to give this area a height.
Water Navigation
You need to surround every area where you want something to navigate on water (i.e. boats) with an AI Navigation Modifier shape called Water.
Paths and Roads
Create an AIPath with the Road box ticked, and vehicles will automatically have a strong preference to use the road/path. AI can also be made to follow the path using the AIFollowPath flowgraph node
External Hide Points
To make AI hide at specific spots you have to place AIAnchor (outside of waypoint areas).
Place an AI/AIAnchor next to any solid object. Now, notice the two red bars in front of the hide point, which indicates if the AI can use a crouch/hide animation, or a left/right strafe animation. The red line on the front of a hide point shows that there is left an right enough space the strafe left and right. Make sure the Green Area is not blocked by anything, so that the AI can actually use it.
The same concept for AIAnchors applies to the AIPoint Hide Points. So, change one waypoint within a nav area to a Hide Point, by changing the Type in the AIPoint Properties.
How to setup AI correctly – Advanced tips
Forbidden Areas
Here the forbidden area is placed too far away from the actual object.
Instead place them closer the the edges of the objects. This avoids that the AI might slip in the gaps. Now the AI navigates way better around these objects.
Do not place two forbidden areas so close to each other. Even if the AI can‘t fit through, the navigation will still trace a path in between.
Instead delete one forbidden area. Make one big forbidden area which contains both objects.
Do not place objects close on the edge of a forbidden area. Otherwise the AI circles around the hide objects and can slip in the forbidden area.
Place the hide objects either inside the forbidden area or outside of the forbidden area. Make sure that if the AI circles around the hide object it doesn‘t slip in the forbidden area
Large open sided structures should not have one big forbidden area around them.
Rather, place smaller forbidden areas around them.
Hide Anchors
The AI hides at the hide anchor if an enemy is the cone. The more AI guys you have the more hide anchors you have to place. Do not place hide anchors for just one direction. Place them for all possible directions.
Place hide anchors at the sides of an object not only at the edges. Sides provide better cover than edges.
For thin objects place hide anchors close to the edges so the AI can leave their positions quickly. Do not forget to place them on both sides pointing at each other
Place hide anchors only at position where the AI has real cover. The front and the back of e.g. a car provide less cover. The middle provides better cover.
Normaly edges of a house provide less cover. First place hide anchors close to the edge pointing directly in the direction. Then place hide anchors with 45� rotation slightly away from the edge.
If you do not have enough hide anchors for many AI guys you can increase the hide anchors. The basic hide anchors are most important. Then you can increase the number hide anchors with the 45� ones.
If you have long objects do not place hide anchors in the middle, otherwise the AI has to move to far to change position. Only if there is other cover in the area can place them in the middle.
Waypoints
For two rooms it is enough to place these two waypoints. From every corner of the rooms the AI can reach the closest waypoint. The link gives the AI the possibility to switch rooms.
Place waypoints at the edges of objects. The AI will have no problems going around and never gets stuck.
The AI in this example is at the wall and is looking for the closest waypoint. Accidently the closest waypoint is behind an obstacle. In the new engine the AI would still find the correct one but it costs more performance. Instead place the waypoints with the same distance next to thin objects.
Take care when you link waypoints. The links should never go through or go very close to physical objects.
Avoid waypoints that are to close to links. If two AI gyus start moving they might collide because the links are running to close next to each other.
Avoid such crossing links at object corners. AI might run into each other at intersections.
You can easily solve this by adding a new waypoint at the edge (You should have a waypoint at the edge anyway).
If you have alternative routes think how it would look like if you would walk exactly along the lines. Sometimes it is better to use more waypoints to simulate a more natural movement like the right example.
If you have a room first place all waypoints at all edges of objects. Only do this with objects you can‘t walk over.
Then you look for waypoints which are to close to each other. If they are close together use one waypoint instead of two for cleaner navigation and less chance for the AI to get stuck.
After the waypoints place the hide points, follow the general rules from the hideanchors.
Hidepoints are also part of the navigation, merge hidepoints and waypoints if they are too close to each other.
If all navigation points are placed, start linking them.
This waypoint in the middle may not provide perfect movement but it is better then AI getting stuck.
The red lines show bad links: either the links go through/close to geometry, or they are too close other links. It is okay if the AI first has to take 1-2m step(s) before walking in the right direction. That is better than AI getting stuck.
Result
Having all this setup properly the AI will be able to walk to any point and fight against the player. The better you place the waypoints, hide points the more realistic and challenging it will be for the player to fight against the AI.