cars: halve density and bias traffic toward motorways
This commit is contained in:
1 parent
92bb9e651c
commit
06a6f3cf71
2 files changed
+11
-4
No files matched your search
@@ -417,8 +417,11 @@ window.CONFIG = {
|
|||||||
spreadKm: 45, // gaussian sigma around the motorway network
|
spreadKm: 45, // gaussian sigma around the motorway network
|
||||||
spreadFloor: 0.30, // share that far side roads keep
|
spreadFloor: 0.30, // share that far side roads keep
|
||||||
speed: 1.0, // flow speed multiplier
|
speed: 1.0, // flow speed multiplier
|
||||||
density: 0.5, // vehicle density multiplier
|
density: 0.25, // vehicle density multiplier
|
||||||
brightness: 0.78, // vehicle light intensity (60 % of 1.3)
|
brightness: 0.78, // vehicle light intensity (60 % of 1.3)
|
||||||
|
motorwayDensity: 0.95, // share of the density budget on motorways/trunk
|
||||||
|
sideDensity: 0.35, // share of the density budget on primary/secondary/tertiary
|
||||||
|
sideDashFactor: 3.2, // wider spacing on side roads: fewer local cars
|
||||||
// Time-based traffic profile. Values are multipliers around the
|
// Time-based traffic profile. Values are multipliers around the
|
||||||
// configured density. Times are local scene-clock hours.
|
// configured density. Times are local scene-clock hours.
|
||||||
timeProfile: {
|
timeProfile: {
|
||||||
@@ -441,6 +444,7 @@ window.CONFIG = {
|
|||||||
// timeProfile: { morningGain: 0.8, eveningGain: 1.0, nightReduction: 0.85 }
|
// timeProfile: { morningGain: 0.8, eveningGain: 1.0, nightReduction: 0.85 }
|
||||||
}
|
}
|
||||||
// speed: 2.0, density: 0.6, brightness: 1.0
|
// speed: 2.0, density: 0.6, brightness: 1.0
|
||||||
|
// density: 0.25, motorwayDensity: 1.0, sideDensity: 0.25, sideDashFactor: 4.0
|
||||||
},
|
},
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|||||||
Vendored
+6
-3
@@ -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
|
// 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
|
// density sits below the motorway peak and the gaussian falloff shapes it
|
||||||
// further by distance to the nearest motorway.
|
// further by distance to the nearest motorway.
|
||||||
var CAR_M_SPEED = 0.055 * CAR_SPEED, CAR_M_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_B_DASH = CAR_M_DASH * 2.4, CAR_B_SPEED = 0.017 * CAR_SPEED, CAR_B_DENS = 0.85 * CAR_DENS;
|
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 carGeo = null; // { motorway: packedChains, secondary: packedChains }
|
||||||
var carVboM = null, carCountM = 0;
|
var carVboM = null, carCountM = 0;
|
||||||
var carVboB = null, carCountB = 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);
|
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.
|
// Side roads are sparse unless they are near the A-net or a town.
|
||||||
// Motorways/settlements get the bulk; remote secondary roads stay faint.
|
// 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) {
|
function build(polys, withField, dash) {
|
||||||
var li, i, segs = 0, totalLen = 0;
|
var li, i, segs = 0, totalLen = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user