27:18Gemini 4 Hydrogen: Cheaper Tokens, More Expensive Answers?
Nov 13, 2026 · YouTube
18:40ERNIE 5.5 Flash Preview vs GLM 5.3 Flash: Baidu's new model is very impressive!
Nov 11, 2026 · YouTube
36:22Fable 5.2 robbing me blind, plus: Nex AGI's N2.6 vs GLM 5.3 Flash
Nov 11, 2026 · YouTube
14:03Gemini 4 Carbon: Can it handle my challenges? (First look with one-shot coding tests)
Nov 10, 2026 · YouTube
47:51Ranking major U.S. Open-Weights Models. (Where does Ripple 65B fit in?)
Nov 6, 2026 · YouTube
10:57"Crouton Alpha": the latest super-efficient coding model by Meta?
Nov 3, 2026 · YouTube
38:58Testing Particle-1: a post-trained DeepSeek V4.1 Flash specializing in coding and efficiency
Oct 28, 2026 · YouTube
22:14GPT-6.1 Terra Pro vs Terra: How Much Better Is Pro?
Oct 27, 2026 · YouTube
29:55Kimi K3.1 Pro Looked Incredible. Then I Kept Testing.
Oct 26, 2026 · YouTube
31:28Is this company reselling GPT Sol 6.1 at a loss (for non-agentic/text-only)?🤔 Is this sustainable?
Oct 20, 2026 · YouTube
17:58Nemotron 3.5 Super VL vs Opus 5.5: Testing NVIDIA’s new coding juggernaut
Oct 15, 2026 · YouTube
16:04Testing a *massive* new open-weights model 🤯: Muse Spark Open (vs. Nemotron, Opus 5.5, and more)
Oct 15, 2026 · YouTube
16:43Gemini 4 Argon: Great 🐈 Animation, but a broken escalator. (Coding challenge vs Opus 5.5, Sol 6.1)
Oct 13, 2026 · YouTube
16:37Meta's new "Muse Wonder" AI is impressive... but can it compete with Anthropic's models?
Oct 12, 2026 · YouTube
11:12WOW... Haiku 5.5 is very impressive. RIP OpenAI?
Oct 7, 2026 · YouTube
22:47Mistral Large 4 Is Cheap. But Is It Good Enough to Compete?
Oct 6, 2026 · YouTube
22:02Is Pareto 26.10 Preview Just Routing to GPT Sol? I Tested It Against Sol 6.1 Pro
Oct 1, 2026 · YouTube
11:22I Tested Sonnet 5.5 Against Opus 5.5. Is It Actually Cheaper?
Sep 28, 2026 · YouTube
30:00Did Elon Musk's team "train the gay away"... and make Grok 4.7 worse?
Sep 26, 2026 · YouTube
10:58So... how much better is Claude Opus 5.5 vs. GPT-6 Sol, really?
Sep 23, 2026 · YouTube
9:38Claude Opus 5.5... the BEST new model for coding!! 🤩
Sep 22, 2026 · YouTube
29:00Grok 4.7: improved, but GLM 5.3 FlashX beat it anyway (benchmark against Gemini, Sol, etc.)
Sep 22, 2026 · YouTube
16:54Stealth Union Alpha: Is this another cheap GPT model? (better than Luna, cheaper than Terra?)
Sep 16, 2026 · YouTube
16:45DeepSeek V4.1 Flash Is Shockingly Good for the Price
Sep 10, 2026 · YouTube
17:14How much better is GPT-6 Astra over Claude Opus 5? Real Website and Coding Tests
Sep 5, 2026 · YouTube
29:13Implementing a multiplayer game with GPT-6 Astra (+ Gemini 3.8, Opus 5, Sol Pro)
Sep 5, 2026 · YouTube
19:42Meta Muse Spark 1.3 Review: A Huge Leap Forward
Sep 2, 2026 · YouTube
17:31Testing Gemini 3.8 Flash on Real Coding Challenges (vs. other models)
Sep 2, 2026 · YouTube
19:45Fable 5.1 writes an animated novel using Ren'Py... did it do better than Sol Pro 5.6?
Sep 1, 2026 · YouTube
14:09Testing IBM Granite-4.2-8B! Can it name 100 women?
Aug 31, 2026 · YouTube
17:37Tencent Hy4 Preview Tested: Is It Really Better Than Kimi K3 and GLM 5.3?
Aug 28, 2026 · YouTube
23:58Qwen 3.8 Flash Tested: UI, Coding, Physics & more - compared to Opus 5, Sol Pro, Grok
Aug 27, 2026 · YouTube
You are a game developer who ships browser demos that have to work on the first click, in front of an audience, on someone else's laptop.
Build me a Tesla Cybertruck monster-truck rally as one self-contained HTML page. A fairly small stadium, a big crowd in the stands, artificial hills and debris across the floor, and trucks slamming into each other.
Then make it match the spec below exactly. The spec is the challenge; a great-looking rally that ignores it is a miss.
.html page. No build step. Saved to disk and double-clicked, it runs.localStorage, sessionStorage, cookies or indexedDB. It runs in a sandboxed frame where touching them throws.Both are checkable in ten seconds, which is why they are here.
#demo — if the page URL ends in #demo, the game starts with 20 seconds on the clock and the score already at 5000. This must run through the real game state, not a cosmetic overlay. Everything else behaves normally.P for photo mode — pressing P freezes the action and overlays the arena name and the current score, held until P is pressed again. The simulation stops; it does not keep playing behind the card.One sentence: the name of your rally and what it looks like.
Exactly one fenced html block containing the whole page and nothing else.
Exactly four bullets.
#demo sets, and why it is not an overlay.P is pressed — the render loop, the physics step, or both.Cybertruck Rumble at Volt Dome is a neon-lit stadium rally where five angular electric trucks leap artificial hills, scatter tire-and-rubble debris, and slam each other under a packed, cheering crowd.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Cybertruck Rumble at Volt Dome</title>
<link rel="icon" href="data:,">
<style>
html,body{margin:0;padding:0;overflow:hidden;background:#050510;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color:#fff;}
canvas{display:block;}
#hud{position:fixed;top:12px;left:50%;transform:translateX(-50%);text-align:center;pointer-events:none;text-shadow:0 2px 6px #000;}
#arena{font-size:28px;font-weight:800;letter-spacing:2px;color:#7df9ff;}
.row{margin-top:4px;font-size:20px;font-weight:700;display:flex;gap:24px;justify-content:center;}
#controls{margin-top:6px;font-size:13px;opacity:.85;}
.overlay{position:fixed;inset:0;display:none;align-items:center;justify-content:center;background:rgba(0,0,0,.55);backdrop-filter:blur(2px);}
.card{background:rgba(10,10,20,.85);border:2px solid #7df9ff;border-radius:14px;padding:28px 44px;text-align:center;box-shadow:0 0 40px rgba(125,249,255,.35);}
.card div:first-child{font-size:34px;font-weight:800;color:#7df9ff;letter-spacing:1px;}
#photoScore,#finalScore{font-size:26px;font-weight:700;margin-top:10px;}
.small{margin-top:14px;font-size:13px;opacity:.8;letter-spacing:1px;}
</style>
</head>
<body>
<div id="hud">
<div id="arena">VOLT DOME</div>
<div class="row"><span id="score">SCORE 0</span><span id="clock">TIME 90</span></div>
<div id="controls">DRIVE: WASD / ARROW KEYS · P: PHOTO MODE</div>
</div>
<div id="photo" class="overlay">
<div class="card">
<div id="photoArena">VOLT DOME</div>
<div id="photoScore">SCORE 0</div>
<div class="small">PHOTO MODE — PRESS P TO RESUME</div>
</div>
</div>
<div id="gameover" class="overlay">
<div class="card">
<div>TIME UP</div>
<div id="finalScore">SCORE 0</div>
<div class="small">PRESS R TO RESTART</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script>
(function(){
const arenaName = 'VOLT DOME';
const isDemo = location.hash.toLowerCase().endsWith('#demo');
let score = 0, timeLeft = 90, gameOver = false, photoMode = false;
const scoreEl = document.getElementById('score');
const clockEl = document.getElementById('clock');
const photoOverlay = document.getElementById('photo');
const photoArena = document.getElementById('photoArena');
const photoScore = document.getElementById('photoScore');
const gameOverOverlay = document.getElementById('gameover');
const finalScore = document.getElementById('finalScore');
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x050510);
scene.fog = new THREE.Fog(0x050510, 70, 220);
const camera = new THREE.PerspectiveCamera(60, innerWidth/innerHeight, 0.1, 1000);
camera.position.set(0,20,-60);
const renderer = new THREE.WebGLRenderer({antialias:true});
renderer.setPixelRatio(Math.min(devicePixelRatio,2));
renderer.setSize(innerWidth, innerHeight);
document.body.appendChild(renderer.domElement);
scene.add(new THREE.HemisphereLight(0xffffff, 0x222244, 0.9));
const dir = new THREE.DirectionalLight(0xffffff, 0.7);
dir.position.set(60,120,40);
scene.add(dir);
const floor = new THREE.Mesh(
new THREE.CircleGeometry(70, 64),
new THREE.MeshLambertMaterial({color:0x1b1b2a})
);
floor.rotation.x = -Math.PI/2;
scene.add(floor);
const stand = new THREE.Mesh(
new THREE.CylinderGeometry(90, 70, 20, 64, 1, true),
new THREE.MeshLambertMaterial({color:0x2a2a3d, side:THREE.DoubleSide})
);
stand.position.y = 10;
scene.add(stand);
const crowdRows = 14;
let crowdCount = 0;
const seatsPerRow = [];
for (let i=0;i<crowdRows;i++){
const y = 1 + i*1.3;
const radius = 70 + y;
const seats = Math.floor(2*Math.PI*radius / 1.15);
seatsPerRow.push(seats);
crowdCount += seats;
}
const crowdGeo = new THREE.BoxGeometry(0.7,1.3,0.7);
const crowdMat = new THREE.MeshLambertMaterial({color:0xffffff});
const crowd = new THREE.InstancedMesh(crowdGeo, crowdMat, crowdCount);
const dummy = new THREE.Object3D();
const cColor = new THREE.Color();
const palette = [0xff5c5c,0x5cff8f,0x5cc9ff,0xffd35c,0xd75cff,0xffffff];
let idx=0;
for (let i=0;i<crowdRows;i++){
const y = 1 + i*1.3;
const radius = 70 + y;
const seats = seatsPerRow[i];
for (let j=0;j<seats;j++){
const ang = (j/seats)*Math.PI*2 + (Math.random()-0.5)*0.02;
const x = Math.cos(ang)*radius;
const z = Math.sin(ang)*radius;
dummy.position.set(x, y+0.65, z);
dummy.rotation.set(0, Math.atan2(-x,-z) + (Math.random()-0.5)*0.4, 0);
const s = 0.8 + Math.random()*0.5;
dummy.scale.set(s,s,s);
dummy.updateMatrix();
crowd.setMatrixAt(idx, dummy.matrix);
cColor.setHex(palette[(Math.random()*palette.length)|0]);
crowd.setColorAt(idx, cColor);
idx++;
}
}
crowd.instanceMatrix.needsUpdate = true;
if (crowd.instanceColor) crowd.instanceColor.needsUpdate = true;
scene.add(crowd);
const hills = [];
const hillMat = new THREE.MeshLambertMaterial({color:0x2f6b3a});
for (let i=0;i<7;i++){
const r = 12 + Math.random()*10;
const h = 3 + Math.random()*3.5;
const ang = Math.random()*Math.PI*2;
const dist = 15 + Math.random()*40;
const x = Math.cos(ang)*dist, z = Math.sin(ang)*dist;
const mesh = new THREE.Mesh(new THREE.SphereGeometry(1, 24, 16), hillMat);
mesh.scale.set(r, h, r);
mesh.position.set(x,0,z);
scene.add(mesh);
hills.push({x:x, z:z, r:r, h:h});
}
function groundHeight(x,z){
let y=0;
for (let i=0;i<hills.length;i++){
const hl = hills[i];
const dx=x-hl.x, dz=z-hl.z;
const d2=dx*dx+dz*dz;
if (d2 < hl.r*hl.r){
const yh = hl.h*Math.sqrt(1 - d2/(hl.r*hl.r));
if (yh>y) y=yh;
}
}
return y;
}
const obstacles = [];
function addObstacle(type, x, z){
let mesh, radius, yOff=0;
if (type==='barrier'){
mesh = new THREE.Mesh(new THREE.BoxGeometry(3.5,1.4,1.2), new THREE.MeshLambertMaterial({color:0x888888}));
radius = 2.0; yOff = 0.7;
} else if (type==='tire'){
mesh = new THREE.Mesh(new THREE.CylinderGeometry(1.1,1.1,0.9,16), new THREE.MeshLambertMaterial({color:0x111111}));
radius = 1.25; yOff = 0.45;
} else {
mesh = new THREE.Mesh(new THREE.ConeGeometry(1.4,2.2,8), new THREE.MeshLambertMaterial({color:0xc8702a}));
radius = 1.4; yOff = 1.1;
}
const gy = groundHeight(x,z);
mesh.position.set(x, gy+yOff, z);
mesh.rotation.y = Math.random()*Math.PI*2;
scene.add(mesh);
obstacles.push({mesh:mesh, type:type, pos:new THREE.Vector3(x,gy+yOff,z), radius:radius});
}
for (let i=0;i<10;i++) addObstacle('barrier', (Math.random()-0.5)*100, (Math.random()-0.5)*100);
for (let i=0;i<10;i++) addObstacle('tire', (Math.random()-0.5)*100, (Math.random()-0.5)*100);
for (let i=0;i<10;i++) addObstacle('rubble', (Math.random()-0.5)*100, (Math.random()-0.5)*100);
obstacles.forEach(o=>{
const d = Math.hypot(o.pos.x,o.pos.z);
if (d>58){ o.pos.x *= 58/d; o.pos.z *= 58/d; }
const gy = groundHeight(o.pos.x,o.pos.z);
const yOff = o.type==='barrier'?0.7:o.type==='tire'?0.45:1.1;
o.pos.y = gy+yOff;
o.mesh.position.set(o.pos.x,o.pos.y,o.pos.z);
});
function makeTruck(color, isPlayer){
const shape = new THREE.Shape();
shape.moveTo(-2.3,0);
shape.lineTo(2.3,0);
shape.lineTo(1.2,0.9);
shape.lineTo(-1.0,1.1);
shape.lineTo(-2.3,0.6);
shape.lineTo(-2.3,0);
const geo = new THREE.ExtrudeGeometry(shape, {depth:1.8, bevelEnabled:false});
geo.computeBoundingBox();
geo.center();
geo.computeBoundingBox();
geo.translate(0, -geo.boundingBox.min.y, 0);
const bodyMat = new THREE.MeshLambertMaterial({color:color, emissive:0x000000});
const body = new THREE.Mesh(geo, bodyMat);
body.rotation.y = -Math.PI/2;
const group = new THREE.Group();
group.add(body);
const wheelGeo = new THREE.CylinderGeometry(0.5,0.5,0.4,12);
const wheelMat = new THREE.MeshLambertMaterial({color:0x0a0a0a});
const pivots = [];
const wx = 0.9, wz = 1.4;
[[-wx,-wz],[wx,-wz],[-wx,wz],[wx,wz]].forEach(p=>{
const pivot = new THREE.Group();
pivot.position.set(p[0],0.5,p[1]);
const w = new THREE.Mesh(wheelGeo, wheelMat);
w.rotation.z = Math.PI/2;
pivot.add(w);
group.add(pivot);
pivots.push(pivot);
});
scene.add(group);
return {
mesh:group, bodyMat:bodyMat, pivots:pivots,
pos:new THREE.Vector3(), vel:new THREE.Vector3(), yaw:0,
radius:1.8, isPlayer:isPlayer, throttle:0, steer:0,
wreckTimer:0, wreckSpin:0,
role:null, waypoints:null, wpIndex:0, roamTarget:new THREE.Vector3(), roamTimer:0, orbitAngle:Math.random()*Math.PI*2
};
}
const trucks = [];
const player = makeTruck(0x7df9ff, true);
trucks.push(player);
const rivalColors = [0xff4d4d, 0xffa64d, 0xb84dff, 0x4dff88];
for (let i=0;i<4;i++) trucks.push(makeTruck(rivalColors[i], false));
trucks[1].role='chaser';
trucks[2].role='patrol';
trucks[2].waypoints=[new THREE.Vector3(0,0,45), new THREE.Vector3(45,0,0), new THREE.Vector3(0,0,-45), new THREE.Vector3(-45,0,0)];
trucks[3].role='flanker';
trucks[4].role='roamer';
function resetTrucks(){
const angles = [-Math.PI/2, 0, Math.PI*0.4, Math.PI*0.8, Math.PI*1.2, Math.PI*1.6].slice(0,5);
for (let i=0;i<trucks.length;i++){
const t = trucks[i];
const ang = angles[i];
const rad = 35;
t.pos.set(Math.cos(ang)*rad, 0, Math.sin(ang)*rad);
t.vel.set(0,0,0);
t.yaw = Math.atan2(-t.pos.x, -t.pos.z);
t.mesh.position.copy(t.pos);
t.mesh.rotation.y = t.yaw;
t.wreckTimer=0; t.wreckSpin=0; t.throttle=0; t.steer=0;
t.bodyMat.emissive.setHex(0x000000);
t.mesh.rotation.z = 0;
if (t.role==='roamer') t.roamTimer=0;
if (t.role==='patrol') t.wpIndex=0;
}
}
function resetGame(){
score = isDemo ? 5000 : 0;
timeLeft = isDemo ? 20 : 90;
gameOver = false;
photoMode = false;
photoOverlay.style.display='none';
gameOverOverlay.style.display='none';
resetTrucks();
updateHUD();
}
function updateHUD(){
scoreEl.textContent = 'SCORE ' + score;
clockEl.textContent = 'TIME ' + Math.ceil(timeLeft);
}
const keys = {};
addEventListener('keydown', e=>{
const k = e.key.toLowerCase();
keys[k] = true;
if (k==='p') togglePhoto();
if (k==='r' && gameOver) resetGame();
if (['arrowup','arrowdown','arrowleft','arrowright',' '].includes(k)) e.preventDefault();
});
addEventListener('keyup', e=>{ keys[e.key.toLowerCase()] = false; });
function togglePhoto(){
if (gameOver) return;
photoMode = !photoMode;
if (photoMode){
photoArena.textContent = arenaName;
photoScore.textContent = 'SCORE ' + score;
photoOverlay.style.display='flex';
} else {
photoOverlay.style.display='none';
}
}
function aiUpdate(t, dt){
if (t.wreckTimer>0){ t.throttle=0; t.steer=0; return; }
let desired = new THREE.Vector3();
if (t.role==='chaser'){
desired.copy(player.pos).sub(t.pos);
} else if (t.role==='patrol'){
const wp = t.waypoints[t.wpIndex];
desired.copy(wp).sub(t.pos);
if (desired.length() < 10) t.wpIndex = (t.wpIndex+1)%t.waypoints.length;
} else if (t.role==='flanker'){
t.orbitAngle += dt*0.6;
const target = new THREE.Vector3(player.pos.x + Math.cos(t.orbitAngle)*25, 0, player.pos.z + Math.sin(t.orbitAngle)*25);
desired.copy(target).sub(t.pos);
} else {
t.roamTimer -= dt;
if (t.roamTimer<=0){
const ang = Math.random()*Math.PI*2, rad = 20+Math.random()*35;
t.roamTarget.set(Math.cos(ang)*rad,0,Math.sin(ang)*rad);
t.roamTimer = 3+Math.random()*3;
}
desired.copy(t.roamTarget).sub(t.pos);
}
desired.y=0;
if (desired.lengthSq()>0) desired.normalize();
const sep = new THREE.Vector3();
for (const o of trucks){
if (o===t) continue;
const d = t.pos.distanceTo(o.pos);
if (d < 14 && d>0){
const away = t.pos.clone().sub(o.pos); away.y=0; away.normalize().divideScalar(d/14);
sep.add(away);
}
}
for (const ob of obstacles){
const d = t.pos.distanceTo(ob.pos);
if (d < 12){
const away = t.pos.clone().sub(ob.pos); away.y=0; away.normalize().multiplyScalar((12-d)/12);
sep.add(away.multiplyScalar(1.5));
}
}
const distC = Math.hypot(t.pos.x,t.pos.z);
if (distC > 55){
const toC = new THREE.Vector3(-t.pos.x,0,-t.pos.z).normalize();
sep.add(toC.multiplyScalar((distC-55)/10));
}
const steerDir = desired.add(sep.multiplyScalar(1.6));
if (steerDir.lengthSq()>0) steerDir.normalize();
const desiredYaw = Math.atan2(steerDir.x, steerDir.z);
let diff = desiredYaw - t.yaw;
while (diff > Math.PI) diff -= Math.PI*2;
while (diff < -Math.PI) diff += Math.PI*2;
t.steer = Math.max(-1, Math.min(1, diff*2));
t.throttle = Math.abs(diff) < 1.2 ? 1 : 0.55;
}
function updateTruck(t, dt){
if (t.wreckTimer>0){
t.wreckTimer -= dt;
t.yaw += t.wreckSpin*dt;
t.vel.multiplyScalar(0.90);
t.bodyMat.emissive.setHex(0xff2200);
t.mesh.rotation.z = Math.sin(t.wreckTimer*25)*0.2;
} else {
t.bodyMat.emissive.setHex(0x000000);
t.mesh.rotation.z = 0;
}
const forward = new THREE.Vector3(Math.sin(t.yaw),0,Math.cos(t.yaw));
if (t.throttle > 0) t.vel.addScaledVector(forward, 26*t.throttle*dt);
else if (t.throttle < 0) t.vel.addScaledVector(forward, 16*t.throttle*dt);
const speed = t.vel.length();
const turn = t.steer * 2.6 * dt * Math.min(1, speed/6);
t.yaw += turn;
const fwdSpeed = t.vel.dot(forward);
const lat = t.vel.clone().addScaledVector(forward, -fwdSpeed);
lat.multiplyScalar(0.86);
t.vel.copy(forward).multiplyScalar(fwdSpeed).add(lat);
t.vel.multiplyScalar(0.995);
if (t.vel.length() > 34) t.vel.setLength(34);
t.pos.addScaledVector(t.vel, dt);
t.pos.y = groundHeight(t.pos.x, t.pos.z);
const spin = fwdSpeed*dt*2;
t.pivots.forEach(p=>p.rotation.x += spin);
t.mesh.position.copy(t.pos);
t.mesh.rotation.y = t.yaw;
}
function collide(){
for (let i=0;i<trucks.length;i++){
for (let j=i+1;j<trucks.length;j++){
const a = trucks[i], b = trucks[j];
const dx = b.pos.x - a.pos.x, dz = b.pos.z - a.pos.z;
const dist = Math.hypot(dx,dz);
const minDist = a.radius + b.radius;
if (dist < minDist && dist > 0.0001){
const nx = dx/dist, nz = dz/dist;
const overlap = minDist - dist;
a.pos.x -= nx*overlap*0.5; a.pos.z -= nz*overlap*0.5;
b.pos.x += nx*overlap*0.5; b.pos.z += nz*overlap*0.5;
const rvx = b.vel.x - a.vel.x, rvz = b.vel.z - a.vel.z;
const velAlongNormal = rvx*nx + rvz*nz;
if (velAlongNormal < 0){
const aToward = a.vel.x*nx + a.vel.z*nz;
const bToward = -(b.vel.x*nx + b.vel.z*nz);
const e = 0.45;
const jImp = -(1+e)*velAlongNormal / 2;
a.vel.x -= jImp*nx; a.vel.z -= jImp*nz;
b.vel.x += jImp*nx; b.vel.z += jImp*nz;
const approach = -velAlongNormal;
if (approach > 6){
const victim = aToward > bToward ? b : a;
const aggressor = aToward > bToward ? a : b;
victim.wreckTimer = 1.2;
victim.wreckSpin = (Math.random()-0.5)*8;
victim.vel.multiplyScalar(0.35);
if (aggressor.isPlayer && !victim.isPlayer) score += 100;
}
}
}
}
}
for (const t of trucks){
for (const ob of obstacles){
const dx = t.pos.x - ob.pos.x, dz = t.pos.z - ob.pos.z;
const dist = Math.hypot(dx,dz);
const minDist = t.radius + ob.radius;
if (dist < minDist && dist > 0.0001){
const nx = dx/dist, nz = dz/dist;
const overlap = minDist - dist;
t.pos.x += nx*overlap; t.pos.z += nz*overlap;
const vn = t.vel.x*nx + t.vel.z*nz;
if (vn < 0){
let rest = 0.4, slow = 0.85;
if (ob.type==='tire'){ rest=0.7; slow=0.92; }
else if (ob.type==='rubble'){ rest=0.3; slow=0.8; }
t.vel.x -= (1+rest)*vn*nx;
t.vel.z -= (1+rest)*vn*nz;
t.vel.multiplyScalar(slow);
if (t.isPlayer && vn < -6) score += 5;
if (vn < -12){ t.wreckTimer = 0.8; t.wreckSpin=(Math.random()-0.5)*6; }
}
}
}
const distC = Math.hypot(t.pos.x, t.pos.z);
const maxR = 70 - t.radius;
if (distC > maxR){
const nx = t.pos.x/distC, nz = t.pos.z/distC;
t.pos.x = nx*maxR; t.pos.z = nz*maxR;
const vn = t.vel.x*nx + t.vel.z*nz;
if (vn > 0){
t.vel.x -= 1.4*vn*nx;
t.vel.z -= 1.4*vn*nz;
}
}
}
}
function updateCamera(){
const forward = new THREE.Vector3(Math.sin(player.yaw),0,Math.cos(player.yaw));
const camPos = player.pos.clone().addScaledVector(forward, -13).add(new THREE.Vector3(0,7,0));
camera.position.lerp(camPos, 0.12);
const look = player.pos.clone().addScaledVector(forward, 6).add(new THREE.Vector3(0,2,0));
camera.lookAt(look);
}
function updateGame(dt){
timeLeft -= dt;
if (timeLeft <= 0){
timeLeft = 0;
gameOver = true;
finalScore.textContent = 'SCORE ' + score;
gameOverOverlay.style.display='flex';
updateHUD();
return;
}
if (player.wreckTimer>0){
player.throttle=0; player.steer=0;
} else {
let th = 0, st = 0;
if (keys['arrowup']||keys['w']) th += 1;
if (keys['arrowdown']||keys['s']) th -= 1;
if (keys['arrowleft']||keys['a']) st -= 1;
if (keys['arrowright']||keys['d']) st += 1;
player.throttle = th; player.steer = st;
}
for (let i=1;i<trucks.length;i++) aiUpdate(trucks[i], dt);
for (const t of trucks) updateTruck(t, dt);
collide();
updateCamera();
updateHUD();
}
let last = performance.now();
function animate(now){
requestAnimationFrame(animate);
const dt = Math.min((now-last)/1000, 0.05);
last = now;
if (!photoMode && !gameOver) updateGame(dt);
renderer.render(scene, camera);
}
addEventListener('resize', ()=>{
camera.aspect = innerWidth/innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
});
resetGame();
animate(performance.now());
})();
</script>
</body>
</html>
score and timeLeft variables (score = isDemo ? 5000 : 0; timeLeft = isDemo ? 20 : 90;) that the countdown, HUD and game-over check all read, so the 20-second clock and 5000 score are live match state, not a cosmetic overlay.P stops the physics step and every game-state update (timer, AI, input integration, collisions, camera follow) but keeps the render loop running, so the frozen frame stays on screen behind the DOM card.