five-on-it / packages/ai/src
packages/ai/src
@foi/ai: the NPC brains. The server builds one AI world beside its simulation (createAi), spawns chasers into it with a behaviour profile (spawnChaser) and runs aiSystem every tick before the simulation steps; each NPC perceives (sight, hearing, being hit), decides (idle, alert, chase, search, return), plans on the navigation grid or the road graph within a budget, and writes an ordinary input, so the character and vehicle systems move it like a player. The police (policeSystem, run before aiSystem) turn the players' crimes into a Wanted level and the stars into police cars of chasers with the police profile. The ambient traffic (setTraffic) is drivers of the same kind on the lanes, obeying the traffic lights and giving way at the junctions; the crowd (setCrowd) keeps pedestrians with roles on the pavements around the players (both around the AI world's standIns while nobody is in the room: a room warming up before its first player). The sentries of stealth (spawnSentry) walk their rounds and watch: a cone and hearing, the alert phases (normal, suspicious, alert, search, caution), the security cameras feeding them, the bodies they find; the book of stealth keeps the room's alert and each player's counts. The role NPCs (spawnRole: drivers, targets, VIPs; racers are drivers on a race) and the schedules by the room clock that send NPCs about the city and home; the restricted zones (setRestrictedZones) that raise the alert or the Heat; the signals a mission switches (switchSignal). The seat bots (addSeatBot, seat-bot.ts): AI players a run's room drives in the seats too few people came for (a chaser, a robber, a crew). The hold-ups (holdup.ts: a gun aimed from close, people complying or refusing), the hostages and the witnesses among the roles, the poses a mission tells an NPC to hold (setNpcDoing) and the noises it makes (makeNoise). Isomorphic (no DOM, no Node) and deterministic.
References
addSeatBot
Re-exports addSeatBot
AiBudget
Re-exports AiBudget
aimerAt
Re-exports aimerAt
aiReadout
Re-exports aiReadout
AiStatic
Re-exports AiStatic
aiStaticOf
Re-exports aiStaticOf
AiStats
Re-exports AiStats
aiSystem
Re-exports aiSystem
AiWorld
Re-exports AiWorld
alertSentries
Re-exports alertSentries
apcProfile
Re-exports apcProfile
Arrest
Re-exports Arrest
AWARENESS
Re-exports AWARENESS
BehaviourProfile
Re-exports BehaviourProfile
BOATS
Re-exports BOATS
boatsOn
Re-exports boatsOn
buildAiStatic
Re-exports buildAiStatic
calmSentries
Re-exports calmSentries
CAMERA
Re-exports CAMERA
cameraSighting
Re-exports cameraSighting
CameraWatch
Re-exports CameraWatch
cannonProfile
Re-exports cannonProfile
canSee
Re-exports canSee
catchUpSchedule
Re-exports catchUpSchedule
chokeAt
Re-exports chokeAt
ChokeKind
Re-exports ChokeKind
Chokepoint
Re-exports Chokepoint
chokepointAhead
Re-exports chokepointAhead
clampProfile
Re-exports clampProfile
CLASS_MIX
Re-exports CLASS_MIX
clearCrowd
Re-exports clearCrowd
clearNpcs
Re-exports clearNpcs
clearTraffic
Re-exports clearTraffic
commuteAt
Re-exports commuteAt
createAi
Re-exports createAi
createHeavyBook
Re-exports createHeavyBook
CrimeKind
Re-exports CrimeKind
crimesOf
Re-exports crimesOf
CROWD
Re-exports CROWD
CROWD_HOURS
Re-exports CROWD_HOURS
crowdReadout
Re-exports crowdReadout
crowdShare
Re-exports crowdShare
crowdWanted
Re-exports crowdWanted
cruiserCost
Re-exports cruiserCost
DartLauncher
Re-exports DartLauncher
dartProfile
Re-exports dartProfile
dogReadout
Re-exports dogReadout
doingNow
Re-exports doingNow
Driver
Re-exports Driver
driverOf
Re-exports driverOf
DRONES
Re-exports DRONES
droneSees
Re-exports droneSees
dronesOn
Re-exports dronesOn
entryAt
Re-exports entryAt
FITTINGS
Re-exports FITTINGS
fleeRole
Re-exports fleeRole
grapplerProfile
Re-exports grapplerProfile
GREEN_WAVE
Re-exports GREEN_WAVE
Gridlock
Re-exports Gridlock
hashAiState
Re-exports hashAiState
HEAT_STARS
Re-exports HEAT_STARS
heatCap
Re-exports heatCap
HEAVY
Re-exports HEAVY
HEAVY_UNITS
Re-exports HEAVY_UNITS
HeavyBook
Re-exports HeavyBook
HeavyUnit
Re-exports HeavyUnit
HELICOPTER
Re-exports HELICOPTER
helicopterSees
Re-exports helicopterSees
helicoptersOn
Re-exports helicoptersOn
HOLDUP
Re-exports HOLDUP
HoldupState
Re-exports HoldupState
inFrame
Re-exports inFrame
inLight
Re-exports inLight
isCruiserUnit
Re-exports isCruiserUnit
isEscalation
Re-exports isEscalation
isGrounded
Re-exports isGrounded
isOfficer
Re-exports isOfficer
isPoliceCar
Re-exports isPoliceCar
isProfileName
Re-exports isProfileName
isSolo
Re-exports isSolo
Laser
Re-exports Laser
LASER
Re-exports LASER
laserStep
Re-exports laserStep
lasing
Re-exports lasing
listCrowd
Re-exports listCrowd
listCrowdDogs
Re-exports listCrowdDogs
listNpcs
Re-exports listNpcs
listSentries
Re-exports listSentries
listTraffic
Re-exports listTraffic
makeNoise
Re-exports makeNoise
MAX_STARS
Re-exports MAX_STARS
newLaser
Re-exports newLaser
NpcMode
Re-exports NpcMode
NpcPath
Re-exports NpcPath
NpcRoute
Re-exports NpcRoute
NpcState
Re-exports NpcState
onWater
Re-exports onWater
phaseRank
Re-exports phaseRank
PHOTO
Re-exports PHOTO
placeName
Re-exports placeName
pointAlong
Re-exports pointAlong
POLICE
Re-exports POLICE
POLICE_CAMERAS
Re-exports POLICE_CAMERAS
POLICE_LADDER
Re-exports POLICE_LADDER
POLICE_POST
Re-exports POLICE_POST
POLICE_RESPONSE
Re-exports POLICE_RESPONSE
policeActors
Re-exports policeActors
PoliceBoat
Re-exports PoliceBoat
PoliceBook
Re-exports PoliceBook
PoliceDrone
Re-exports PoliceDrone
PoliceHelicopter
Re-exports PoliceHelicopter
PoliceHooks
Re-exports PoliceHooks
PoliceMarkKind
Re-exports PoliceMarkKind
policeOrder
Re-exports policeOrder
policeProfile
Re-exports policeProfile
PoliceSniper
Re-exports PoliceSniper
policeSystem
Re-exports policeSystem
policeTells
Re-exports policeTells
PoliceTells
Re-exports PoliceTells
PoliceUnit
Re-exports PoliceUnit
PoliceUnitKind
Re-exports PoliceUnitKind
poseNow
Re-exports poseNow
PoseOrder
Re-exports PoseOrder
PRECRIME
Re-exports PRECRIME
PredictedRoute
Re-exports PredictedRoute
predictRoute
Re-exports predictRoute
PROFILE_NAMES
Re-exports PROFILE_NAMES
ProfileName
Re-exports ProfileName
PROFILES
Re-exports PROFILES
raceDistance
Re-exports raceDistance
RaceState
Re-exports RaceState
RADIO
Re-exports RADIO
RADIO_KINDS
Re-exports RADIO_KINDS
RadioEntry
Re-exports RadioEntry
RadioKind
Re-exports RadioKind
radioSighting
Re-exports radioSighting
removeNpc
Re-exports removeNpc
reportToPolice
Re-exports reportToPolice
resetPolice
Re-exports resetPolice
resetStealth
Re-exports resetStealth
responseAt
Re-exports responseAt
RESTRICTED
Re-exports RESTRICTED
Roadblock
Re-exports Roadblock
ROADBLOCKS
Re-exports ROADBLOCKS
roadTitle
Re-exports roadTitle
ROLE_MIX
Re-exports ROLE_MIX
RoleKind
Re-exports RoleKind
ROLES
Re-exports ROLES
rolesReadout
Re-exports rolesReadout
roleWeights
Re-exports roleWeights
RollingBlock
Re-exports RollingBlock
RoofSpot
Re-exports RoofSpot
roofSpots
Re-exports roofSpots
roomAlert
Re-exports roomAlert
RouteNode
Re-exports RouteNode
routeOfDriver
Re-exports routeOfDriver
RoutePoint
Re-exports RoutePoint
ROUTINE_MIX
Re-exports ROUTINE_MIX
ROUTINE_SHARE
Re-exports ROUTINE_SHARE
routineWeights
Re-exports routineWeights
RURAL_MIX
Re-exports RURAL_MIX
SCHEDULE
Re-exports SCHEDULE
ScheduleEntry
Re-exports ScheduleEntry
SEAT_BOT
Re-exports SEAT_BOT
SEAT_BRAINS
Re-exports SEAT_BRAINS
SEAT_PROFILES
Re-exports SEAT_PROFILES
SeatBotState
Re-exports SeatBotState
SeatBrain
Re-exports SeatBrain
sendPoliceUnit
Re-exports sendPoliceUnit
SENTRY
Re-exports SENTRY
setCrowd
Re-exports setCrowd
setNpcDoing
Re-exports setNpcDoing
setPoliceSpawns
Re-exports setPoliceSpawns
setRestrictedZones
Re-exports setRestrictedZones
setSeatBotGoals
Re-exports setSeatBotGoals
setTraffic
Re-exports setTraffic
setWantedStars
Re-exports setWantedStars
shopsOpen
Re-exports shopsOpen
SightSource
Re-exports SightSource
signalOverrides
Re-exports signalOverrides
sniperRoof
Re-exports sniperRoof
SNIPERS
Re-exports SNIPERS
spawnChaser
Re-exports spawnChaser
spawnRole
Re-exports spawnRole
spawnSentry
Re-exports spawnSentry
spawnTrafficCar
Re-exports spawnTrafficCar
STAR_NAMES
Re-exports STAR_NAMES
StarName
Re-exports StarName
StarResponse
Re-exports StarResponse
starsFor
Re-exports starsFor
startRace
Re-exports startRace
statsOf
Re-exports statsOf
STEALTH
Re-exports STEALTH
stealthReadout
Re-exports stealthReadout
stealthStats
Re-exports stealthStats
stealthView
Re-exports stealthView
switchSignal
Re-exports switchSignal
tailProfile
Re-exports tailProfile
takeArrests
Re-exports takeArrests
takeHostage
Re-exports takeHostage
TELLS
Re-exports TELLS
TRAFFIC
Re-exports TRAFFIC
TrafficCar
Re-exports TrafficCar
trafficReadout
Re-exports trafficReadout
TrafficReadoutRow
Re-exports TrafficReadoutRow
TrafficWalker
Re-exports TrafficWalker
visibilityAt
Re-exports visibilityAt
Wanted
Re-exports Wanted
WANTED
Re-exports WANTED
wantedView
Re-exports wantedView