Редактирование навигационной сетки

From Valve Developer Community
Jump to: navigation, search
English Español Русский 日本語
Navigation Meshes:ru

Эта страница посвящена созданию и редактированию файла NAV для карты в игре.

Список команд см. в разделе Команды навигационной сетки.

Автоматическая генерация навигационной сетки

Новая навигационная сетка <game>/maps/<mapname>.nav (<игра>/карты/<имя карты>.nav) для карты может быть создана с помощью команды nav_generate во время загрузки карты, которая требует sv_cheats 1. В зависимости от размера и сложности карты, это может занять от нескольких минут до нескольких часов, но в основном около 5 минут. Однако большие леса являются примером структур, для которых расчет .nav может занять много времени. Затем вы можете загрузить созданный файл .nav на свой сервер.

Note.png Примечание: nav_quicksave 1 не позволяет nav_generate украшать сгенерированную сетку полностью проанализированными данными.

Рекомендуется, чтобы создатели карт создавали навигационные сетки, прежде чем публиковать свою карту.

Note.png Примечание: В Counter-Strike: Source и Counter-Strike: Global Offensive, если боты добавляются на карту без файла .nav, игра автоматически nav_generate (начиная с точек спавна). Это особенно влияет на пользовательские карты. Если генерация .nav занимает слишком много времени, этого автоматического процесса можно избежать, убедившись, что боты не присоединяются к игре, например, вызвав bot_kick перед выбором команды.

Что вычисляется во время генерации

Во время создания навигационной сетки происходят следующие шаги:

  • Начиная с точки респауна игрока, ходимое пространство выбирается путем "заливки" из этой точки, ищя соседние ходимые точки.
  • Из отобранных данных строятся прямоугольные Навигационные области.
  • Вычисляются места для пряток и снайперов
  • Вычисляются места встреч и точки подхода (это может занять некоторое время)
  • Вычисляются начальные области встречи

Просмотр навигационной сетки

Чтобы просмотреть текущую навигационную сетку, введите nav_edit 1. Чтобы выключить редактор сетки, введите nav_edit 0. Для просмотра навигационной сетки вам потребуется sv_cheats 1.

Выполните tf_show_mesh_decoration 1, чтобы увидеть все атрибуты Team Fortress 2. Используйте tf_show_mesh_decoration_manual 1, чтобы скрыть автоматически создаваемые атрибуты Team Fortress 2.

Явное обозначение зон, пригодных для ходьбы (например: "Наверху нет сетки")

Некоторые карты с очень крутыми лестницами, пандусами или холмами могут запутать систему генерации, в результате чего навигационная сетка не покрывает всю карту. Чтобы решить эту проблему, вы можете вручную разместить дополнительные маркеры для ходьбы, которые будут указывать генератору на поиск в направлении от этой точки во время фазы выборки.

Чтобы добавить один или несколько маркеров, сначала направьте взгляд на известное место на карте, где можно ходить, затем введите nav_mark_walkable в консоли. Когда вы закончите расставлять маркеры, введите nav_generate_incremental (затем nav_clear_selected_set) или nav_generate для повторной генерации сетки.

Вы можете удалить все ранее размещенные ходовые маркеры с помощью команды nav_clear_walkable_marks.

Быстрая генерация сеток для тестирования

Фаза анализа генератора может отнимать много времени. Чтобы пропустить его, введите в консоль nav_quicksave 1.

Note.png Примечание: "Быстрое сохранение" пропускает фазу анализа, и в полученной навигационной сетке будут отсутствовать важные данные, необходимые системам планирования и внимания более высокого уровня CS Bots и Hostages. Хотя это полезно для тестирования, редактирования и настройки навигационной сетки, обязательно проведите полный анализ (т.е.: nav_analyze с nav_quicksave 0), прежде чем публиковать свой навигационный файл другим.

Редактирование навигационной сетки

Enabling the Navigation Mesh editor in de_dust

Автоматический генератор навигационной сетки делает разумную работу по созданию сетки (даже без запуска nav_quicksave 0), позволяя вам легко начать использовать ботов и заложников на пользовательских картах.

Однако тщательная ручная настройка навигационной сетки может заметно улучшить производительность ботов. Ручное украшение сетки Названиями мест также позволяет ботам сообщать другим, где происходят события, улучшает радар Counter-Strike и включает названия мест во все радиосообщения.

Чтобы включить редактор, введите nav_edit 1 в консоли (для выключения введите nav_edit 0).

  • Белый крест в центре экрана - это курсор.
  • Область навигации, на которую вы указываете, является выбранной областью и отображается желтым контуром.
  • Навигация Области, в которые можно попасть из выбранной области, показаны красным цветом.
  • Белая линия в выделенной области обозначает место, где область будет разделена, если будет выполнена команда nav_split.
Warning.png Предупреждение: Редактирование навигационной сетки при активных ботах может привести к сбою игры, особенно удаление, разделение и объединение областей. Для безопасности сначала выполните bot_kick. Если вы закончили редактирование, nav_save сохраните свою работу и перезагрузите карту, прежде чем снова добавлять ботов.

Сохранить

В настоящее время в системе редактирования Navigation Mesh нет команды "отменить". Поэтому очень важно часто сохранять свою работу с помощью команды nav_save.

Создание новой области

Это можно сделать с помощью команд nav_begin_area и nav_end_area.

Поместите курсор в то место, где должен находиться угол новой области, и выполните команду nav_begin_area.
Переместите курсор, чтобы вытянуть границы области.
Поместите курсор в противоположный угол новой области и выполните команду nav_end_area.
Note.png Примечание: Области, созданные таким образом, не имеют начальной связи с существующей навигационной сеткой.
Tip.png Совет: Вы можете использовать nav_snap_to_grid 1, чтобы получить согласованные размеры прямоугольников.
Tip.png Совет: Четыре угла получившегося участка будут находиться на одной высоте. Если земля не ровная, начинайте новые области с самого высокого угла, чтобы предотвратить создание области под полом. Плавающую область можно легко сдвинуть вниз к земле, используя nav_corner_place_on_ground при наведении на нее.
Tip.png Совет: A newly created area will bidirectionally connect to a marked area upon nav_end_area being executed.

Delete

To delete an area, aim your cursor at it so that it is highlighted and execute nav_delete. Alternatively you can mark an area or select a set of areas to delete multiple areas.

Connect two areas

One-way connections (marked with dark blue lines) are usually used for "jump-down" links from a ledge to the ground.
Bidirectional (two-way) connections (marked with light blue lines at the area edges) allow bots to freely move between the two areas.

The connections between areas define whether one can move from one area to another.

Usually these connections are bidirectional, meaning one can move back and forth between two areas at will. However, sometimes the connection is one way, as in the case of ledges that can be jumped down, but not back up. One-way links can also be useful for forcing bots to travel a specific direction, perhaps to set up for a tricky jump.

To make a one-way connection from area A to area B (meaning you can move from A to B):

  1. Mark area A: Place your cursor on it and execute nav_mark.
  2. Aim at area B and execute nav_connect.

To make a bidirectional connection, repeat the above steps reversing the roles of A and B.

Tip.png Tip: In a selected set, nav_connect will try to bidirectionally connect the first selected area and every subsequently selected area. Use nav_connect and selected sets to quickly make bidirectional connections.

Disconnect two areas

To remove all connections between the areas A and B:

  1. Mark area A: Place your cursor on it and execute nav_mark.
  2. Aim at area B and execute nav_disconnect.
Tip.png Tip: When ran with a selected set, nav_disconnect will try to remove connections between the first selected area and every subsequently selected area.
Tip.png Tip: Use nav_disconnect_outgoing_oneways to quickly disconnect all one-way connections. This command also works in a selected set.

Split

Splitting divides an area into two bidirectionally connected areas.

Position yourself and the cursor so that the white split line is where you want the area to be split.
Execute nav_split to get two adjacent, inter-connected areas.

Merge

Merging two areas reduces the area count.

Both areas must be the same size along the edge to be merged. It is not required that the two areas are adjacent.

The resulting area will retain all of the connections of the original two areas, and inherit properties (i.e: Place Names, etc) from the marked area.

Tip.png Tip:  While moving from point A to point B, bots tend to prefer routes with less areas to travel through, so a route can in theory be made more attractive to bots by merging some areas.
Aim your cursor at the first area and execute nav_mark.
Aim at second area.
Execute nav_merge.

Splice

Splicing creates a new area between two existing areas. Splicing is a powerful tool, and can be used to easily create sloped areas, as shown in the example below.

Tip.png Tip:  It is not required that the two areas have the same width. The width of the resulting area will be the smaller of the two.
Aim your cursor at the first area and execute nav_mark.
Aim your cursor at the second area.
Execute nav_splice.

Area Attributes

A jump area and a no_jump area.
Crouch areas.

There are a bunch of attributes that each area can have which tell bots to behave in a specific way when touching it. All attributes of an area are visible for a short amount of time when aimed at. This duration can be set with the ConVar nav_show_area_info. To toggle an attribute for an area, aim at it and execute the corresponding command, e.g. nav_jump.

  • Jump areas (marked with a green X) tell bots that they must jump to reach the higher connected area, and that this area is not usable as a hiding/sniping spot.
  • Crouch areas (marked with a blue diagonal slash) force bots to crouch when moving through this area.
  • No jump areas (marked with red rhombus) force bots not to jump. This is useful to prevent excessive jumping. However, bots get stuck if jumping is required to keep going, as they may not jump.
  • Precise areas (marked with a green +) stops bots from avoiding obstacles. This can help in places where they can easily fall off, like catwalks with no railing.
  • Stop areas (marked with a red octagon) tells bot to stand still for a short moment when entering this area. Useful to slow bots down to line up tricky jumps more accurately.
  • Run areas (marked with two blue arrows) tell bots explicitly to run.
  • Walk areas (marked with one green arrow) tell bots explicitly to walk silently.
  • Don't hide areas (no mark) tell bots not to use this area as a hiding spot.
  • Stand areas (no mark) tell bots not to crouch while hiding in this area.

Apart from the above attributes, which can be set, there is the blocked attribute (marked with a blue rectangle) that is set automatically in certain cases when bots can't or shouldn't use a nav area.

Note.png Note: Areas can be blocked for specific teams in Team Fortress 2. It is possible to see what bots the blocked attribute blocks through the tf_show_blocked_areas ConVar.

In Counter-Strike: Global Offensive, active trigger_hurt entities, locked doors and func_nav_blockers in particular can block nav areas.

Using Mesh Editing Binds

Although all of the mesh editing commands can be typed in the console, in practice it is far easier to bind these commands to keys. With bind del nav_delete for example, pressing Del will delete the nav area under your cursor (in nav editing mode).

You can temporarily bind many commands at once by using a CFG file. This is useful for bot navigation editing, because there are many commands, and you will probably not want them to be permanently attached to your keys. See Editing Bot Navigation CFG File for a pre-made file and instructions on its use.

See Navigation Mesh Console Command Reference for a list of all commands related to bot navigation.

Place Names

Once you've generated a nav mesh, Place Names can be assigned to nav areas to label that region of the map. For instance, if there is a prominent house in the map, all of the nav areas in the house can be tagged with the "House" Place Name.

Place Names are used by the CS Bot chatter system to announce where they are, by the radar to show the current location of the player, and they are appended to the player's name when that player uses text chat or radio commands. For example:

ChicagoTed @ Apartment (RADIO): Fire in the hole!

Adding place names

To add or change the name of a location, you need to turn on the place name editor. Make sure nav_edit is set to 1, then type

nav_toggle_place_mode.

When the place name editor is enabled (assuming no areas have been named) all the nav squares should turn red. To select which Place Name you want to assign to an area, type

nav_use_place <name>,

for example nav_use_place Bedroom. Next, aim your cursor at an area you want to label with that Place Name and turn on Place Painting Mode by executing

nav_toggle_place_painting.

While Place Painting is active, each area you point at will be tagged with the current Place Name you selected and will turn green in color. You can change the place name you are painting with by typing nav_use_place <newname>, notice that after changing the place name, all areas already painted with a different name will turn blue and areas painted with the name you just changed to will turn green. When you are finished using Place Painting Mode, you can exit by executing nav_toggle_place_painting again.

For a list of all available Place Names, execute nav_use_place with no argument. See also: Counter-Strike: Source Standard Place Names for CSS, Counter-Strike: Global Offensive Standard Place Names for CS:GO.
There are several additional commands that provide tools for picking, flood-filling, replacing, and so on. For a complete reference, see Place Name Commands.

Common mesh problems and solutions

Extraneous areas on stairs and ramps

The automatic generation system tends to build areas that hang off the side of stairs and ramps. These should be removed to force the bots to take the stairs or ramp straight-on.

Railings

Railings can be a problem for the current bot navigation system, this includes jump-down links that must pass over railings, they should be avoided unless necessary. The bots will eventually make these jumps, but they are not terribly elegant while doing so.

Preventing excessive jumping

Use the nav_no_jump command to flag the area to discourage jumping.

Note.png Note: The NO_JUMP attribute is not used in Team Fortress 2 Team Fortress 2 .

Dealing with rotating doors

Clip off the nav area to leave an empty space in the nav mesh to allow for the rotating door. You may have to remake the nav square if deleting part of an existing one doesn't work.

Bots will sometimes try to walk through the opened door brush from one nav area to another and get stuck. Either removing the adjacent nav area or configuring the areas and connections so the bots have to walk around the opened door should prevent this.

Advanced editing techniques

Ladders

Ladders can be manually built against climbable surfaces. Your editing cursor will turn green when pointing at a climbable surface.

Using nav_build_ladder

The easy way to build a ladder is to simply point at a climbable surface, and execute nav_build_ladder.

Point at a climbable surface
Ladder created

Using nav_begin_area and nav_end_area

If nav_build_ladder isn't what you need, you can manually create a ladder:

  1. Place your cursor at where a corner of the new ladder should be
  2. Execute nav_begin_area
  3. Move your cursor to drag out the ladder's extent
  4. Execute nav_end_area

This can be useful to get bots to start going up the ladder, and jump off halfway up, onto the crate:

Start dragging ladder at first corner
Drag ladder extent
Ladder created

Reversing ladders

Sometimes a ladder will be created facing the wrong way. If a ladder is drawn in red, you are looking at it from the back. The ladder is drawn in green if it is facing you. To change the orientation of a ladder, simply point at the ladder and use nav_ladder_flip.

Ladder facing into the wall (incorrect)
Ladder facing away from the wall (correct)

Obstacle avoidance and precision movement

Using nav_precise, nav_walk, and nav_stop to disable local obstacle avoidance behaviors and control bot movement.

Note.png Note: The WALK and STOP attributes are not used in Team Fortress 2 Team Fortress 2 .

Marking areas to avoid

Using nav_avoid to tell bots to avoid the area unless the normal route has become too dangerous.

Note.png Note: The AVOID attribute is not used in Team Fortress 2 Team Fortress 2 .

Controlling where bots Can hide

Using nav_dont_hide to prevent bots from hiding in that area. This can be used to force the creation of hiding spots during the analysis phase.

Setting up sniper spots

Mark an area using nav_walk and execute nav_make_sniper_spots. This will break the area into small sub-areas which are used internally by the navigation mesh to encourage sniping.

Note.png Note: In Team Fortress 2 Team Fortress 2 hiding spots only determine where TFBot Spies lurk; Sniper spots are marked by func_tfbot_hint, but they are only used by Snipers in Mann vs. Machine; otherwise the game automatically determines Sniper spots.

Lining up tricky jumps and narrow doorways

Highest possible crouchjump

Arranging nav areas to force specific paths.

  • If the bots are getting hung up on the sides of a door or window, you can carve out a narrow path through the middle of the opening.
  • The highest a bot will try to jump is 58 units. If the top of a jump is 59 or more units above the bottom, bots will give up as soon as they jump. If this happens in a spot that the bots can actually jump up to, use nav_corner_lower to lower the upper nav area slightly.

Import and Exported areas

Nav areas can be imported and exported through nav_save_selected and nav_merge_mesh respectively. nave_save_selected exports nav areas in a selected set to a KeyValues file, while nav_merge_mesh imports nav areas from the selected file and selects them. The KV file used by these commands can be edited to force custom nav area shapes and connections that otherwise would be impossible to make.

Warning.png Warning: Degenerate areas are hard to select and (by proxy) remove, so try not to make them!

To do: Describe file syntax and info.

These commands can be useful for:

  • Creating connections that are difficult or impossible to make manually with nav_connect, such as a bidirectional connection between two areas in areaportals.
  • Fit areas on to skewed surfaces.

See also

External Links