Car Forge: Procedural Car Generator and Traffic Fleet Kit
README.md
carShowcase: a Car Forge showroom with test drives
carShowcase turns any scene into a Car Forge showroom: a grid of procedural cars of one preset (seeds 1..48 by default) parked on display bays, each with a readable seed sign, and a "Take it for a drive" prompt on every car that drops the player into that exact car at a track start. Every peer builds the gallery itself from the seeds (Car Forge is deterministic), so nothing but the preset name crosses the network.
Views and coverage
The hall shows 48 cars side by side, one view at a time. There are 23 views: Every style & look (everyStyle, the scene's opening view) and the 22 Car Forge presets. Every style & look shows the 16 body styles three slots each, in Cars.styles() order, with the look cycling through low poly, toy, realistic and painted (12 cars per look), so one picture holds the whole range. Each preset view is Cars.describe(seed, { preset }) for seeds 1..48; the four looks turn up in every preset view, and across the presets 15 styles appear (coupe only in anyCar and the mixed view). Each car stands behind a lectern plaque: SEED #n, the view's name, then style (with service), look and number plate.
What a visitor does
- Switch the view (Every style & look plus 22 Car Forge presets): walk up to the < PREVIOUS PRESET / NEXT PRESET > kiosks in front of the grid and press the interact button (E, gamepad X / square, or the on-screen Interact button on a phone); or use the picker panel at the top of the screen (< / > arrows and an All presets grid, clickable with the mouse after Tab and tappable on a phone); or press [ / ] on a keyboard, LB / RB on a gamepad. The choice is one synced field, so every player sees the same row.
- Take a car out: stand at the front of any gallery car and press interact on Take it for a drive. The car is spawned as a real vehiclesKit car at the drive start and the player is put in the driver's seat (keyboard, gamepad and touch driving controls, cameras and HUD come from vehiclesKit). Taking another car removes that player's previous test car, so each player holds at most one.
Use it
-- in a scene's build.luau content()
local g = entity.spawnSynced("CarGallery") -- synced: the preset is shared
g.localPosition = { 0, 0.12, 0 } -- floor height of the grid
g.component.add("CarGallery", {
preset = "anyCar", count = 48, cols = 8, spacingX = 4.8, spacingZ = 10,
startX = 41.7, startY = 0.15, startZ = 58, startYaw = 0, -- where test cars appear
})
From code: require("~carShowcase.showcase").setPreset("townTaxi"), .step(1), .takeOut(Cars.describe(7, { preset = "coupe1970s" })); on the component :progress(), :describeSeed(seed), :takeOut(seed).
Parts
CarGallery.component: the grid, the signs, the per-car prompts, the kiosks and the title sign; buildsperFramecars a frame (2 by default; 48 cars take a few seconds and never stall a frame) and rebuilds whenpresetor the layout changes.showcase.module: preset switching from any peer (the owner writes the synced field, other peers ask it over a message), test-drive spawning into free start slots, and the on-screen picker.
Depends on carForge, vehiclesKit and interactKit.