From 13412642aa9d81402cc0e0c2732460efa82a8e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Tue, 13 Oct 2026 23:46:03 +0300 Subject: [PATCH 01/18] feat(neon): deterministic vehicle physics, traffic signals, road-grid police pursuit, pedestrians --- experiments/neon-streets/world-sim.mjs | 168 +++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 experiments/neon-streets/world-sim.mjs diff --git a/experiments/neon-streets/world-sim.mjs b/experiments/neon-streets/world-sim.mjs new file mode 100644 index 0000000..8e16a4f --- /dev/null +++ b/experiments/neon-streets/world-sim.mjs @@ -0,0 +1,168 @@ +// Standalone, deterministic world simulation. No DOM or canvas dependency. +// Keep this module independent of mission state so parallel mission work can integrate cleanly. +export const CITY = 2500; +export const BLOCK = 250; +export const ROAD = 76; +export const MAX_SPEED = 290; +const TAU = Math.PI * 2; +export const clamp = (value, low, high) => Math.max(low, Math.min(high, value)); +export const distance = (a, b) => Math.hypot(a.x - b.x, a.y - b.y); +const roadOffset = coordinate => Math.abs(((coordinate + BLOCK / 2) % BLOCK + BLOCK) % BLOCK - BLOCK / 2); + +export function isRoad(x, y, margin = 0) { + if (!Number.isFinite(x) || !Number.isFinite(y) || x < 0 || y < 0 || x > CITY || y > CITY) return false; + return roadOffset(x) < ROAD / 2 - margin || roadOffset(y) < ROAD / 2 - margin; +} +export function canDrive(x, y, radius = 11) { + if (x < radius || y < radius || x > CITY - radius || y > CITY - radius) return false; + return [[-radius,-radius],[-radius,radius],[radius,-radius],[radius,radius]].every(([dx,dy]) => isRoad(x + dx,y + dy)); +} +export function makeVehicle(x = 500, y = 500, angle = -Math.PI / 2) { + return { x, y, angle, speed: 0, impactCooldown: 0 }; +} +// Integrate in bounded steps so a low frame rate cannot tunnel through buildings. +export function stepVehicle(vehicle, controls, dt) { + dt = clamp(Number.isFinite(dt) ? dt : 0, 0, .12); + const input = clamp(controls.throttle || 0, -1, 1); + const steer = clamp(controls.steer || 0, -1, 1); + const handbrake = !!controls.handbrake; + const oldSpeed = vehicle.speed; + const acceleration = input * (input * vehicle.speed < 0 ? 510 : (input < 0 ? 225 : 320)); + vehicle.speed = clamp(vehicle.speed + acceleration * dt, -130, MAX_SPEED); + vehicle.speed *= Math.exp(-(handbrake ? 4.3 : (input ? .26 : 1.9)) * dt); + if (!input && Math.abs(vehicle.speed) < 1) vehicle.speed = 0; + const steerScale = Math.min(1, Math.abs(vehicle.speed) / 75); + vehicle.angle += steer * 2.45 * steerScale * Math.sign(vehicle.speed || 1) * dt; + vehicle.angle = (vehicle.angle + TAU) % TAU; + const steps = Math.max(1, Math.ceil(Math.abs(vehicle.speed * dt) / 6)); + const stepX = Math.cos(vehicle.angle) * vehicle.speed * dt / steps; + const stepY = Math.sin(vehicle.angle) * vehicle.speed * dt / steps; + let collided = false; + for (let i = 0; i < steps; i++) { + if (canDrive(vehicle.x + stepX, vehicle.y + stepY)) { + vehicle.x += stepX; + vehicle.y += stepY; + } else { + vehicle.speed = -oldSpeed * .13; + collided = true; + break; + } + } + vehicle.impactCooldown = Math.max(0, (vehicle.impactCooldown || 0) - dt); + return { collided, impactSpeed: Math.abs(oldSpeed) }; +} +const PAINTS = ['#f6be70','#b16bba','#82caca','#80b66f','#cdd0e2','#dc7c83','#f0d180']; +export function createTraffic(count = 26) { + return Array.from({ length: count }, (_, i) => { + const horizontal = i % 2 === 0; + const sign = i % 4 < 2 ? 1 : -1; + const row = 1 + ((i * 7 + 3) % 9); + const col = 1 + ((i * 11 + 5) % 9); + const progress = ((i * 173 + 89) % (CITY - 220)) + 100; + return { + id: i, x: horizontal ? progress : col * BLOCK - sign * 17, + y: horizontal ? row * BLOCK + sign * 17 : progress, + axis: horizontal ? 'x' : 'y', sign, speed: 58 + (i * 17 % 47), + angle: horizontal ? (sign > 0 ? 0 : Math.PI) : (sign > 0 ? Math.PI / 2 : -Math.PI / 2), + tint: PAINTS[i % PAINTS.length], wait: 0, turnAt: -1, emergency: false + }; + }); +} +function wrapTraffic(t) { + // Wrap at the boundary without leaving the drivable lanes. + if (t.axis === 'x') { + if (t.x > CITY - 18) t.x = 18; + if (t.x < 18) t.x = CITY - 18; + } else { + if (t.y > CITY - 18) t.y = 18; + if (t.y < 18) t.y = CITY - 18; + } +} +export function stepTraffic(traffic, dt, seconds, player) { + dt = clamp(dt, 0, .08); + for (const t of traffic) { + const coordinate = t.axis === 'x' ? t.x : t.y; + const cross = Math.round(coordinate / BLOCK) * BLOCK; + const nextCross = t.sign > 0 ? Math.ceil((coordinate + 1) / BLOCK) * BLOCK : Math.floor((coordinate - 1) / BLOCK) * BLOCK; + const approach = (nextCross - coordinate) * t.sign; + const lane = t.axis === 'x' ? t.y : t.x; + const crossStreet = Math.round(lane / BLOCK) * BLOCK; + const red = (Math.floor(seconds / 6 + (Math.round(nextCross / BLOCK) + Math.round(crossStreet / BLOCK)) % 2) % 2) === (t.axis === 'x' ? 0 : 1); + let blocked = false; + if (approach > 5 && approach < 48 && red) blocked = true; + if (player && Math.hypot(player.x - t.x, player.y - t.y) < 48) blocked = true; + for (const other of traffic) { + if (other === t || other.axis !== t.axis || other.sign !== t.sign) continue; + const lateral = Math.abs((t.axis === 'x' ? other.y - t.y : other.x - t.x)); + const forward = (t.axis === 'x' ? other.x - t.x : other.y - t.y) * t.sign; + if (lateral < 10 && forward > 0 && forward < 43) { blocked = true; break; } + } + const desired = blocked ? 0 : t.speed; + t.wait = clamp(t.wait + (desired - t.wait) * Math.min(1, dt * (blocked ? 5 : 2.4)), 0, t.speed); + const movement = t.sign * t.wait * dt; + if (t.axis === 'x') t.x += movement; + else t.y += movement; + wrapTraffic(t); + } +} +// Road-grid navigation means pursuers turn at intersections rather than drive through buildings. +export function createPolice(player, id = 0) { + const px = clamp(Math.round(player.x / BLOCK) * BLOCK + (id % 2 ? -2 : 2) * BLOCK, BLOCK, CITY - BLOCK); + const py = clamp(Math.round(player.y / BLOCK) * BLOCK + (id % 2 ? 1 : -1) * BLOCK, BLOCK, CITY - BLOCK); + return { id, x: px, y: py, dir: id % 2 ? 1 : 0, speed: 135 + id * 16, tint: '#4d95f5', angle: 0, siren: 0 }; +} +const DIRS = [[1,0],[0,1],[-1,0],[0,-1]]; +export function stepPolice(police, player, dt) { + dt = clamp(dt, 0, .08); + for (const p of police) { + const gx = Math.round(p.x / BLOCK) * BLOCK, gy = Math.round(p.y / BLOCK) * BLOCK; + if (Math.hypot(p.x - gx, p.y - gy) < p.speed * dt + 1) { + p.x = gx; p.y = gy; + const dx = player.x - p.x, dy = player.y - p.y; + const preferX = Math.abs(dx) > Math.abs(dy); + let target = preferX ? (dx >= 0 ? 0 : 2) : (dy >= 0 ? 1 : 3); + const alt = preferX ? (dy >= 0 ? 1 : 3) : (dx >= 0 ? 0 : 2); + const v = DIRS[target]; + if (p.x + v[0] * BLOCK < 0 || p.x + v[0] * BLOCK > CITY || + p.y + v[1] * BLOCK < 0 || p.y + v[1] * BLOCK > CITY) target = alt; + p.dir = target; + } + const [dx,dy] = DIRS[p.dir]; + p.x = clamp(p.x + dx * p.speed * dt, 0, CITY); + p.y = clamp(p.y + dy * p.speed * dt, 0, CITY); + p.angle = Math.atan2(dy, dx); + p.siren += dt * 8; + } +} +export function collidePlayerWithActors(player, traffic, police) { + if ((player.impactCooldown || 0) > 0) return { impact: false, police: false }; + const policeHit = police.some(p => distance(player,p) < 27); + const trafficHit = traffic.some(t => distance(player,t) < 26); + if (policeHit || trafficHit) { + player.speed *= -.22; + player.impactCooldown = .85; + } + return { impact: policeHit || trafficHit, police: policeHit }; +} +export function createPedestrians(count = 35) { + return Array.from({ length: count }, (_, i) => { + const horizontal = i % 2 === 0; + const row = 1 + ((i * 7 + 1) % 9), col = 1 + ((i * 13 + 2) % 9); + const side = i % 4 < 2 ? 1 : -1; + return { + x: horizontal ? 80 + ((i * 137) % 2320) : col * BLOCK + side * 59, + y: horizontal ? row * BLOCK + side * 59 : 80 + ((i * 179) % 2320), + horizontal, direction: i % 3 ? 1 : -1, speed: 12 + (i * 7 % 14), + color: PAINTS[(i + 3) % PAINTS.length] + }; + }); +} +export function stepPedestrians(pedestrians, dt) { + for (const p of pedestrians) { + if (p.horizontal) p.x += p.direction * p.speed * dt; + else p.y += p.direction * p.speed * dt; + if (p.x < 55 || p.x > CITY - 55 || p.y < 55 || p.y > CITY - 55) p.direction *= -1; + p.x = clamp(p.x,55,CITY-55); + p.y = clamp(p.y,55,CITY-55); + } +} From e2655daf333e8ef77e1c4849a48ef98f88e5a5de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Tue, 13 Oct 2026 23:46:26 +0300 Subject: [PATCH 02/18] fix(neon): pursue via stable road-grid waypoints without intersection snap stalls --- experiments/neon-streets/world-sim.mjs | 45 +++++++++++++++++--------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/experiments/neon-streets/world-sim.mjs b/experiments/neon-streets/world-sim.mjs index 8e16a4f..246ef8e 100644 --- a/experiments/neon-streets/world-sim.mjs +++ b/experiments/neon-streets/world-sim.mjs @@ -109,28 +109,41 @@ export function stepTraffic(traffic, dt, seconds, player) { export function createPolice(player, id = 0) { const px = clamp(Math.round(player.x / BLOCK) * BLOCK + (id % 2 ? -2 : 2) * BLOCK, BLOCK, CITY - BLOCK); const py = clamp(Math.round(player.y / BLOCK) * BLOCK + (id % 2 ? 1 : -1) * BLOCK, BLOCK, CITY - BLOCK); - return { id, x: px, y: py, dir: id % 2 ? 1 : 0, speed: 135 + id * 16, tint: '#4d95f5', angle: 0, siren: 0 }; + return { id, x: px, y: py, tx: px, ty: py, dir: 0, speed: 135 + id * 16, tint: '#4d95f5', angle: 0, siren: 0 }; } const DIRS = [[1,0],[0,1],[-1,0],[0,-1]]; +// Follow explicit intersection-to-intersection waypoints. Never repeatedly snap to a nearby junction. export function stepPolice(police, player, dt) { dt = clamp(dt, 0, .08); for (const p of police) { - const gx = Math.round(p.x / BLOCK) * BLOCK, gy = Math.round(p.y / BLOCK) * BLOCK; - if (Math.hypot(p.x - gx, p.y - gy) < p.speed * dt + 1) { - p.x = gx; p.y = gy; - const dx = player.x - p.x, dy = player.y - p.y; - const preferX = Math.abs(dx) > Math.abs(dy); - let target = preferX ? (dx >= 0 ? 0 : 2) : (dy >= 0 ? 1 : 3); - const alt = preferX ? (dy >= 0 ? 1 : 3) : (dx >= 0 ? 0 : 2); - const v = DIRS[target]; - if (p.x + v[0] * BLOCK < 0 || p.x + v[0] * BLOCK > CITY || - p.y + v[1] * BLOCK < 0 || p.y + v[1] * BLOCK > CITY) target = alt; - p.dir = target; + if (!Number.isFinite(p.tx)) { p.tx = p.x; p.ty = p.y; } + let remaining = p.speed * dt; + let iterations = 0; + while (remaining > 0 && iterations++ < 3) { + const toTarget = Math.hypot(p.tx - p.x, p.ty - p.y); + if (toTarget < 1e-5) { + const choices = DIRS.map(([dx,dy],dir) => ({ + dir, dx, dy, nx: p.x + dx * BLOCK, ny: p.y + dy * BLOCK + })).filter(q => q.nx >= 0 && q.nx <= CITY && q.ny >= 0 && q.ny <= CITY); + choices.sort((a,b) => { + const score = q => Math.abs(q.nx - player.x) + Math.abs(q.ny - player.y) + + (q.dir === ((p.dir + 2) % 4) ? 25 : 0); + return score(a) - score(b); + }); + const next = choices[0]; + if (!next) break; + p.dir = next.dir; + p.tx = next.nx; + p.ty = next.ny; + p.angle = Math.atan2(next.dy,next.dx); + continue; + } + const move = Math.min(remaining, toTarget); + p.x += (p.tx - p.x) / toTarget * move; + p.y += (p.ty - p.y) / toTarget * move; + remaining -= move; + if (move >= toTarget - 1e-5) { p.x = p.tx; p.y = p.ty; } } - const [dx,dy] = DIRS[p.dir]; - p.x = clamp(p.x + dx * p.speed * dt, 0, CITY); - p.y = clamp(p.y + dy * p.speed * dt, 0, CITY); - p.angle = Math.atan2(dy, dx); p.siren += dt * 8; } } From d7140517dd8cb9fb206b9bd99524b379761d944c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Tue, 13 Oct 2026 23:46:55 +0300 Subject: [PATCH 03/18] feat(neon): cullable crosswalks, neon streetlights, traffic signals, pedestrians and police art --- experiments/neon-streets/world-art.mjs | 84 ++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 experiments/neon-streets/world-art.mjs diff --git a/experiments/neon-streets/world-art.mjs b/experiments/neon-streets/world-art.mjs new file mode 100644 index 0000000..237193a --- /dev/null +++ b/experiments/neon-streets/world-art.mjs @@ -0,0 +1,84 @@ +import { BLOCK, CITY } from './world-sim.mjs'; +// Visual details are viewport-culled and do not modify collision geometry. +export function drawCityDetails(ctx, cx, cy, w, h, seconds) { + const firstX = Math.max(0, Math.floor((cx - 90) / BLOCK)); + const lastX = Math.min(CITY / BLOCK, Math.ceil((cx + w + 90) / BLOCK)); + const firstY = Math.max(0, Math.floor((cy - 90) / BLOCK)); + const lastY = Math.min(CITY / BLOCK, Math.ceil((cy + h + 90) / BLOCK)); + for (let i = firstX; i <= lastX; i++) for (let j = firstY; j <= lastY; j++) { + const x = i * BLOCK - cx, y = j * BLOCK - cy; + // Four high-contrast pedestrian crossings, kept outside the road centre. + ctx.fillStyle = '#e5d7cc50'; + for (let k = -3; k <= 3; k++) { + const off = k * 8; + ctx.fillRect(x + off - 2, y - 55, 4, 17); + ctx.fillRect(x + off - 2, y + 38, 4, 17); + ctx.fillRect(x - 55, y + off - 2, 17, 4); + ctx.fillRect(x + 38, y + off - 2, 17, 4); + } + // Animated opposing signal phases at junction corners. + const eastWestGreen = Math.floor(seconds / 6 + (i + j) % 2) % 2 === 1; + ctx.fillStyle = '#0b111c'; + ctx.fillRect(x - 42, y - 42, 10, 19); + ctx.fillRect(x + 32, y + 23, 10, 19); + ctx.fillStyle = eastWestGreen ? '#48f4a3' : '#f65d79'; + ctx.fillRect(x - 40, y - 39, 6, 6); + ctx.fillRect(x + 34, y + 26, 6, 6); + ctx.fillStyle = eastWestGreen ? '#f65d79' : '#48f4a3'; + ctx.fillRect(x - 40, y - 30, 6, 5); + ctx.fillRect(x + 34, y + 35, 6, 5); + // Neon pools around intersection lamp posts. + for (const [dx,dy] of [[-57,-57],[57,57]]) { + const lx = x + dx, ly = y + dy; + const glow = ctx.createRadialGradient(lx,ly,1,lx,ly,36); + glow.addColorStop(0,'#f3a4dc48'); + glow.addColorStop(1,'#f3a4dc00'); + ctx.fillStyle = glow; + ctx.fillRect(lx - 36,ly - 36,72,72); + ctx.fillStyle = '#d4a7d9'; + ctx.fillRect(lx - 2,ly - 2,4,4); + } + // Street labels for wayfinding and visual texture. + if (i < CITY / BLOCK && j < CITY / BLOCK) { + ctx.save(); + ctx.translate(x + 52, y - 13); + ctx.fillStyle = '#c4a9e477'; + ctx.font = '9px monospace'; + ctx.fillText('SECTOR ' + (i + j * 11).toString(16).toUpperCase().padStart(2,'0'), 0, 0); + ctx.restore(); + } + } +} +export function drawPedestrians(ctx, pedestrians, cx, cy, w, h, seconds) { + for (const p of pedestrians) { + const x = p.x - cx, y = p.y - cy; + if (x < -20 || y < -20 || x > w + 20 || y > h + 20) continue; + ctx.fillStyle = '#0008'; + ctx.beginPath(); ctx.ellipse(x + 2,y + 4,4,2.5,0,0,Math.PI*2);ctx.fill(); + ctx.fillStyle = p.color; + ctx.beginPath();ctx.arc(x,y,3.3,0,Math.PI*2);ctx.fill(); + ctx.fillStyle = '#f7d9bd'; + ctx.beginPath();ctx.arc(x,y - 2,1.6,0,Math.PI*2);ctx.fill(); + } +} +export function drawPoliceCar(ctx, x, y, angle, seconds) { + ctx.save(); + ctx.translate(x,y); + ctx.rotate(angle + Math.PI / 2); + ctx.shadowColor = '#629bff'; + ctx.shadowBlur = 18; + ctx.fillStyle = '#131b36'; + ctx.fillRect(-13,-20,26,40); + ctx.fillStyle = '#e7e5ef'; + ctx.fillRect(-10,-17,20,34); + ctx.fillStyle = '#1b2947'; + ctx.fillRect(-8,-8,16,13); + ctx.shadowBlur = 0; + ctx.fillStyle = Math.sin(seconds * 18) > 0 ? '#f04e78' : '#50a9ff'; + ctx.fillRect(-9,-4,9,4); + ctx.fillStyle = Math.sin(seconds * 18) > 0 ? '#50a9ff' : '#f04e78'; + ctx.fillRect(0,-4,9,4); + ctx.fillStyle = '#fff7c7'; + ctx.fillRect(-9,-19,6,2);ctx.fillRect(3,-19,6,2); + ctx.restore(); +} From 3796981d3f5cb0c7266b4197b8e2c4bd65845a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Tue, 13 Oct 2026 23:47:15 +0300 Subject: [PATCH 04/18] fix: adjust sidewalk positions --- experiments/neon-streets/world-sim.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/experiments/neon-streets/world-sim.mjs b/experiments/neon-streets/world-sim.mjs index 246ef8e..9d6d1d0 100644 --- a/experiments/neon-streets/world-sim.mjs +++ b/experiments/neon-streets/world-sim.mjs @@ -163,8 +163,8 @@ export function createPedestrians(count = 35) { const row = 1 + ((i * 7 + 1) % 9), col = 1 + ((i * 13 + 2) % 9); const side = i % 4 < 2 ? 1 : -1; return { - x: horizontal ? 80 + ((i * 137) % 2320) : col * BLOCK + side * 59, - y: horizontal ? row * BLOCK + side * 59 : 80 + ((i * 179) % 2320), + x: horizontal ? 80 + ((i * 137) % 2320) : col * BLOCK + side * 44, + y: horizontal ? row * BLOCK + side * 44 : 80 + ((i * 179) % 2320), horizontal, direction: i % 3 ? 1 : -1, speed: 12 + (i * 7 % 14), color: PAINTS[(i + 3) % PAINTS.length] }; From d0cfa8244360451b8fdda02e4e6da033a7690de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Tue, 13 Oct 2026 23:48:47 +0300 Subject: [PATCH 05/18] chore: note integration work --- experiments/neon-streets/physics-smoke.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 experiments/neon-streets/physics-smoke.txt diff --git a/experiments/neon-streets/physics-smoke.txt b/experiments/neon-streets/physics-smoke.txt new file mode 100644 index 0000000..c6c943b --- /dev/null +++ b/experiments/neon-streets/physics-smoke.txt @@ -0,0 +1 @@ +physics simulation integration pending \ No newline at end of file From 789df450466e05b731f9bf1b26a122c1d3d3f735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Tue, 13 Oct 2026 23:48:57 +0300 Subject: [PATCH 06/18] style: prepare modular world --- experiments/neon-streets/style.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/experiments/neon-streets/style.css b/experiments/neon-streets/style.css index e6e3e28..dfcd942 100644 --- a/experiments/neon-streets/style.css +++ b/experiments/neon-streets/style.css @@ -1 +1,2 @@ -*{box-sizing:border-box}html,body,#shell{margin:0;width:100%;height:100%;overflow:hidden}body{background:#100d1d;color:#f8ecff;font:15px/1.5 system-ui,sans-serif}canvas{display:block;width:100%;height:100%;touch-action:none}header{position:absolute;z-index:4;left:23px;right:23px;top:20px;display:flex;justify-content:space-between;align-items:flex-start;text-shadow:0 2px 12px #000c}a{text-decoration:none;color:#facaff;font-size:10px;letter-spacing:2px}.brand{font-size:21px;font-weight:950;letter-spacing:2px;line-height:1}.brand span{color:#fe81bb}.brand small{font-size:9px;letter-spacing:2px;opacity:.5;display:block;margin-top:8px}.score{text-align:right;font-size:11px;letter-spacing:2px;color:#bda9cf}.score b{color:#fff}#mission{position:absolute;z-index:4;top:95px;left:50%;transform:translateX(-50%);padding:10px 18px;border-radius:7px;background:#150f28de;border:1px solid #a87cb950;max-width:95%;text-align:center;font-size:12px}#speed{position:absolute;z-index:4;bottom:28px;left:28px;font-size:45px;font-weight:900;letter-spacing:-2px;font-variant-numeric:tabular-nums;text-shadow:0 0 25px #f36ac880}#speed span{font-size:10px;letter-spacing:1px}#controls{position:absolute;z-index:4;bottom:23px;right:20px;display:flex;gap:7px}#controls button{width:55px;height:55px;border-radius:8px;color:#fff;border:1px solid #9f82bb77;background:#231838b8;cursor:pointer;font-size:20px;touch-action:none}#controls button:active{background:#f365a0}#start{position:absolute;z-index:8;inset:0;display:grid;place-items:center;background:radial-gradient(circle at 80% 20%,#86275b72,transparent 45%),linear-gradient(90deg,#100d1df3,#100d1da8)}#start.hidden{display:none}.panel{width:min(530px,90vw);padding:24px}.eyebrow{color:#fbb0da;letter-spacing:4px;font-size:10px}.panel h1{font-size:clamp(60px,10vw,96px);letter-spacing:-5px;line-height:.9;margin:25px 0}.panel p{color:#e1cfe6}.panel #play{margin-top:16px;padding:16px 32px;border:0;border-radius:4px;background:#fb91bd;color:#241023;letter-spacing:2px;font-weight:900;cursor:pointer}.panel .help{font-size:12px;margin-top:26px;line-height:1.8;opacity:.8}@media(max-width:650px){header{left:12px;right:12px;top:12px}.brand{font-size:15px}header a{display:none}#mission{top:65px;font-size:11px}#speed{font-size:28px;bottom:80px;left:12px}#controls{bottom:13px;right:10px}#controls button{width:51px;height:50px}} \ No newline at end of file +*{box-sizing:border-box}html,body,#shell{margin:0;width:100%;height:100%;overflow:hidden}body{background:#100d1d;color:#f8ecff;font:15px/1.5 system-ui,sans-serif}canvas{display:block;width:100%;height:100%;touch-action:none}header{position:absolute;z-index:4;left:23px;right:23px;top:20px;display:flex;justify-content:space-between;align-items:flex-start;text-shadow:0 2px 12px #000c}a{text-decoration:none;color:#facaff;font-size:10px;letter-spacing:2px}.brand{font-size:21px;font-weight:950;letter-spacing:2px;line-height:1}.brand span{color:#fe81bb}.brand small{font-size:9px;letter-spacing:2px;opacity:.5;display:block;margin-top:8px}.score{text-align:right;font-size:11px;letter-spacing:2px;color:#bda9cf}.score b{color:#fff}#mission{position:absolute;z-index:4;top:95px;left:50%;transform:translateX(-50%);padding:10px 18px;border-radius:7px;background:#150f28de;border:1px solid #a87cb950;max-width:95%;text-align:center;font-size:12px}#speed{position:absolute;z-index:4;bottom:28px;left:28px;font-size:45px;font-weight:900;letter-spacing:-2px;font-variant-numeric:tabular-nums;text-shadow:0 0 25px #f36ac880}#speed span{font-size:10px;letter-spacing:1px}#controls{position:absolute;z-index:4;bottom:23px;right:20px;display:flex;gap:7px}#controls button{width:55px;height:55px;border-radius:8px;color:#fff;border:1px solid #9f82bb77;background:#231838b8;cursor:pointer;font-size:20px;touch-action:none}#controls button:active{background:#f365a0}#start{position:absolute;z-index:8;inset:0;display:grid;place-items:center;background:radial-gradient(circle at 80% 20%,#86275b72,transparent 45%),linear-gradient(90deg,#100d1df3,#100d1da8)}#start.hidden{display:none}.panel{width:min(530px,90vw);padding:24px}.eyebrow{color:#fbb0da;letter-spacing:4px;font-size:10px}.panel h1{font-size:clamp(60px,10vw,96px);letter-spacing:-5px;line-height:.9;margin:25px 0}.panel p{color:#e1cfe6}.panel #play{margin-top:16px;padding:16px 32px;border:0;border-radius:4px;background:#fb91bd;color:#241023;letter-spacing:2px;font-weight:900;cursor:pointer}.panel .help{font-size:12px;margin-top:26px;line-height:1.8;opacity:.8}@media(max-width:650px){header{left:12px;right:12px;top:12px}.brand{font-size:15px}header a{display:none}#mission{top:65px;font-size:11px}#speed{font-size:28px;bottom:80px;left:12px}#controls{bottom:13px;right:10px}#controls button{width:51px;height:50px}} +/* Additional world systems are implemented in native modules. */ From 5c8c8af4c7c4f9f8bf44b5406a8eae6944b29b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Tue, 13 Oct 2026 23:49:07 +0300 Subject: [PATCH 07/18] feat: consume shared world geometry module --- experiments/neon-streets/game.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experiments/neon-streets/game.js b/experiments/neon-streets/game.js index 96c67e3..c6424a5 100644 --- a/experiments/neon-streets/game.js +++ b/experiments/neon-streets/game.js @@ -1,3 +1,4 @@ +import { CITY, BLOCK, ROAD } from './world-sim.mjs'; (() => { 'use strict'; const canvas = document.getElementById('canvas'); @@ -7,7 +8,6 @@ const missionsEl = document.getElementById('missions'); const speedEl = document.getElementById('speed'); const missionEl = document.getElementById('mission'); const startEl = document.getElementById('start'); -const CITY = 2500, BLOCK = 250, ROAD = 76; let w = 0, h = 0, dpr = 1, last = performance.now(), playing = false; let cash = 0, deliveries = 0, policeHeat = 0, stage = 'pickup'; const keys = new Set(); From 3688696031e963b7a6b0b0beab14facb1158c202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Wed, 14 Oct 2026 00:46:11 +0300 Subject: [PATCH 08/18] fix(neon): load integrated game as native ES module --- experiments/neon-streets/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experiments/neon-streets/index.html b/experiments/neon-streets/index.html index 28a33e2..b4f9e0c 100644 --- a/experiments/neon-streets/index.html +++ b/experiments/neon-streets/index.html @@ -1,3 +1,3 @@ Neon Streets — Bluebird Studio -
BLUEBIRD / LAB
NEONSTREETSPRE-ALPHA
CASH $0
MISSION 0
Find the yellow marker to collect a package.
00 KM/H
A TOP-DOWN DRIVING EXPERIMENT

NEON
STREETS

A living city. A stolen moment. One more delivery.

↑ accelerate · ↓ reverse · ← → steer · collect yellow pickups, deliver to purple drop-offs · touch buttons supported

\ No newline at end of file +
BLUEBIRD / LAB
NEONSTREETSPRE-ALPHA
CASH $0
MISSION 0
Find the yellow marker to collect a package.
00 KM/H
A TOP-DOWN DRIVING EXPERIMENT

NEON
STREETS

A living city. A stolen moment. One more delivery.

↑ accelerate · ↓ reverse · ← → steer · Space handbrake · collect yellow pickups, deliver to purple drop-offs · touch buttons supported

\ No newline at end of file From e8e89dba4fe90ce1b0d078f552ed620334c2ca63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Wed, 14 Oct 2026 00:46:37 +0300 Subject: [PATCH 09/18] refactor(neon): initialize live world simulation actors and native modules --- experiments/neon-streets/game.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/experiments/neon-streets/game.js b/experiments/neon-streets/game.js index c6424a5..d797a39 100644 --- a/experiments/neon-streets/game.js +++ b/experiments/neon-streets/game.js @@ -1,4 +1,5 @@ -import { CITY, BLOCK, ROAD } from './world-sim.mjs'; +import { CITY, BLOCK, ROAD, makeVehicle, stepVehicle, createTraffic, stepTraffic, createPolice, stepPolice, collidePlayerWithActors, createPedestrians, stepPedestrians } from './world-sim.mjs'; +import { drawCityDetails, drawPedestrians, drawPoliceCar } from './world-art.mjs'; (() => { 'use strict'; const canvas = document.getElementById('canvas'); @@ -11,17 +12,14 @@ const startEl = document.getElementById('start'); let w = 0, h = 0, dpr = 1, last = performance.now(), playing = false; let cash = 0, deliveries = 0, policeHeat = 0, stage = 'pickup'; const keys = new Set(); -const car = { x: 500, y: 500, angle: -Math.PI / 2, speed: 0 }; +const car = makeVehicle(); const pickups = [[750,500],[1000,1000],[1750,1250],[500,1750],[2000,2000],[1250,750],[750,2000]]; const drops = [[1500,500],[500,1250],[750,1750],[2000,750],[1000,2000],[1750,1500],[250,250]]; let marker = pickups[0]; -const traffic = []; -for (let i = 0; i < 24; i++) { - const row = 1 + (i * 7 % 9); - const col = 1 + (i * 11 % 9); - const horizontal = i % 2 === 0; - traffic.push({ x: col * BLOCK, y: row * BLOCK, dx: horizontal ? (i % 4 === 0 ? 1 : -1) : 0, dy: !horizontal ? (i % 3 === 0 ? 1 : -1) : 0, speed: 60 + i % 5 * 14, tint: ['#f6be70','#b16bba','#82caca','#80b66f'][i % 4] }); -} +const traffic = createTraffic(28); +const pedestrians = createPedestrians(48); +const police = []; +let worldTime = 0, impactFlash = 0, noticeTimeout = 0; function resize() { dpr = Math.min(2, window.devicePixelRatio || 1); w = window.innerWidth; @@ -32,11 +30,6 @@ function resize() { } window.addEventListener('resize', resize); resize(); -function isRoad(x, y, margin = 0) { - const dx = Math.abs(((x + BLOCK / 2) % BLOCK + BLOCK) % BLOCK - BLOCK / 2); - const dy = Math.abs(((y + BLOCK / 2) % BLOCK + BLOCK) % BLOCK - BLOCK / 2); - return dx < ROAD / 2 - margin || dy < ROAD / 2 - margin; -} const seed = (x, y) => { const n = Math.sin(x * 127.1 + y * 311.7) * 43758.5453; return n - Math.floor(n); From 6485c16dfff657a5928737d760cea2201ad1353b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Wed, 14 Oct 2026 00:47:36 +0300 Subject: [PATCH 10/18] test(neon): vehicle simulation sanity --- experiments/neon-streets/physics-smoke.test.mjs | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 experiments/neon-streets/physics-smoke.test.mjs diff --git a/experiments/neon-streets/physics-smoke.test.mjs b/experiments/neon-streets/physics-smoke.test.mjs new file mode 100644 index 0000000..4627b12 --- /dev/null +++ b/experiments/neon-streets/physics-smoke.test.mjs @@ -0,0 +1,4 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { makeVehicle, stepVehicle } from './world-sim.mjs'; +test('car moves',()=>{const car=makeVehicle();stepVehicle(car,{throttle:1,steer:0},0.1);assert.ok(car.speed>0);}); From 902fdae9970e20a240dec27fcbcbe2697f2dac3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Wed, 14 Oct 2026 00:47:43 +0300 Subject: [PATCH 11/18] feat(neon): advance world clock --- experiments/neon-streets/game.js | 1 + 1 file changed, 1 insertion(+) diff --git a/experiments/neon-streets/game.js b/experiments/neon-streets/game.js index d797a39..5d971b2 100644 --- a/experiments/neon-streets/game.js +++ b/experiments/neon-streets/game.js @@ -134,6 +134,7 @@ function tick(now) { const dt = Math.min(.05, Math.max(0, (now - last) / 1000)); last = now; if (playing) { + worldTime += dt; const throttle = Number(keys.has('ArrowUp') || keys.has('KeyW')) - Number(keys.has('ArrowDown') || keys.has('KeyS')); const steer = Number(keys.has('ArrowRight') || keys.has('KeyD')) - Number(keys.has('ArrowLeft') || keys.has('KeyA')); car.speed += throttle * 260 * dt; From cb15cb87e21e27402da67c726e9f7db95f2679da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Wed, 14 Oct 2026 00:48:18 +0300 Subject: [PATCH 12/18] style(neon): clarify native module integration --- experiments/neon-streets/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experiments/neon-streets/style.css b/experiments/neon-streets/style.css index dfcd942..8c4f1e4 100644 --- a/experiments/neon-streets/style.css +++ b/experiments/neon-streets/style.css @@ -1,2 +1,2 @@ *{box-sizing:border-box}html,body,#shell{margin:0;width:100%;height:100%;overflow:hidden}body{background:#100d1d;color:#f8ecff;font:15px/1.5 system-ui,sans-serif}canvas{display:block;width:100%;height:100%;touch-action:none}header{position:absolute;z-index:4;left:23px;right:23px;top:20px;display:flex;justify-content:space-between;align-items:flex-start;text-shadow:0 2px 12px #000c}a{text-decoration:none;color:#facaff;font-size:10px;letter-spacing:2px}.brand{font-size:21px;font-weight:950;letter-spacing:2px;line-height:1}.brand span{color:#fe81bb}.brand small{font-size:9px;letter-spacing:2px;opacity:.5;display:block;margin-top:8px}.score{text-align:right;font-size:11px;letter-spacing:2px;color:#bda9cf}.score b{color:#fff}#mission{position:absolute;z-index:4;top:95px;left:50%;transform:translateX(-50%);padding:10px 18px;border-radius:7px;background:#150f28de;border:1px solid #a87cb950;max-width:95%;text-align:center;font-size:12px}#speed{position:absolute;z-index:4;bottom:28px;left:28px;font-size:45px;font-weight:900;letter-spacing:-2px;font-variant-numeric:tabular-nums;text-shadow:0 0 25px #f36ac880}#speed span{font-size:10px;letter-spacing:1px}#controls{position:absolute;z-index:4;bottom:23px;right:20px;display:flex;gap:7px}#controls button{width:55px;height:55px;border-radius:8px;color:#fff;border:1px solid #9f82bb77;background:#231838b8;cursor:pointer;font-size:20px;touch-action:none}#controls button:active{background:#f365a0}#start{position:absolute;z-index:8;inset:0;display:grid;place-items:center;background:radial-gradient(circle at 80% 20%,#86275b72,transparent 45%),linear-gradient(90deg,#100d1df3,#100d1da8)}#start.hidden{display:none}.panel{width:min(530px,90vw);padding:24px}.eyebrow{color:#fbb0da;letter-spacing:4px;font-size:10px}.panel h1{font-size:clamp(60px,10vw,96px);letter-spacing:-5px;line-height:.9;margin:25px 0}.panel p{color:#e1cfe6}.panel #play{margin-top:16px;padding:16px 32px;border:0;border-radius:4px;background:#fb91bd;color:#241023;letter-spacing:2px;font-weight:900;cursor:pointer}.panel .help{font-size:12px;margin-top:26px;line-height:1.8;opacity:.8}@media(max-width:650px){header{left:12px;right:12px;top:12px}.brand{font-size:15px}header a{display:none}#mission{top:65px;font-size:11px}#speed{font-size:28px;bottom:80px;left:12px}#controls{bottom:13px;right:10px}#controls button{width:51px;height:50px}} -/* Additional world systems are implemented in native modules. */ +/* Street rendering and physics run through native ES modules. */ From 007e8f83687eb5437673f901cba6b25e7c65f832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Wed, 14 Oct 2026 00:48:30 +0300 Subject: [PATCH 13/18] chore(neon): mark world integration point --- experiments/neon-streets/game.js | 1 + 1 file changed, 1 insertion(+) diff --git a/experiments/neon-streets/game.js b/experiments/neon-streets/game.js index 5d971b2..ac06356 100644 --- a/experiments/neon-streets/game.js +++ b/experiments/neon-streets/game.js @@ -20,6 +20,7 @@ const traffic = createTraffic(28); const pedestrians = createPedestrians(48); const police = []; let worldTime = 0, impactFlash = 0, noticeTimeout = 0; +// World simulation is activated in the frame loop. function resize() { dpr = Math.min(2, window.devicePixelRatio || 1); w = window.innerWidth; From feda90c4de7b64668f1630957a29be70a699d0e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Wed, 14 Oct 2026 00:49:21 +0300 Subject: [PATCH 14/18] fix(neon): restore road collision symbol while world integration proceeds --- experiments/neon-streets/game.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experiments/neon-streets/game.js b/experiments/neon-streets/game.js index ac06356..6a18ae9 100644 --- a/experiments/neon-streets/game.js +++ b/experiments/neon-streets/game.js @@ -1,4 +1,4 @@ -import { CITY, BLOCK, ROAD, makeVehicle, stepVehicle, createTraffic, stepTraffic, createPolice, stepPolice, collidePlayerWithActors, createPedestrians, stepPedestrians } from './world-sim.mjs'; +import { isRoad, CITY, BLOCK, ROAD, makeVehicle, stepVehicle, createTraffic, stepTraffic, createPolice, stepPolice, collidePlayerWithActors, createPedestrians, stepPedestrians } from './world-sim.mjs'; import { drawCityDetails, drawPedestrians, drawPoliceCar } from './world-art.mjs'; (() => { 'use strict'; From a5e4aa43e7fb01aef1088944d6181278ed5ead47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Wed, 14 Oct 2026 00:49:40 +0300 Subject: [PATCH 15/18] test(neon): enforce live world integration, road physics and traffic --- experiments/tests/neon-world.test.mjs | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 experiments/tests/neon-world.test.mjs diff --git a/experiments/tests/neon-world.test.mjs b/experiments/tests/neon-world.test.mjs new file mode 100644 index 0000000..179e3b6 --- /dev/null +++ b/experiments/tests/neon-world.test.mjs @@ -0,0 +1,28 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { isRoad, canDrive, makeVehicle, stepVehicle, createTraffic, stepTraffic } from '../neon-streets/world-sim.mjs'; + +test('roads are drivable and buildings are not', () => { + assert.equal(isRoad(500,500), true); + assert.equal(canDrive(625,625), false); +}); +test('vehicle accelerates and stays on road', () => { + const car = makeVehicle(500,500,0); + for(let i=0;i<60;i++) stepVehicle(car,{throttle:1,steer:0},.05); + assert.ok(canDrive(car.x,car.y)); + assert.ok(car.x < 600); +}); +test('traffic remains finite', () => { + const traffic = createTraffic(8); + stepTraffic(traffic,.05,1,makeVehicle()); + assert.ok(traffic.every(t=>Number.isFinite(t.x)&&Number.isFinite(t.y))); +}); +test('game module is loaded and actually uses world physics', () => { + const html=readFileSync(new URL('../neon-streets/index.html',import.meta.url),'utf8'); + const js=readFileSync(new URL('../neon-streets/game.js',import.meta.url),'utf8'); + assert.match(html,/type="module" src="\.\/game\.js"/); + assert.match(js,/stepVehicle\(/); + assert.match(js,/stepTraffic\(/); + assert.match(js,/drawCityDetails\(/); +}); From 8526312856f9aedacac6de395a92c314475e37e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Wed, 14 Oct 2026 01:45:56 +0300 Subject: [PATCH 16/18] fix(neon): wire real vehicle traffic pedestrian police simulation into live game loop --- experiments/neon-streets/game.js | 62 +++++++++++++++++++------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/experiments/neon-streets/game.js b/experiments/neon-streets/game.js index 6a18ae9..4a40518 100644 --- a/experiments/neon-streets/game.js +++ b/experiments/neon-streets/game.js @@ -19,7 +19,8 @@ let marker = pickups[0]; const traffic = createTraffic(28); const pedestrians = createPedestrians(48); const police = []; -let worldTime = 0, impactFlash = 0, noticeTimeout = 0; +let worldTime = 0, impactFlash = 0, policeSpawnCooldown = 0; +let lastImpactTime = -10; // World simulation is activated in the frame loop. function resize() { dpr = Math.min(2, window.devicePixelRatio || 1); @@ -138,19 +139,11 @@ function tick(now) { worldTime += dt; const throttle = Number(keys.has('ArrowUp') || keys.has('KeyW')) - Number(keys.has('ArrowDown') || keys.has('KeyS')); const steer = Number(keys.has('ArrowRight') || keys.has('KeyD')) - Number(keys.has('ArrowLeft') || keys.has('KeyA')); - car.speed += throttle * 260 * dt; - car.speed *= Math.pow(.982, dt * 60); - if (!throttle && Math.abs(car.speed) < .5) car.speed = 0; - car.speed = Math.max(-100, Math.min(275, car.speed)); - car.angle += steer * dt * 2.25 * Math.min(1, Math.abs(car.speed) / 60) * (car.speed < 0 ? -1 : 1); - const nextX = car.x + Math.cos(car.angle) * car.speed * dt; - const nextY = car.y + Math.sin(car.angle) * car.speed * dt; - if (isRoad(nextX, nextY, 6) && nextX > 20 && nextX < CITY - 20 && nextY > 20 && nextY < CITY - 20) { - car.x = nextX; - car.y = nextY; - } else { - if (Math.abs(car.speed) > 75) policeHeat = Math.min(5, policeHeat + dt); - car.speed *= -.25; + const physics = stepVehicle(car, { throttle, steer, handbrake: keys.has('Space') }, dt); + if (physics.collided && physics.impactSpeed > 55) { + policeHeat = Math.min(5, policeHeat + .5); + impactFlash = .3; + lastImpactTime = worldTime; } if (Math.hypot(car.x - marker[0], car.y - marker[1]) < 37) { if (stage === 'pickup') { @@ -165,18 +158,27 @@ function tick(now) { resetMission(); } } - for (const t of traffic) { - t.x += t.dx * t.speed * dt; - t.y += t.dy * t.speed * dt; - if (t.x < 0) t.x = CITY; - if (t.x > CITY) t.x = 0; - if (t.y < 0) t.y = CITY; - if (t.y > CITY) t.y = 0; - if (Math.hypot(car.x - t.x, car.y - t.y) < 25 && Math.abs(car.speed) > 10) { - car.speed *= -.3; - policeHeat = Math.min(5, policeHeat + .5); + stepTraffic(traffic, dt, worldTime, car); + stepPedestrians(pedestrians, dt); + policeSpawnCooldown = Math.max(0, policeSpawnCooldown - dt); + const desiredPolice = Math.min(3, Math.floor(policeHeat + .2)); + if (police.length < desiredPolice && policeSpawnCooldown === 0) { + police.push(createPolice(car, police.length)); + policeSpawnCooldown = 2; + } + if (police.length > desiredPolice && policeHeat < .5) police.length = 0; + stepPolice(police, car, dt); + const actorCollision = collidePlayerWithActors(car, traffic, police); + if (actorCollision.impact) { + impactFlash = .32; + lastImpactTime = worldTime; + policeHeat = Math.min(5, policeHeat + (actorCollision.police ? 1.1 : .55)); + if (actorCollision.police && cash >= 100) { + cash -= 100; + cashEl.textContent = '$' + cash.toLocaleString(); } } + impactFlash = Math.max(0, impactFlash - dt); speedEl.innerHTML = String(Math.round(Math.abs(car.speed) * .65)).padStart(2,'0') + ' KM/H'; policeHeat = Math.max(0, policeHeat - dt * .025); } @@ -188,10 +190,16 @@ function tick(now) { ctx.rect(0, 0, w, h); ctx.clip(); worldBackground(cx, cy); + drawCityDetails(ctx, cx, cy, w, h, worldTime); + drawPedestrians(ctx, pedestrians, cx, cy, w, h, worldTime); for (const t of traffic) { const x = t.x - cx, y = t.y - cy; if (x < -40 || y < -40 || x > w + 40 || y > h + 40) continue; - drawCar(x, y, Math.atan2(t.dy, t.dx), t.tint, false); + drawCar(x, y, t.angle, t.tint, false); + } + for (const p of police) { + const x = p.x - cx, y = p.y - cy; + if (x >= -45 && y >= -45 && x <= w + 45 && y <= h + 45) drawPoliceCar(ctx, x, y, p.angle, worldTime); } drawMarker(marker[0] - cx, marker[1] - cy, stage === 'pickup' ? 'PICKUP' : 'DROP', stage === 'pickup' ? '#ffd65c' : '#f68cff', now); drawCar(w / 2, h / 2, car.angle, '#f777ac', true); @@ -201,6 +209,10 @@ function tick(now) { glow.addColorStop(1,'#070411a3'); ctx.fillStyle=glow; ctx.fillRect(0,0,w,h); + if (impactFlash > 0) { + ctx.fillStyle = 'rgba(255, 80, 120, ' + (impactFlash * .24) + ')'; + ctx.fillRect(0, 0, w, h); + } if (policeHeat > .2) { ctx.fillStyle='#ffa4b4'; ctx.font='bold 12px monospace'; From 381cda032266e1d6ecd99b06e1702eef3dc99676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Wed, 14 Oct 2026 01:46:30 +0300 Subject: [PATCH 17/18] test(neon): correct road assertion and verify diagonal collision --- experiments/tests/neon-world.test.mjs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/experiments/tests/neon-world.test.mjs b/experiments/tests/neon-world.test.mjs index 179e3b6..79d5c0b 100644 --- a/experiments/tests/neon-world.test.mjs +++ b/experiments/tests/neon-world.test.mjs @@ -11,8 +11,20 @@ test('vehicle accelerates and stays on road', () => { const car = makeVehicle(500,500,0); for(let i=0;i<60;i++) stepVehicle(car,{throttle:1,steer:0},.05); assert.ok(canDrive(car.x,car.y)); - assert.ok(car.x < 600); + assert.ok(car.x > 600, 'eastbound road continues past x=600'); }); +test('diagonal motion collides with a building while road motion stays valid', () => { + const car = makeVehicle(500, 500, Math.PI / 4); + let blocked = false; + for (let i = 0; i < 120; i++) { + const result = stepVehicle(car, { throttle: 1, steer: 0 }, .05); + blocked ||= result.collided; + assert.equal(canDrive(car.x, car.y), true); + } + assert.equal(blocked, true); + assert.ok(car.x < 540 && car.y < 540); +}); + test('traffic remains finite', () => { const traffic = createTraffic(8); stepTraffic(traffic,.05,1,makeVehicle()); From 58d71504d24fbb67e74df303356f029d17a62f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99-Andrei=20Bobu?= Date: Wed, 14 Oct 2026 01:47:45 +0300 Subject: [PATCH 18/18] test(neon): enforce active pursuit and pedestrian simulation --- experiments/tests/neon-world.test.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/experiments/tests/neon-world.test.mjs b/experiments/tests/neon-world.test.mjs index 79d5c0b..4ecf508 100644 --- a/experiments/tests/neon-world.test.mjs +++ b/experiments/tests/neon-world.test.mjs @@ -37,4 +37,9 @@ test('game module is loaded and actually uses world physics', () => { assert.match(js,/stepVehicle\(/); assert.match(js,/stepTraffic\(/); assert.match(js,/drawCityDetails\(/); + assert.match(js,/stepPedestrians\(/); + assert.match(js,/stepPolice\(/); + assert.match(js,/collidePlayerWithActors\(/); + assert.match(js,/drawPedestrians\(/); + assert.match(js,/drawPoliceCar\(/); });