Skip to content

five-on-it / packages/ai/src/seat-bot

packages/ai/src/seat-bot ​

Stand-ins for players (seat bots): the AI players a lobby fills a run's empty seats with when too few people came (apps/api/src/lobbies.ts), run by the server alone. A seat bot is a player's body (the run's room spawned it as it spawns a player, at the wheel of a car at its team's spawn, in its team's party), driven by an NPC brain that writes an ordinary PlayerInput as every NPC does, from the AI's own random stream. Its brain is one of three:

  • chaser: the chaser of chaser.ts after the nearest live player of another team (a robber), tracking them as a radio would, boxing their car in once it stops, getting out to stand by them on foot: what a catch objective counts. It never shoots.
  • robber: to the places of its mission's objectives in turn (goals, which the room sets from the mission: the loot, then the hideout), at the wheel while it is in a car (getting out a few metres from a place to walk to it), pressing the interaction key at each place (picking the loot up), taking a free car on the way when the next place is far, and running from a chaser on foot within SEAT_BOT.fleeRange.
  • crew: with the nearest human of its team: riding as their passenger while they drive (getting out of its own car to board theirs), keeping within SEAT_BOT.followRange on foot, and shooting the mission's enemies (and players of other teams) it sees with the pistol (arms.ts), from the window too.

Down (knocked down, or dead and waiting for the simulation to bring it back at its spawn as it does a player) it lets go of every key. Its state is hashed with the other NPCs' (hashAiState): a seat bot is an input like any other, so the determinism gate covers it.

Interfaces ​

Type Aliases ​

Variables ​

Functions ​