Introduction

When the alien loses track of the player it doesn't wander at random: it goes to search spots near where it last sensed them and looks around, and while it stalks it moves between sweep spots over the area. Androids that grab the player next to a wall throw them against it, and next to a desk throw them onto it; an android set to play dead grabs the player who comes close. None of these spots come from the navmesh bake - they are composites the level places by hand, and the game's NPCs find them by position.

A level you build yourself has none of them, so its alien has nowhere to search and nothing to sweep. Utilities → Place AI Markup places them for you, over the navmesh, the way the game's own levels lay them out.

The Kinds of Markup

All five are the game's own composites. Nothing links to them: each holds a job and a task, or a melee context, with a position, and the AI gathers the ones near it when it needs one. They aren't shipped with OpenCAGE, so when your level doesn't have one yet it is brought in from a level of your game install that has it (PRODUCTION/TECH_COMMS has all five), the way Import Composites From Level does. That can't be undone; the markup you place can.

Area Sweep Jobs

Archetypes\Jobs\AreaSweepJob - a JOB_AreaSweep with its task at the composite's position. These are the spots an NPC sweeps over while it hunts through an area: the alien's area sweep when it stalks the player on foot.

Melee High Cover

Archetypes\Jobs\MeleeContext\MeleeContext_HighCover - an NPC_MeleeContext of type ANDROID_HIGH_COVER_GRAPPLE, with a converge position and a radius (USE_RADIUS, 3 m). When an android grabs the player within that radius it plays the grapple that throws them against the wall: the context stands 2.5 m back from a high wall, facing it, so the animation lines up with the wall. Only levels with androids need it. Its markup in the viewport draws a line along the floor to a T where the wall's face goes.

Melee Low Cover

Archetypes\Jobs\MeleeContext\MeleeContext - an NPC_MeleeContext of type ANDROID_LOW_COVER_GRAPPLE (its default: the composite leaves the type unset), with a converge position and a radius. An android that grabs the player here throws them onto a surface in front of it - a desk, a bed, a counter. The context stands 1.25 m back from the surface's face, facing it, as its markup's line and T show. Only levels with androids need it; the game places it in its hospital, comms and penthouse levels.

Corpse Traps

Archetypes\Jobs\MeleeContext\MeleeContext_CorpseTrap - an NPC_MeleeContext of type ANDROID_CORPSE_TRAP_GRAPPLE, with a radius of 1.5 m (USE_RADIUS). An Android_NPC or Android_Heavy_NPC whose is_corpse_trap_on_start is on lies on the floor playing dead until the player comes close, then grabs them: the corpse traps beside it are where that grab plays out. Every android the game sets to play dead has one to four of them in its own composite, a median 0.9 m from it (0.6 to 1.26 m), on its floor, each facing away from it; no other android has any. A level needs them for each android set to play dead, so the tool adds them by default.

Placing Markup

Save and Build your level once first (the tool finds spots on its navmesh), then open Utilities → Place AI Markup.

  1. The top of the window says what the level has of each kind: how many, how many are yours, their spacing, and any that stand off the navmesh. It also says how many androids play dead, and warns about any with no corpse traps.
  2. Tick the kinds you want and press Find Spots. Corpse traps are ticked to begin with, as the level needs them. The spots appear in the list with how far each is from the edge of the walkable floor (for melee cover, which way it faces and how far its wall or surface is; for a corpse trap, the android it guards).
  3. Untick any you don't want, then press Place Ticked Markup. They are placed in the composite shown under Put them in (the root, or the one on display), named SearchJob_1, AreaSweepJob_1, MeleeContext_HighCover_1, MeleeContext_1 and so on, on a flowgraph page called AIMarkup. Corpse traps go in the composite of the android they guard instead, as the game's do, named MeleeContext_CorpseTrap_1 and so on. It's all one step on the undo history.

No bake is needed: the markup works as soon as the level is saved. Placed markup is ordinary entities: move it with the Viewport gizmo, delete it, or set its filter pin off to keep a spot unused until your script turns it on.

How Spots Are Chosen

The rules come from measuring where the game's own levels put their markup:

  • Search and sweep jobs stand on standing-height floor that the alien, androids or humans walk (not the tops of crates, not doorways that start closed), at least 0.35 m from the edge of the walkable floor. The game's own sit a median 0.85 m from it - off the walls, but not always in the middle of a room. The tool samples the floor, prefers the more open spots (up to 1.2 m from the edge, with a little chance mixed in so a room's spots aren't all in its middle) and keeps each spot the kind's spacing from the others of its kind on the same floor. Search and sweep spots are chosen separately, so they interleave, and now and then share a spot, as the game's do.
  • High cover stands 2.5 m back from the face of a wall, and faces it - the distance its markup's line and T show. Measured in the collision, the game's own levels put their high cover a median 2.5 to 2.57 m from the wall in front of it; on the navmesh that is about 2.15 m back from the edge of the floor, as the walkable floor stops short of a wall. The tool finds the wall past the floor's edge in the collision and puts the spot 2.5 m from its face (to within 0.1 m), so how far short of the wall your navmesh stops doesn't move it. The floor must run straight up to the wall across the width of the throw, and the wall must be there at waist and head height - a railing, a low counter or a drop doesn't count. Facings within a few degrees of a multiple of 45 are squared up, as the game's are.
  • Low cover stands 1.25 m back from the face of a surface, and faces it. Measured in the collision, the game's own low cover faces a desk, bed or counter whose top is 0.65 to 1.4 m up (a median 0.9 m), whose face is a median 1.3 m away (most 1.15 to 1.45 m), whose top runs on at least a quarter of a metre, with a metre or more of room over it. The tool finds such a surface past the edge of the floor in the collision - solid at knee height, upright up to its top, nothing standing on it, room above - and puts the spot 1.25 m from its face (to within 0.1 m), facing it, with the floor clear up to it. The game centres its low cover on the surface (nine times in ten within 0.15 m of the middle of its face), so the tool moves each spot to the middle of the face too, and prefers wider surfaces.
  • Corpse traps go round each android set to play dead that has none of its own (none within 2 m of it in its composite): up to three, 0.9 m from it and 120 degrees apart, the first in front of it, each facing away from it at its floor height, as the game's face. A spot must be on the navmesh androids walk with nothing in the collision between it and the android; a blocked one turns up to 45 degrees or moves in or out a little, and where there is no room it is left out, so an android against a wall may get one or two.

The tool reads the navmesh as the last Save and Build made it, and the collision as it is now.

Options

  • Spacing - the least distance between two of a kind: 5.5 m for search and sweep jobs, 4.5 m for high cover and 5 m for low cover, which gives about as many as the game's own levels have over the same floor. The game's denser maps space them nearer 4 m.
  • Corpse traps - on by default: an android set to play dead with no corpse traps is missing markup the level needs.
  • Keep clear of the level's own markup - new spots keep their kind's spacing from the markup the level already has, so you can fill in only the areas that lack it.
  • Indoors only - leaves out floor with no ceiling over it in the collision. The game puts its markup where its NPCs hunt, which is indoors; a level with a large outdoor area usually wants this on. Anything roofed counts as indoors - a porch, a canopy, a walkway under a gantry - so it is not a substitute for choosing the area.
  • Put them in - the root, or the composite on display (placed once).

The game's own levels only mark up the areas their NPCs hunt in - a third of the walkable floor, typically - and no level of the game has more than about 600 search, sweep and hiding-spot jobs in all. A large level marked up from end to end can have far more than that, so place markup only where your alien or androids go: an AI assistant can pass a region for each area in turn (each call keeps clear of what the one before placed), or untick the spots you don't want before placing them.

Comparing With the Game's Levels

Compare With Level's Own checks the tool against a level that already has markup - one of the game's own, for example. For each kind the level places, it finds spots again over the floor round that markup (within 6 m of it), ignoring the markup itself, and says how the two compare: how many each has, their spacing and distance from the floor's edge, and how many of the level's spots have one of the tool's within 2.5 m (1 m and the same facing for high and low cover). For corpse traps it places them again round each android playing dead that has some, and counts the level's with one of the tool's within 0.5 m facing the same way. It changes nothing.

The tool matches the game's levels on how many spots there are, how far apart and how far from the walls. Which spot in a room a designer picked, or which wall, is a matter of taste no rule reproduces, so a match share of around 60% for search and sweep jobs - near what spots spread evenly over the same floor would get - is as expected. High cover lines up with the game's own walls and facings about a fifth of the time: far more often than chance, but the game's designers chose only some of the walls that qualify. Low cover is the same: on the game's four levels with low cover the tool finds a few more over the same floor, and about a quarter of the game's own have one of the tool's within 1 m, facing the same way (15 to 43% by level), where spots at random would two times in a hundred; most of the rest face a desk the game left out, or another side of the same one. Corpse traps sit on the right floor, in the right composite and facing away from their android every time; round the game's eight androids playing dead, about half of the game's corpse traps have one of the tool's within 0.5 m. The game's designers put theirs on the side the player comes from, closer together than the tool's even spread. For the game's NPCs what matters is that the spots cover the floor they hunt over, as the game's own do.

Testing in Game

Hide from the alien once it has seen you: it walks from search spot to search spot round where it lost you, stopping at each to look round, before it gives up. With the Debug Menu on, the alien's label shows its branch: a systematic search, or an area sweep while it stalks. A spot's task has selected_by_npc and task_end pins: link them to a DebugText to see which spots an NPC takes.

For AI Assistants

An AI assistant connected to OpenCAGE places markup with place_ai_markup (kinds: search, sweep, highcover, lowcover, corpsetrap, by default search, sweep and corpse traps; the spacings, keep_clear_of_existing, indoors_only, region, composite; dry_run lists the spots and what would be brought in; spots places spots it gives, a corpse trap going in the composite of the android playing dead beside it; compare runs the comparison above) and checks a level's markup with check_ai_markup (every piece, counts and spacing per kind, any that stand off the navmesh, and every android playing dead with how many corpse traps it has).