Skip to content

five-on-it / packages/ai/src/wanted

packages/ai/src/wanted ​

The Wanted level (GAME_DESIGN §12): what each player's crimes add up to. A crime is read off the simulation's events of the last step and counts when somebody saw or heard it: gunfire near people (a pedestrian or a police officer within reach of the muzzle or of where the shot ends), hitting or killing a pedestrian (a car running one over too: the victim saw it), carjacking (the driver saw it), picking a car's lock in front of a witness, wrecking a car with people in it, blowing a car up where somebody sees or hears it (the car the player set alight, or one its blast lit in turn: @foi/sim's fire.ts keeps whose the fire is), and, dearer, hitting or killing a police officer or shooting at a police car; breaking property in front of a witness (a light piece of the level knocked loose, somebody else's car wrecked with nobody in it, a security camera shot to pieces), cheaper; walking or driving into a game's restricted zone that raises the Heat, in front of a witness (restricted.ts). Speeding past the police is a crime too, which the police system sees for itself (speedingCrime): an officer that notices a player going well over the road's limit. Only players commit crimes; what the NPCs do to each other is theirs.

Crimes raise the player's Heat, up to WANTED's cap, and the Heat crosses thresholds into stars, one to three. Out of police sight and without a new crime for a few seconds the Heat cools by one a second, never below the stars it holds; the stars come down one at a time only when no officer has seen the player (and no crime has been reported) for a while, longer at more stars: losing the police. Sitting on a bench out of sight, the player blends in: the Heat cools WANTED.sitCooling times as fast, sooner, and the stars come down in half the time. A respray in a garage clears the Wanted level, unless the police saw the player lately (resprayClears: they saw the car go in). Pure state and the rules that change it; the police system (police.ts) says who sees whom and acts on the stars. The book is part of the AI world and of its hash (hashAiState).

Interfaces ​

Type Aliases ​

Variables ​

Functions ​