Skip to content

five-on-it / packages/ai/src/nail-strips

packages/ai/src/nail-strips ​

The police's nail strips (GAME_DESIGN §12, three stars): laid across the road ahead of a wanted player who drives, where the roads take them, and picked up again once they have passed it or after a while. Where: walking the road graph from the player's car the way it goes, the first junction (a node where three roads or more meet) between STRIPS.ahead and .reach along the roads, a few metres before it on the road the player comes along, so whichever way they mean to turn they cross it; with no junction in reach (a loop of road, a long avenue), the first node past .ahead. A node nearer than that where the roads part is the player's choice: nothing is laid until they have made it. The strip spans the whole road, both ways. The strips are the simulation's (@foi/sim's nails.ts: entities the snapshots carry, popping any tyre that rolls over them); the book keeps whose each is.

A strip comes with its unit: a police car parked at the kerb on the right of the traffic, a few metres back, and an officer on the kerb by the strip's end, facing the road, who throws it (throw): it unrolls across the road in about a second (STRIPS.deploySeconds). Once the player has passed it (or the time is up, or the stars came down) the officer reels it in (pickup) the same way, and the unit goes once no player is near (STRIPS.leave). The officer is the police's (hurting one is dear) and stands where it was put; the car is parked, anyone's to take, and stays if a player drives off in it. Deterministic: players in client order, the graph walked by node ids.

Interfaces ​

Variables ​

Functions ​