Skip to content

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 ​

addHire ​

Re-exports addHire


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


BILLBOARD ​

Re-exports BILLBOARD


billboardPlacements ​

Re-exports billboardPlacements


BLEND ​

Re-exports BLEND


blendsIn ​

Re-exports blendsIn


BOATS ​

Re-exports BOATS


boatsOn ​

Re-exports boatsOn


BRIDGE ​

Re-exports BRIDGE


bridgeOf ​

Re-exports bridgeOf


buildAiStatic ​

Re-exports buildAiStatic


calmSentries ​

Re-exports calmSentries


CAMERA ​

Re-exports CAMERA


CameraLoop ​

Re-exports CameraLoop


cameraSighting ​

Re-exports cameraSighting


CameraWatch ​

Re-exports CameraWatch


cannonProfile ​

Re-exports cannonProfile


canSee ​

Re-exports canSee


captivesOf ​

Re-exports captivesOf


CAR_HEAT ​

Re-exports CAR_HEAT


CarHeat ​

Re-exports CarHeat


carStars ​

Re-exports carStars


catchUpSchedule ​

Re-exports catchUpSchedule


ChaosBook ​

Re-exports ChaosBook


ChaosHooks ​

Re-exports ChaosHooks


chaosSystem ​

Re-exports chaosSystem


chaosView ​

Re-exports chaosView


chokeAt ​

Re-exports chokeAt


ChokeKind ​

Re-exports ChokeKind


Chokepoint ​

Re-exports Chokepoint


chokepointAhead ​

Re-exports chokepointAhead


CITIZENS ​

Re-exports CITIZENS


clampProfile ​

Re-exports clampProfile


CLASS_MIX ​

Re-exports CLASS_MIX


clawOn ​

Re-exports clawOn


clearCarHeat ​

Re-exports clearCarHeat


clearChaos ​

Re-exports clearChaos


clearCrowd ​

Re-exports clearCrowd


clearNpcs ​

Re-exports clearNpcs


clearTraffic ​

Re-exports clearTraffic


commuteAt ​

Re-exports commuteAt


COMPLIANCE_BOT_PROFILE ​

Re-exports COMPLIANCE_BOT_PROFILE


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


CruiserHack ​

Re-exports CruiserHack


DartLauncher ​

Re-exports DartLauncher


dartProfile ​

Re-exports dartProfile


DEFAULT_HIRE_HOOKS ​

Re-exports DEFAULT_HIRE_HOOKS


deployed ​

Re-exports deployed


DISTRICT_FORCE_STARS ​

Re-exports DISTRICT_FORCE_STARS


DISTRICT_FORCES ​

Re-exports DISTRICT_FORCES


districtForce ​

Re-exports districtForce


DistrictForce ​

Re-exports DistrictForce


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


endRiot ​

Re-exports endRiot


entryAt ​

Re-exports entryAt


FakeTip ​

Re-exports FakeTip


Film ​

Re-exports Film


FITTINGS ​

Re-exports FITTINGS


fleeRole ​

Re-exports fleeRole


GRAB ​

Re-exports GRAB


grapplerProfile ​

Re-exports grapplerProfile


GREEN_WAVE ​

Re-exports GREEN_WAVE


Gridlock ​

Re-exports Gridlock


HackedLight ​

Re-exports HackedLight


hashAiState ​

Re-exports hashAiState


HEAT_STARS ​

Re-exports HEAT_STARS


heatCap ​

Re-exports heatCap


heatCar ​

Re-exports heatCar


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


HIRE ​

Re-exports HIRE


HireHooks ​

Re-exports HireHooks


hiresOf ​

Re-exports hiresOf


HireState ​

Re-exports HireState


HOLDUP ​

Re-exports HOLDUP


HoldupState ​

Re-exports HoldupState


inFrame ​

Re-exports inFrame


inLight ​

Re-exports inLight


insideBuilding ​

Re-exports insideBuilding


inWater ​

Re-exports inWater


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


jammedAt ​

Re-exports jammedAt


Jammer ​

Re-exports Jammer


K9 ​

Re-exports K9


k9Actors ​

Re-exports k9Actors


K9State ​

Re-exports K9State


K9Unit ​

Re-exports K9Unit


KillSwitch ​

Re-exports KillSwitch


killSwitchLeft ​

Re-exports killSwitchLeft


knownIn ​

Re-exports knownIn


Laser ​

Re-exports Laser


LASER ​

Re-exports LASER


laserStep ​

Re-exports laserStep


lasing ​

Re-exports lasing


lawyerPrice ​

Re-exports lawyerPrice


lethalForce ​

Re-exports lethalForce


listCrowd ​

Re-exports listCrowd


listCrowdDogs ​

Re-exports listCrowdDogs


listNpcs ​

Re-exports listNpcs


listSentries ​

Re-exports listSentries


listTraffic ​

Re-exports listTraffic


looped ​

Re-exports looped


makeNoise ​

Re-exports makeNoise


MAX_STARS ​

Re-exports MAX_STARS


negotiate ​

Re-exports negotiate


NEGOTIATOR ​

Re-exports NEGOTIATOR


newLaser ​

Re-exports newLaser


NpcMode ​

Re-exports NpcMode


NpcPath ​

Re-exports NpcPath


NpcRoute ​

Re-exports NpcRoute


NpcState ​

Re-exports NpcState


onWater ​

Re-exports onWater


Pending ​

Re-exports Pending


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_FOAM ​

Re-exports POLICE_FOAM


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


PoliceRobot ​

Re-exports PoliceRobot


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


raiseBridgeNear ​

Re-exports raiseBridgeNear


removeNpc ​

Re-exports removeNpc


reportToPolice ​

Re-exports reportToPolice


resetPolice ​

Re-exports resetPolice


resetStealth ​

Re-exports resetStealth


responseAt ​

Re-exports responseAt


RESTRICTED ​

Re-exports RESTRICTED


Riot ​

Re-exports Riot


RIOT ​

Re-exports RIOT


Roadblock ​

Re-exports Roadblock


ROADBLOCKS ​

Re-exports ROADBLOCKS


roadTitle ​

Re-exports roadTitle


ROBOT_DOG_PROFILE ​

Re-exports ROBOT_DOG_PROFILE


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


ScoutDrone ​

Re-exports ScoutDrone


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


SHIELD_TURN ​

Re-exports SHIELD_TURN


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


startRiot ​

Re-exports startRiot


statsOf ​

Re-exports statsOf


STEALTH ​

Re-exports STEALTH


stealthReadout ​

Re-exports stealthReadout


stealthStats ​

Re-exports stealthStats


stealthView ​

Re-exports stealthView


stopSpot ​

Re-exports stopSpot


SwarmDrone ​

Re-exports SwarmDrone


SWAT ​

Re-exports SWAT


SWAT_PROFILES ​

Re-exports SWAT_PROFILES


SWAT_ROLES ​

Re-exports SWAT_ROLES


SWAT_STARS ​

Re-exports SWAT_STARS


swatActors ​

Re-exports swatActors


SwatMember ​

Re-exports SwatMember


SwatPhase ​

Re-exports SwatPhase


SwatRole ​

Re-exports SwatRole


SwatTeam ​

Re-exports SwatTeam


SwatThrow ​

Re-exports SwatThrow


switchSignal ​

Re-exports switchSignal


tailProfile ​

Re-exports tailProfile


takeArrests ​

Re-exports takeArrests


takeHostage ​

Re-exports takeHostage


Talk ​

Re-exports Talk


TalkChoice ​

Re-exports TalkChoice


TalkState ​

Re-exports TalkState


talkWith ​

Re-exports talkWith


TEAM_ROLES ​

Re-exports TEAM_ROLES


TECH ​

Re-exports TECH


TECH_DIVISION ​

Re-exports TECH_DIVISION


TechBook ​

Re-exports TechBook


techCommand ​

Re-exports techCommand


techDivisionAlone ​

Re-exports techDivisionAlone


techView ​

Re-exports techView


TechView ​

Re-exports TechView


TELLS ​

Re-exports TELLS


TRAFFIC ​

Re-exports TRAFFIC


TrafficCar ​

Re-exports TrafficCar


trafficReadout ​

Re-exports trafficReadout


TrafficReadoutRow ​

Re-exports TrafficReadoutRow


TrafficWalker ​

Re-exports TrafficWalker


TrailPoint ​

Re-exports TrailPoint


visibilityAt ​

Re-exports visibilityAt


Wanted ​

Re-exports Wanted


WANTED ​

Re-exports WANTED


WantedTech ​

Re-exports WantedTech


wantedView ​

Re-exports wantedView