AI

Building Navigation

The AI moves through the level on what’s called a Nav-Mesh. NPCs (Cops, AI Teammates, Civs) move according to it. The Nav-Mesh is split into “rooms”, the AI then navigates through the level by moving from room to room, attempting to complete their current set goal. They may be following a predetermined patrol path, walking up to the player to arrest them or moving to a set position to do some action.

Navigation Segments

The rooms that make up the mesh must be defined manually. Each room must have what's called a Navigation Segment placed inside. They are used to generate the Nav-Mesh.
To place Navigation Segments, go to the World Menu and into the AI-tab. There you will find the "Spawn Navigation Segment" button.
Navigation Segments will only be visible when inside this menu.

Next, we need to further define the Nav-Mesh using Blockers and Splitters. Both of these unit types are editor-only, meaning you have to enable the “Draw Editor Units” option to see them.

Splitters

Splitters separate the rooms for navmesh generation. Each and every navigation segment has to be completely isolated from all other nav segments, and splitters are what do the job. When generating, solid objects block navigation so there is no need for placing them inside walls. These are used prominently in doorways or big open areas that you want to divide into smaller sections.
A single Splitter should never connect more than 2 Navigation Segments, otherwise the mesh will bleed when generating and not connect properly between segments.

Blockers

Blockers prevent the Nav-Mesh from generating wherever you place them. Sometimes, a unit may have a slope that the generation perceives as space that should be traversable for NPCs. You also have to make sure navigation doesn’t seep out of the intended area and continue to generate near-infinitely on the background geometry.

You can find both Splitters and Blockers by looking for them in the Spawn Menu. Some names may be inconsistent, but they are colored in a specific way. Splitters are green and blockers are always red.

Cover Points

Cover Points, as the name suggests, are manually defined points in your level where the AI should take cover. Around props like barrels, pallets or cars, next to doorways or corners of buildings, basically everywhere where you think it makes sense. Coverpoints also play a big role in the movement of the NPCs, as they navigate from coverpoint to Coverpoint. If no Coverpoint is present, they will just move from segment to segment.


Generating

To generate the Nav-Mesh, we return to the AI-Tab in the world menu. The options are near self-explanatory, and to start the process just press Calculate All. You can view this process as it builds itself, but depending on the size of your map, it can take a while. When it’s done generating it will automatically reload the editor.

After generating your Nav-Mesh, you can view the results using the debug options in the AI-Tab. The most important are:
Quads show the Nav-Mesh as blue rectangles. Those are the areas your AI can technically move on. It May sometimes appear warped weirdly, especially at sloped areas and stairs, but it should still work fine when playing.
Coarse Graph shows you which segments are connected. If segments are connected with a thick yellow line, AI can freely move between them. Ideally, segments should only be connected with their neighbouring segments.
Covers show the location of cover points and what way they’re facing, the green line indicating the front. If the cone above them is green, they can be used by AI. If the cone is red, AI will not use them as they most likely are not on the Nav-Mesh, or the part they are placed on is disabled.

If you find issues with your mesh, for example it didn’t generate in specific areas you need it in, generated too much, or isn’t connecting certain parts properly, simply tweak the position of your blockers and splitters, and generate again until you’re happy with it.
Note: Navigation needs roughly 1.5m of free space above the segment to generate.
You can even generate individual segments by selecting them and clicking the Calculate Selected button in the AI-Tab, however before releasing the map you should re-generate your entire navigation with Calculate All to make sure there aren’t any potential issues with it.

Manipulating Navigation Mid-Game

The Navigation can be manipulated in several ways while playing. You can set up Navigation Links to add more ways for the NPC to navigate through the level, block entire Navigation Segments or just parts of the mesh.

AIGraph Element

Using the AIGraph Element, you can enable or disable entire Navigation Segments. Link the Element to the Nav segment either by opening the Graph Unit list with the button or the M hotkey, or holding SPACEBAR and clicking on the segment.
With the Operation setting you can either allow or forbid access to the linked segments, and even forbid access only for certain AI types.

Door Blockers & NavObstacle Element

Another way to prevent the AI from reaching certain areas is with the use of Door Blockers. Instead of blocking the entire segment, door blockers block only the parts of the mesh they collide with.
They are most commonly used to block doors, hence the name, but they can be used in many other ways, for example vehicles that roll-in at a later point in the heist like SWAT trucks.
You can find door blockers by looking for them in the Spawn Menu, they are usually colored Pink. Door blockers have to be enabled and disabled using the NavObstacle Element. Link the Element to the Door Blocker either by opening the Obstacle list with the button or the M hotkey, or holding SPACEBAR and clicking on the Unit. In the Operation select “Add” to block the navigation and an additional NavObstacle Element with the “Remove” Operation to make the navigation accessible again.

Navigation Links, or Navlinks for short, are Special Objective Elements with the “Navigation Link” setting enabled. They allow AI to move between 2 unconnected segments using animations. For example, make AI climb over fences, jump over gaps or through windows, or vault over objects.
To set up Navlinks, place down a regular Special Objective Element and enable the “Navigation Link” setting.
Choose an animation in the SO Action setting.
Increase the interval so the AI waits until the Navlink is free to use again without clipping into each other.
Make sure the type of NPC you want your Navlink to use is in the Access Flag list.
Lastly, the search position has to be roughly in the area the navlink connects to. There is a button to place at the end position of the currently selected animation, but it’s not 100% reliable and may require manual tweaking.

Guard / Civilian Patrols

You can make NPCs walk around the level in stealth mode using SpecialObjective and SpecialObjectiveGroup Elements. Per NPC, you place several SO Elements. They act as check points the AI moves between.
A basic setup for your SOs is the following:
Enable Repeatable, and Use Instigator.
Set AI Group to whatever type of AI uses the patrol.
Path Style destination and Path Haste walk.
Also make sure to add the AI type to the Access Flags.
Further down you can also set Action Duration Min and Action Duration Max to tweak how long the AI remains at this SO.

To easily randomize between the SO checkpoints, spawn a SpecialObjectiveGroup Element and add all SOs of your patrol to the followup Elements list. Set the mode to randomizer, enable Use Instigator and set the base chance to 1. Make sure each SO of the patrol has the SO Group Element in the Followup List as well.

Now all you have to do is place an EnemyDummyTrigger Element, link it to your enemy or civilian, set it to spawn and make it execute the Special Objective Group.

Assault Waves

Assault waves are largely handled by the game automatically. You only have to set up a few things.

First of all you should set up some spawns for the Cops:
Place some SpawnEnemyDummy elements around your map, preferably in areas the player can’t see. You can even set animations in the Spawn Actions for things like climbing up a ledge or repelling down from somewhere in case the spawn is in a visible area. The other settings don’t matter in this case.
To make your spawns more organized, should group up spawns with a SpawnEnemyGroup element. In there you can even toggle specific types of enemies for the spawn group and increase the interval if needed. For regular assault spawns you can enable everything except for single_spooc and Phalanx.

To activate spawn groups, you need a EnemyPreferedAdd Element. Select the spawn groups in there and execute it when you need them enabled. You can add more spawn groups like this at any point in the heist, for example if the player opens a new area. Additionally you can use EnemyPreferedRemove to disable spawns.

Next you need to set-up Difficulty Elements. Those determine the intensity of your assault phases. It has to be above 0 for enemies to spawn. You can increase or decrease the difficulty intensity any time.

Lastly, make sure the Whisper State is set to disabled, otherwise the game will not start any assault waves and remain in stealth mode. Simply execute a WhisperState Element with the Whisper State setting off.

You can use a GlobalEventTrigger Element with police_called to execute the whisper state and set the difficulty to start the police assaults when a NPC calls the cops, but you can also choose different triggers or even execute the elements manually at any time.

Harassers and Snipers (+ Hiding Cloakers) [wip]

So called “Harassers” are enemies that are spawned separately from the assault wave, that are used to make specific parts of your level harder, or simply to annoy the players and keep them on their toes. Snipers and hiding cloakers are included here because they basically fulfill the same purpose.

Harassers

Harassers are mostly placed in areas that are either out of bounds for the player, or hard to reach. For example on rooftops, containers, scaffolding and so on, but still close enough to easily kill them. Ultimately it’s up to you where you place them.
They can be any type of enemy ranging from normal SWAT units to Bulldozers or even Gangster and the amount of harassers is also up to preference.

Snipers

Snipers are set up very similar to Harassers, running on a loop that respawns them after a while. Usually with a counter keeping track of the amount of snipers present on the map, so as to not spawn too many at once. Most of the time they are placed further away from the player, making them harder to hit. Even higher rooftops or helicopters that fly in. They use sniper units instead of regular cops.

Cloakers

Hiding cloakers require a little more set-up. With the use of Special Objective, you can set up hiding places around your level. There are various animations you can use for cloakers to hide around corners, below cars, behind doors and so on. You can also set at what distance the Cloaker jumps out of his hiding spot and attacks the player. Usually Cloakers spawn and hide at the end of or between assault waves.

Basic Setup (wip)

They usually run on some kind of loop that respawns them after a while. Very important is the use of SpecialObjectives with the force the spawned cops into position, otherwise they might just wander off and despawn, or don’t move away from their spawn dummy at all.

Captain Winters

Required Elements:

Place the SpawnEnemyDummy somewhere out of view from the player. Lower the interval to 0.10 and leave the rest of the settings as is.

In the SpawnEnemyGroup element, add the previously placed SpawnEnemyDummy to the "Manage Elements List". Leave all the above settings as is but disable all the enemy types below (tac_shield_wall_charge, FBI_spoocs, etc.) and only enable Phalanx.

In the EnemyAddPreferedAdd element, add the SpawnEnemyGroup to the "Manage Spawn Groups List". You can either enable "Execute on startup" or execute this element at a later point in the heist.

In the SpecialObjective element, leave all the settings as is but set the SO Action to AI_phalanx and enable "Execute on startup". No other setting is needed, Access flags should stay empty.
Place the SpecialObjective element where you want Winters to be positioned. Winters himself will stand at the exact position of the SpecialObjective and his phalanx units will automatically position themselves around him.

Optimally you also want to have a FleePoint element nearby for winters to despawn.

Notes

It takes about 5 to 10 minutes for the game to actually spawn him but from here on everything is handled automatically by the game.

Vehicles can instantly kill Winters and his shields, keep that in mind when placing your Phalanx SO. It’s best to place him in a dedicated area that can’t be reached by vehicles, as seen in the Goat Simulator heist.

Winters will only spawn when playing your map through Crime.net Online and on at least Very Hard diffculty. You won't be able to see him in editor playtesting.