cars: halve density and bias traffic toward motorways

This commit is contained in:
Richard Zink committed 2026-10-13 07:24:32 +02:00
1 parent 92bb9e651c
commit 06a6f3cf71
2 files changed
+11 -4

No files matched your search

+6 -3
View File
@@ -3453,8 +3453,11 @@ var CAR_M_DASH = carMetres(CAR_TUN.dashM || 620);
// drive slower -> 0.017 slots/s (~68 km/h at 1116 m spacing). Their peak
// density sits below the motorway peak and the gaussian falloff shapes it
// further by distance to the nearest motorway.
var CAR_M_SPEED = 0.055 * CAR_SPEED, CAR_M_DENS = 0.85 * CAR_DENS;
var CAR_B_DASH = CAR_M_DASH * 2.4, CAR_B_SPEED = 0.017 * CAR_SPEED, CAR_B_DENS = 0.85 * CAR_DENS;
var CAR_MOTORWAY_DENSITY = (typeof CAR_TUN.motorwayDensity === 'number') ? Math.max(0, Math.min(1.5, CAR_TUN.motorwayDensity)) : 0.95;
var CAR_SIDE_DENSITY = (typeof CAR_TUN.sideDensity === 'number') ? Math.max(0, Math.min(1.5, CAR_TUN.sideDensity)) : 0.35;
var CAR_SIDE_DASH_FACTOR = (typeof CAR_TUN.sideDashFactor === 'number') ? Math.max(1.0, Math.min(8.0, CAR_TUN.sideDashFactor)) : 3.2;
var CAR_M_SPEED = 0.055 * CAR_SPEED, CAR_M_DENS = CAR_MOTORWAY_DENSITY * CAR_DENS;
var CAR_B_DASH = CAR_M_DASH * CAR_SIDE_DASH_FACTOR, CAR_B_SPEED = 0.017 * CAR_SPEED, CAR_B_DENS = CAR_SIDE_DENSITY * CAR_DENS;
var carGeo = null; // { motorway: packedChains, secondary: packedChains }
var carVboM = null, carCountM = 0;
var carVboB = null, carCountB = 0;
@@ -4711,7 +4714,7 @@ function buildCarGeometry(chainsM, chainsB, ts, cfg, places) {
var mw = cfg.CAR_FLOOR + (1 - cfg.CAR_FLOOR) * Math.exp(-t * t);
// Side roads are sparse unless they are near the A-net or a town.
// Motorways/settlements get the bulk; remote secondary roads stay faint.
return Math.min(1, 0.20 + 0.55 * mw + 0.60 * st);
return Math.min(1, 0.12 + 0.72 * mw + 0.38 * st);
}
function build(polys, withField, dash) {
var li, i, segs = 0, totalLen = 0;