five-on-it / apps/client/src/renderer/drone-view
apps/client/src/renderer/drone-view
The drones as the game draws them (GAME_DESIGN §12: the police's surveillance drone at five stars). A drone is a low-poly quadcopter about a metre across: a flat dark body (a little bluer when it is the police's) with its camera pod under the nose, four thin arms in an X, a rotor at the end of each, and a lamp under it that blinks red and blue in turn, unlit so it reads at night, with a glow round it that shows past the body from the camera above: the tell. Its shadow is a dark disc on whatever is under it (a roof, a deck, the street).
The snapshots come at 20 Hz; the frames at 60. Between two, a drone is carried on by its last velocity (for a quarter of a second at most, reckon), and where a new snapshot disagrees with where it was drawn, the difference is eased away (offsetLeft), so it never jumps. Flying, its rotors spin and it leans into its speed (leanFor). Shot down, a burst of sparks goes off at it, its rotors and its lamp stop, and it rolls over as it falls (fallTilt), spinning; a wreck lies where it fell, tilted, dark, with no shadow.
Every part of every drone is an instance of a mesh made once, so a drone costs no draw calls of its own, and a frame allocates nothing: the shadow's height is looked up again only once the drone has moved half a metre.