# AI ships out in the world (design 24.6 and 10.1, step 33a). Read at startup by the game and the
# server (src/sim/ships/Traffic.cpp).
#
# Every live system has its traffic: pirates, patrols and haulers. The server keeps each one as a
# record moving along the system's lanes (between the station, the gates, the worlds and the belts),
# made from the system's seed. Near a player a record becomes a real ship, built from its layout
# (assets/data/layouts/) and flown by the AI pilot in that player's game; once nobody is near it
# goes back to a record, keeping its damage.
#
# [traffic Settings]
#   tick            seconds between steps of the records
#   real range      m: a record becomes a ship within this of a player
#   release range   m: a ship goes back to a record once every player is further than this
#   cap             the most real AI ships near one player (design 25's AI caps)
#   cruise speed    m/s along a lane between places (quantum cruise)
#   shortest cruise s a trip between places takes at least
#   respawn         s before a lost ship's place in the system is taken by a newcomer
#   list interval   s between the traffic lists sent to each player (the star map's contacts)
#
# [lanes Rules]
#   lurk spots      pirate lurk spots along the lanes, at most
#   lurk keep out   m: no lurk spot nearer than this to the station or the start world
#   world height    m above a world's air where its lane ends
#   belt height     m above a belt's middle where its lane ends
#   station off     m off the station where its lane ends (its holding area)
#   gate off        m beside a gate's rim where its lane ends (clear of its pull)
#   depot height    m over a fuel depot's deck where its lane ends (depots.txt)
#
# [kind KEY]        what flies: Pirate, Patrol, Hauler
#   name            as shown (a patrol's is put after its holder's name: "Gate authority patrol")
#   team            0 sides with the players; ships of other teams are enemies
#   passive         yes: never picks a fight, and runs when shot at
#   hidden          yes: shows as an unknown ship until scanned or it attacks someone
#   layouts         ship layouts (assets/data/layouts/NAME.txt), one picked per ship. A corvette
#                   (a layout with a corvette core) leads its pack; a patrol corvette guards a gate
#                   rather than going the rounds; corvettes don't land on pads. A layout named
#                   twice comes up twice as often. Each side wears its colours: pirates black
#                   and red, patrols white and blue, haulers grey and yellow
#   layouts KEY     the same in a nation's systems (a galaxy.txt nation key, or Syndicate for the
#                   Syndicate's): its own ships (step 37f, written by tools/ships/nation_ships.py),
#                   in its paint, hull finish, running lights and engine glow. The start system
#                   and systems outside the galaxy fly the stock ones. `layouts Hub` wins at a trunk
#                   hub, where every nation's ships pass through
#   skill           its pilots' skill, lowest and highest (0 to 1)
#   damage          times a cannon's damage per bolt
#   nerve           its pilots' nerve, lowest and highest (step 33c): a pilot runs once its fear
#                   (the share of its health lost, and more when outnumbered) reaches its nerve,
#                   less a share per wingman lost and more with its leader near ([behaviour Rules]).
#                   Above 1 it never runs on its health alone
#   hail            what its pilots say when they hail a player's ship before attacking, one line
#                   picked per hail, lines split by '|' (none: they attack without a word)
#   yield           what one says once disabled, giving up ("let us go")
#   answer          what one says when a player hails it (the dock key with it in the target lock, or
#                   from a communications array)
#   mayday          what one says calling for help when it's attacked
#   roam            how it moves between places: lurk (lurk spots and belts), patrol (the station
#                   and the gates, in turn) or haul (any place along the lanes from where it is)
#   stay            s it stays at a place, shortest and longest
#   radius          m it circles round the place while there
#   speed           m/s it flies about at while there
#
# [behaviour Rules] how pilots fight (step 33c)
#   wingman         nerve lost for each ship of its pack lost
#   leader          nerve gained while its pack's leader is near (the leader doesn't gain it)
#   leader range    m: how near that is
#   outnumbered     fear for each enemy near beyond its friends near
#   near            m: who counts as near, friend or enemy
#   rally           a pilot that ran turns back once its fear is this far below its nerve
#   help            m: a patrol comes to the help of a ship that pirates attack this near
#   spacing         m between the ships of a pack or a patrol in formation
#   form up         m: wingmen keep formation until their target is this near, then break to attack
#   yield seconds   s a disabled ship waits to be let go (K) before it's left as a wreck for salvage
#   run away        m: a ship of the traffic that ran this far from what it fought jumps away
#
# [clearance Rules] traffic control at the station's hangar and research outposts' pads (step 33d)
#   range           m: a place answers a ship asking for clearance (K) this near
#   land within     s a ship cleared to a pad has to land on it before the pad goes back
#   depart within   s a ship cleared to depart has to lift off
#   clear within    s a ship that landed without clearance is given to clear the pad
#   hold off        s an AI ship that found no pad free waits nearby before asking again
#   tries           times it asks before it goes on somewhere else
#   keep free       pads an AI ship is never given (kept for players)
#   outpost visit   the odds a hauler staying at a world goes down to a known outpost's pad instead
#   port visit      the odds a hauler staying at a world goes down to a known city spaceport's bays
#
# [holder KEY]      how much of each flies in a system its holder holds (gates.txt's holders)
#   pirates, patrols, haulers

[traffic Settings]
tick = 0.5
real range = 6000
release range = 8000
cap = 6
cruise speed = 9000
shortest cruise = 25
respawn = 240
list interval = 1

[lanes Rules]
lurk spots = 6
lurk keep out = 40000
world height = 4000
belt height = 400
station off = 1500
gate off = 900
depot height = 250

[behaviour Rules]
wingman = 0.2
leader = 0.15
leader range = 1500
outnumbered = 0.1
near = 2000
rally = 0.15
help = 8000
spacing = 40
form up = 1500
yield seconds = 20
run away = 2500

[clearance Rules]
range = 5000
land within = 180
depart within = 60
clear within = 60
hold off = 20
tries = 3
keep free = 1
outpost visit = 0.4
port visit = 0.85

[kind Pirate]
name = Pirate
team = 1
hidden = yes
layouts = dart, raider, striker, brute, bomber, dart, raider, pirate_corvette
layouts Syndicate = syndicate_raider, syndicate_raider, dart, raider, striker, pirate_corvette
skill = 0.35, 0.6
damage = 0.5
nerve = 0.3, 0.5
hail = Cut your engines and dump your hold. Now. | Nice ship. It's ours. Power down or we cut you out of it. | You're on our lane. Pay the toll or bleed for it.
answer = Wrong channel, friend. Keep flying. | Nobody here you want to talk to. | You lost? Keep it that way.
yield = We're dead in space! We yield, let us limp home. | Don't shoot! Drives are gone, we give up. | Enough! You win. Let us go and you won't see us again.
roam = lurk
stay = 300, 900
radius = 500
speed = 45

[kind Patrol]
name = patrol
team = 0
layouts = lancer, warden, lancer, patrol_corvette
layouts Republic = republic_patrol, republic_patrol, lancer, patrol_corvette
layouts Ascendancy = ascendancy_patrol, ascendancy_patrol, ascendancy_patrol, patrol_corvette
layouts Hives = hive_patrol, hive_patrol, hive_patrol, patrol_corvette
layouts Concord = concord_patrol, concord_patrol, concord_patrol, patrol_corvette
layouts Dominion = dominion_patrol, dominion_patrol, dominion_patrol, patrol_corvette
layouts Reaches = reaches_patrol, reaches_patrol, reaches_patrol, warden
layouts Syndicate = syndicate_raider, syndicate_raider, reaches_patrol
layouts Hub = concord_patrol, republic_patrol, ascendancy_patrol, hive_patrol, dominion_patrol, patrol_corvette
skill = 0.55, 0.8
damage = 1
nerve = 1.1, 1.3
answer = Patrol here. Fly safe and keep your transponder on. | Go ahead, we read you. All quiet on this lane. | Patrol copies. Report trouble to traffic control.
yield = Disabled. Holding position for recovery.
roam = patrol
stay = 90, 240
radius = 1100
speed = 70

[kind Hauler]
name = Hauler
team = 0
passive = yes
layouts = courier, freighter
layouts Republic = republic_hauler, courier, freighter
layouts Ascendancy = ascendancy_hauler, ascendancy_hauler, freighter
layouts Hives = hive_hauler, hive_hauler, freighter
layouts Concord = concord_hauler, concord_hauler, courier
layouts Dominion = dominion_hauler, dominion_hauler, freighter
layouts Reaches = reaches_hauler, reaches_hauler, courier
layouts Syndicate = reaches_hauler, courier
layouts Hub = republic_hauler, ascendancy_hauler, hive_hauler, concord_hauler, dominion_hauler, reaches_hauler
skill = 0.3, 0.5
damage = 0.5
nerve = 0, 0
mayday = Mayday, mayday! Pirates on us, any ship near, help! | We're under attack! Anyone out there, please! | Hauler calling for help, pirates on our tail!
answer = Hauler here. Full hold and a tight schedule, safe flying. | We read you. Seen any pirates on this lane? | Go ahead. Just hauling, same as every day.
yield = Drives are out. Just let us drift, please.
roam = haul
stay = 120, 360
radius = 400
speed = 35

[holder Charter]
pirates = 2
patrols = 2
haulers = 3

[holder Authority]
pirates = 3
patrols = 4
haulers = 4

[holder Company]
pirates = 4
patrols = 2
haulers = 5

[holder Frontier]
pirates = 6
patrols = 0
haulers = 2

[holder Contested]
pirates = 6
patrols = 3
haulers = 2

[holder Outpost]
pirates = 4
patrols = 1
haulers = 2

[holder Syndicate]
pirates = 7
patrols = 0
haulers = 3
