fix: adjust car size and positioning on roads

- Scale down car sprites to 70% size for better visual fit
- Offset cars to the right side of roads using perpendicular
  positioning instead of centering them on the road path
This commit is contained in:
Brian Fertig 2026-06-12 16:35:33 -06:00
parent 810c94da21
commit 4ab5ea108f
2 changed files with 7 additions and 10 deletions

View File

@ -1096,7 +1096,7 @@ export default class MiniMotorwaysGame extends Phaser.Scene {
const y = rr.py + (rr.cy - rr.py) * alpha + Math.sin(time * 0.011 + car.id) * 0.8; const y = rr.py + (rr.cy - rr.py) * alpha + Math.sin(time * 0.011 + car.id) * 0.8;
// Offset to the right side of the road (perpendicular to heading, right side) // Offset to the right side of the road (perpendicular to heading, right side)
const rightOffset = CELL * 0.12; const rightOffset = CELL * 0.12;
const rightAngle = rec.rot + Math.PI / 2; const rightAngle = rec.rot - Math.PI / 2;
rec.c.setPosition(x + rightOffset * Math.cos(rightAngle), y + rightOffset * Math.sin(rightAngle)); rec.c.setPosition(x + rightOffset * Math.cos(rightAngle), y + rightOffset * Math.sin(rightAngle));
rec.c.setVisible(true); rec.c.setVisible(true);
rec.c.setDepth(car.mw ? D.motorway + 0.5 : D.cars); rec.c.setDepth(car.mw ? D.motorway + 0.5 : D.cars);

View File

@ -23,8 +23,8 @@ export const TUNE = {
HEADWAY: 0.65, // minimum gap behind the car ahead, in cells HEADWAY: 0.65, // minimum gap behind the car ahead, in cells
DWELL_MS: 1000, DWELL_MS: 1000,
COOLDOWN_MS: 2000, COOLDOWN_MS: 2000,
PIN_MS_BASE: 18000, // pin interval = max(MIN, BASE * DECAY^week) PIN_MS_BASE: 12000, // pin interval = max(MIN, BASE * DECAY^week)
PIN_MS_DECAY: 0.94, PIN_MS_DECAY: 0.90,
PIN_MS_MIN: 3500, PIN_MS_MIN: 3500,
PIN_GRACE_MS: 15000, // new buildings wait this long before pin #1 PIN_GRACE_MS: 15000, // new buildings wait this long before pin #1
PIN_CAP: 12, PIN_CAP: 12,
@ -1010,13 +1010,10 @@ export class Sim {
const front = ddx * hx + ddy * hy; const front = ddx * hx + ddy * hy;
if (front <= 0.05) continue; if (front <= 0.05) continue;
const lat = Math.abs(-ddx * hy + ddy * hx); const lat = Math.abs(-ddx * hy + ddy * hx);
if (lat > 0.45) continue; // Opposite-direction cars pass freely regardless of lateral distance.
if (other.state !== 'dwell') { // Same-direction cars must be laterally separated enough to pass.
// Opposite-direction cars pass through each other — this is what keeps const dot = hx * Math.cos(other.heading) + hy * Math.sin(other.heading);
// a single road usable both ways without lane simulation. if (dot < 0.3 || lat > 0.6) continue;
const dot = hx * Math.cos(other.heading) + hy * Math.sin(other.heading);
if (dot < 0.3) continue;
}
allowed = Math.min(allowed, front - TUNE.HEADWAY); allowed = Math.min(allowed, front - TUNE.HEADWAY);
} }
return Math.max(0, allowed); return Math.max(0, allowed);