Car Forge: Procedural Car Generator and Traffic Fleet Kit
README.md
dents
Lasting dents for Car Forge cars through the crash car kit (crashCars 0.3.4 or later), on by default whenever crashCars is installed.
Dents.register(desc)turns a generated car's shape into a crashCars spec (length, overhangs, sill, bonnet, belt, roof and tail heights, windscreen and roof stations, rear style, mass) under a deterministic id on every peer.carForge.vehiclecalls it when a car is built.Dents.attach(root, desc)(owner, in play) gives the car a soft shell carrying its own body mesh and the stockCrashCarcrush lanes, and fits the rigid hull to the cabin (Dents.fitHull), so the car crumples where it is hit, keeps the dent and every player sees it. A 58 km/h wall hit crushes the front about 0.68 m and absorbs the car's ½mv².Dents.fitHull(root, desc)shrinks vehiclesKit's full-lengthvk_hullbox to the cabin (firewall to rear crush zone, 15 cm inside each side), the way crashCars builds its own chassis, so the lanes, not a rigid box, meet a wall.CarForgeCarcalls it on every peer once a shell exists.Dents.shellOf(root)finds the shell;Dents.available()says whether the hookup is on and crashCars is installed.Dents.enable(false)turns the hookup off for the whole game.Dents.kitis the function that loads crashCars; a test can replace it to stand in for a world without crashCars.
Cost policy. A shell is a soft body: about 12 to 16 ms of soft-body physics a step while it is awake, nothing once it sleeps. So only a car a player drives gets one: CarForgeCar attaches it the first time someone sits in the driver's seat, once per car. Parked, AI and showroom cars keep Car Forge's own damage stages.
Without crashCars (or with the hookup off), CarForgeCar's scratched, dented and wrecked stages swap in as the car takes hits.