Docs/JSON

AI

Configure AI population, timing and map-specific behavior in ai.json.

API version 1Lua 5.1Updated 2026-11-07

Population director timings, NPC equip rolls and per-map scene/weapon weights. Live: /scenario reload applies it; NPCs already spawned keep their equipment.

Population caps (ai_max), Nomad counts, respawn time, spawn radius and spawn distance are NOT here: they stay in globals.json.

{
  "director": {
    "pool_refresh_seconds": 1800,
    "nomad_spawn_delay_seconds": [10, 60],
    "nomad_spawn_min_distance_m": 100,
    "initial_ambush_roll_below": 25,
    "initial_group_roll_below": 10
  },
  "equip": {
    "backpack_roll_max": 5,
    "attachment_roll_max": 5,
    "degraded_condition_range": [5, 50]
  },
  "maps": {
    "Village": {
      "director": {
        "pool_refresh_seconds": 900
      },
      "scenes": "export",
      "weapons": "export"
    }
  }
}

The values above (except the Village example, which is not shipped) are the shipped defaults and reproduce the server's built-in behaviour exactly.

director#

keyrangemeaning
pool_refresh_seconds30..86400how often the Nomad pool and Nomad cap are re-rolled (and hostile spawning is allowed again)
nomad_spawn_delay_seconds[min,max], 1..3600wait after a Nomad spawns before the next one: uniform in the range
nomad_spawn_min_distance_m0..5000Nomads never spawn closer than this to a player; the larger of this and ai_spawn_min_distance applies
initial_ambush_roll_below0..101when a bandit-type map starts, an Ambush AI spawns when IntN(101) < value (0 never, 101 always)
initial_group_roll_below0..101same for the starting Group

equip#

keyrangemeaning
backpack_roll_max-1..100an NPC gets a backpack when IntN(101) <= value (-1 never, 100 always)
attachment_roll_max-1..100same for a weapon attachment; variants that force an attachment still get one
degraded_condition_range[lo,hi], 0..100weapon condition of NPC variants that are not full-condition: uniform lo..hi

maps.<Map>#

The key is the area/map name. A director object overrides the global director key by key.

  • scenes: "export" (default) uses the scene the game exports for the map. A list [{ "scene": "res://AI/Bandit/AI_Bandit.tscn", "weight": 3 }] picks the scene of every hostile spawn by weight. Each scene must be a known AI archetype. Nomads keep their own scene. Whether a map is "bandit-type" (Nomads, Ambush and Group spawns) is decided by the exported scene only.
  • weapons: "export" (default) picks uniformly among the archetype's weapons. { "Makarov": 3, "AK-74": 1 } picks among those items by weight for all hostile scenes of the map (item names as in loot.json; each must be a weapon that the area's item export contains, otherwise the archetype weapons are used).

Layering#

director and equip merge key by key, maps per map then key by key, scenes/weapons replace as a whole ("export" in a later layer restores the default).

Not configurable#

Corpse lifetime (600 s), the scavenged loot cap (6), the five-point backpack roll count, Nomad trade rules, per-state AI behaviour rolls, archetype stats and accuracy (owned by the game export), AI factions, AI spawn point lists, and any minimum AI count: the director only caps ai_max, it never tops up.

Found a mistake or missing detail? Tell us in the Discord.