Skip to content

Commit 61db53b

Browse files
committed
Midnight Ops: quiet start, clearer aiming, lethal headshots
- Night Drop starts in the glider field behind the hedgerow, out of the lane patrols' sight (they turn back further north); nobody notices you during the opening title card. Standing still at the start, nobody comes within 47 m. - Aiming: the sights sit well in front of your eye so they cover far less of the view, no extra edge darkening, a little more zoom, and a small dot-and-ring reticle. - A headshot always kills. The head and body hit zones now follow each soldier's real pose, so aiming or kneeling soldiers can be hit in the head. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cw2rM7HP4RvtJycwLW1jZr
1 parent 2536b01 commit 61db53b

8 files changed

Lines changed: 21 additions & 12 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎e63334287a3deaa3/ironveil/index.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
#cross i{position:absolute;background:var(--ink);box-shadow:0 0 2px rgba(0,0,0,.9)}
7575
#cross .u,#cross .d{width:2px;height:9px;left:-1px}#cross .l,#cross .r{width:9px;height:2px;top:-1px}
7676
#cross .c{width:2px;height:2px;left:-1px;top:-1px;opacity:.7}
77+
#ads{position:absolute;left:50%;top:50%;width:22px;height:22px;margin:-11px 0 0 -11px;border:1.5px solid rgba(236,228,206,.75);border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,.55),inset 0 0 0 1px rgba(0,0,0,.4);opacity:0;transition:opacity .12s}
78+
#ads i{position:absolute;left:50%;top:50%;width:4px;height:4px;margin:-2px 0 0 -2px;border-radius:50%;background:#ffd36b;box-shadow:0 0 0 1px rgba(0,0,0,.7),0 0 6px rgba(255,190,80,.8)}
7779
#hitm{position:absolute;left:50%;top:50%;width:26px;height:26px;margin:-13px 0 0 -13px;opacity:0}
7880
#hitm::before,#hitm::after{content:'';position:absolute;left:12px;top:0;width:2px;height:26px;background:linear-gradient(var(--ink) 0 32%,transparent 32% 68%,var(--ink) 68%)}
7981
#hitm::before{transform:rotate(45deg)}#hitm::after{transform:rotate(-45deg)}
@@ -199,6 +201,7 @@
199201
<div class="h-wave" id="h-wave"></div>
200202
<div class="h-fuse" id="h-fuse"></div>
201203
<div id="cross"><i class="u"></i><i class="d"></i><i class="l"></i><i class="r"></i><i class="c"></i></div>
204+
<div id="ads"><i></i></div>
202205
<div id="hitm"></div>
203206
<div class="h-dmg"><i></i><i></i><i></i></div>
204207
<div class="h-prompt" id="h-prompt"><span><kbd>E</kbd><em id="h-pt" style="font-style:normal"></em></span><u><s id="h-pb"></s></u></div>

‎e63334287a3deaa3/ironveil/js/enemy.js‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
return IK.qb;
183183
}
184184

185-
const hit = {}, tmp = { x: 0, z: 0 };
185+
const hit = {}, tmp = { x: 0, z: 0 }, HV = new THREE.Vector3();
186186
class Soldier {
187187
constructor(kind, x, z, o) {
188188
o = o || {}; this.kind = kind; this.x = x; this.z = z; this.h = o.face || 0; this.hp = kind === 's' ? 140 : 45; this.alive = true;
@@ -209,6 +209,7 @@
209209
const fx = Math.sin(this.h), fz = Math.cos(this.h), dot = d > 0.01 ? (dx * fx + dz * fz) / d : 1;
210210
const range = (this.state === 'combat' ? 70 : 34) * (P.crouchK > 0.5 ? 0.62 : 1) * (1 + 0.5 * P.noise);
211211
this.los = P.alive && d < range && (dot > (this.state === 'combat' ? -0.3 : 0.25) || d < 2.5) && MO.phys.los(this.x, 1.55 - this.crouch * 0.5, this.z, px, P.pos.y + P.eye - 0.15, pz);
212+
if (this.los && MO.mission.state === 'intro' && this.state !== 'combat') this.los = false; // nobody notices you during the opening title
212213
if (this.los) { this.seen.x = px; this.seen.z = pz; this.seen.t = MO.time;
213214
if (this.state !== 'combat') { this.aware += (0.14 + 0.06) * (2.6 / Math.max(0.35, d / 9)) * (P.crouchK > 0.5 ? 0.55 : 1) * (1 + P.noise); if (this.aware >= 1) { this.alert(px, pz, true); EN.shout(this.x, this.z, 30, px, pz); MO.emit('spotted', this); } } }
214215
else if (this.state !== 'combat') this.aware = Math.max(0, this.aware - 0.05);
@@ -249,6 +250,9 @@
249250
else if (this.tok) { this.tok = false; EN.tokens--; }
250251
this.flinch = Math.max(0, this.flinch - dt * 4);
251252
this.pose(dt, sp, d);
253+
// where the head and chest really are this frame, for hit tests (the head moves forward when aiming and kneeling)
254+
this.group.updateMatrixWorld(true); HV.set(0, 0.13, 0.02).applyMatrix4(this.b.head.matrixWorld); this.hx = HV.x; this.hy = HV.y; this.hz = HV.z;
255+
HV.set(0, 0, 0).applyMatrix4(this.b.chest.matrixWorld); this.cx = HV.x; this.cz = HV.z; this.ctop = Math.max(0.9, this.hy - 0.2);
252256
}
253257
shoot(d) {
254258
const P = MO.player, A = MO.audio, my = 1.42 - this.crouch * 0.45, mx = this.x + Math.sin(this.h) * 0.7, mz = this.z + Math.cos(this.h) * 0.7;
@@ -378,9 +382,10 @@
378382
EN.rayHit = (ox, oy, oz, dx, dy, dz, max) => {
379383
let best = max, be = null, head = false;
380384
for (const s of EN.list) { if (!s.alive) continue; const ex = s.x - ox, ez = s.z - oz; if (ex * dx + ez * dz < -1) continue;
381-
const k = 1 - s.crouch * 0.3, hy = 1.66 * k - s.crouch * 0.1;
382-
let t = segRay(ox, oy, oz, dx, dy, dz, s.x, 0.1, 1.42 * k, s.z, 0.25, best); if (t >= 0) { best = t; be = s; head = false; }
383-
const cx = s.x - ox, cy = hy - oy, cz = s.z - oz, tc = cx * dx + cy * dy + cz * dz; if (tc > 0 && tc < best + 0.3) { const px = cx - dx * tc, py = cy - dy * tc, pz = cz - dz * tc, d2 = px * px + py * py + pz * pz; if (d2 < 0.0256) { const th = tc - Math.sqrt(0.0256 - d2); if (th < best + 0.25) { best = Math.min(best, th); be = s; head = true; } } } }
385+
const k = 1 - s.crouch * 0.3, hx = s.hx === undefined ? s.x : s.hx, hy = s.hy === undefined ? 1.66 * k - s.crouch * 0.1 : s.hy, hz = s.hz === undefined ? s.z : s.hz;
386+
const bx = s.cx === undefined ? s.x : (s.x + s.cx) / 2, bz = s.cz === undefined ? s.z : (s.z + s.cz) / 2;
387+
let t = segRay(ox, oy, oz, dx, dy, dz, bx, 0.1, s.ctop || 1.42 * k, bz, 0.25, best); if (t >= 0) { best = t; be = s; head = false; }
388+
const cx = hx - ox, cy = hy - oy, cz = hz - oz, tc = cx * dx + cy * dy + cz * dz; if (tc > 0 && tc < best + 0.3) { const px = cx - dx * tc, py = cy - dy * tc, pz = cz - dz * tc, d2 = px * px + py * py + pz * pz; if (d2 < 0.0256) { const th = tc - Math.sqrt(0.0256 - d2); if (th < best + 0.25) { best = Math.min(best, th); be = s; head = true; } } } }
384389
if (!be) return null; res.e = be; res.t = best; res.head = head; return res;
385390
};
386391
// ammunition pouches left by the fallen

‎e63334287a3deaa3/ironveil/js/hud.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
const hp = Math.round(P.hp); if (last.hp !== hp) { last.hp = hp; el['h-hp'].classList.toggle('on', hp < 100); el['h-hp'].classList.toggle('low', hp < 40); el['h-hpb'].style.width = hp + '%'; set('hl', el['h-hpl'], MO.T('Health')); }
4242
// crosshair opens with spread, hides when aiming
4343
const g = 5 + (W.spread || 0.03) * 520; el.cross.style.opacity = P.aimK > 0.5 || P.sprintK > 0.6 || W.reloading || !P.alive ? 0 : 0.85;
44+
const ad = P.aimK > 0.6 && !W.reloading && P.alive ? 1 : 0; if (last.ad !== ad) { last.ad = ad; document.getElementById('ads').style.opacity = ad; }
4445
const gk = g | 0; if (last.g !== gk) { last.g = gk; el.ct[0].style.top = (-g - 9) + 'px'; el.ct[1].style.top = g + 'px'; el.ct[2].style.left = (-g - 9) + 'px'; el.ct[3].style.left = g + 'px'; }
4546
// being seen: a meter that fills while a soldier is working out what you are, red once the fight is on
4647
let aw = 0; for (const s of MO.enemies.list) if (s.alive && s.state !== 'combat' && s.aware > aw) aw = s.aware;

‎e63334287a3deaa3/ironveil/js/maps/hamlet.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@
9393

9494

9595
L.targets = [{ id: 'A', label: 'A', kind: 'flak', x: -18, z: 17, ry: 1.0 }, { id: 'B', label: 'B', kind: 'flak', x: 30, z: 15, ry: -1.3 }, { id: 'C', label: 'C', kind: 'flak', x: -16, z: -42.5, ry: 2.4 }];
96-
L.spawn = { x: laneX(66) + 0.4, z: 66, yaw: 0 };
96+
L.spawn = { x: -27, z: 67, yaw: -0.22 }; // the glider field, behind the hedgerow: a quiet start
9797
/* soldiers on the map at the start: kind, post, and a patrol route if they walk one */
9898
L.posts = [
99-
{ k: 'r', x: 0.5, z: 38, path: [[0.5, 38], [-1, 6], [0.8, 38]] }, { k: 'r', x: -1.5, z: 36, path: [[-1.5, 36], [1, 4], [-1.4, 36]], lag: 1.6 },
99+
{ k: 'r', x: 0.5, z: 30, path: [[0.5, 30], [-1, 6], [0.8, 30]] }, { k: 'r', x: -1.5, z: 28, path: [[-1.5, 28], [1, 4], [-1.4, 28]], lag: 1.6 },
100100
{ k: 'r', x: -9, z: 20.5, face: 1.5 }, { k: 'r', x: -15.5, z: 20, face: 2.2 }, { k: 's', x: -21, z: 14, face: 0.8 },
101101
{ k: 's', x: 4.8, z: -5.2, face: 0.2 }, { k: 'r', x: -4.6, z: -10.8, face: 0.1 },
102102
{ k: 'r', x: 27.5, z: 18, face: -1.2 }, { k: 'r', x: 33, z: 12.5, face: -2.4 }, { k: 'r', x: 16, z: 28, path: [[16, 28], [42, 30], [44, 4], [14, 4]] },

‎e63334287a3deaa3/ironveil/js/player.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
P.eye = MO.lerp(1.66, 1.02, P.crouchK) - land * 0.09 - dead * 1.1;
5858
cam.position.set(P.pos.x + Math.cos(P.yaw) * bx, P.pos.y + Math.max(0.22, P.eye + by), P.pos.z - Math.sin(P.yaw) * bx);
5959
cam.rotation.set(P.pitch + kp, P.yaw + ky, roll + dead * 0.9 + Math.sin(bob) * 0.004 * amp, 'YXZ');
60-
const fov = S.fov + 5 * P.sprintK - (S.fov - 52) * P.aimK * 0.62; if (Math.abs(cam.fov - fov) > 0.01) { cam.fov = fov; cam.updateProjectionMatrix(); }
60+
const fov = S.fov + 5 * P.sprintK - (S.fov - 50) * P.aimK * 0.72; if (Math.abs(cam.fov - fov) > 0.01) { cam.fov = fov; cam.updateProjectionMatrix(); }
6161
const u = MO.R.mFinal.uniforms; u.uHurt.value = MO.damp(u.uHurt.value, hurtK, 10, dt); u.uLow.value = MO.damp(u.uLow.value, P.alive ? MO.sat((45 - P.hp) / 45) : 1, 6, dt); u.uAim.value = P.aimK;
6262
P.bob = bob; P.bobAmp = amp; P.landK = land;
6363
};

‎e63334287a3deaa3/ironveil/js/render.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
vec3 t = aces(c); float tl = dot(t, vec3(0.2126, 0.7152, 0.0722)); t = mix(vec3(tl), t, 0.9 - 0.25 * smoothstep(0.6, 1.0, tl));
6464
t += vec3(-0.012, 0.004, 0.022) * (1.0 - smoothstep(0.0, 0.35, tl)); // cool shadows
6565
t *= mix(vec3(1.0), vec3(1.05, 1.0, 0.93), smoothstep(0.45, 1.0, tl)); // warm highlights
66-
float vig = smoothstep(0.95, 0.25, sqrt(r2) * (1.25 + 0.25 * uAim)); t *= mix(0.42, 1.0, vig);
66+
float vig = smoothstep(0.95, 0.25, sqrt(r2) * (1.25 - 0.15 * uAim)); t *= mix(0.42, 1.0, vig);
6767
float tg = dot(t, vec3(0.299, 0.587, 0.114)); t = mix(t, vec3(tg) * vec3(1.0, 0.9, 0.88), uLow * 0.6);
6868
t = mix(t, vec3(0.5, 0.02, 0.0) * (0.4 + tg), uHurt * smoothstep(0.1, 0.5, r2 * 1.6));
6969
t = pow(max(t, 0.0), vec3(1.0 / 2.2));

‎e63334287a3deaa3/ironveil/js/weapon.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Midnight Ops: the Thompson. 30 rounds, about 700 a minute, 26 damage a round (head x2.2), hits are instant.
1+
/* Midnight Ops: the Thompson. 30 rounds, about 700 a minute, 26 damage a round, a headshot always kills, hits are instant.
22
The gun's motion is a handful of damped springs kicked by impulses (recoil, look sway, landing), plus a walk bob
33
tied to the player's stride. The reload is hand-written keyframes for the left hand and the magazine; its sounds
44
fire at set times in the same timeline. */
@@ -58,7 +58,7 @@
5858
// the gun's camera has a narrower field of view than the world's: bring the muzzle point to where it appears
5959
const ex = eh ? ox + v1.x * eh.t : ox + v1.x * d, ey = eh ? oy + v1.y * eh.t : oy + v1.y * d, ez = eh ? oz + v1.z * eh.t : oz + v1.z * d;
6060
MO.fx.tracer(v2.x, v2.y, v2.z, ex, ey, ez, true);
61-
if (eh) { P.hits++; const dmg = DMG * (eh.head ? 2.2 : 1) * (eh.t > 60 ? 0.75 : 1); MO.fx.impact(ex, ey, ez, -v1.x, 0.2, -v1.z, 'flesh'); A && A.play('hit_flesh', { x: ex, y: ey, z: ez, vol: 0.8 });
61+
if (eh) { P.hits++; const dmg = eh.head ? 999 : DMG * (eh.t > 60 ? 0.75 : 1); // a headshot always kills MO.fx.impact(ex, ey, ez, -v1.x, 0.2, -v1.z, 'flesh'); A && A.play('hit_flesh', { x: ex, y: ey, z: ez, vol: 0.8 });
6262
const killed = eh.e.hit(dmg, eh.head, v1.x, v1.z); MO.emit('hit', eh.head, killed); }
6363
else if (wh) { tag = hit.box ? hit.box.tag : MO.ground.at(hit.x, hit.z).kind; if (tag === 'stone' && !hit.box) tag = 'stone';
6464
MO.fx.impact(hit.x, hit.y, hit.z, hit.nx, hit.ny, hit.nz, tag);
@@ -110,7 +110,7 @@
110110
const aim = P.aimK, run = P.sprintK * (1 - aim), bobA = P.bobAmp * (1 - 0.85 * aim), bx = Math.cos(P.bob) * 0.006 * bobA * (1 + run), by = Math.abs(Math.sin(P.bob)) * -0.008 * bobA * (1 + run * 1.5), t = MO.time;
111111
const br = Math.sin(t * 1.3) * 0.0016 * (1 - 0.6 * aim), br2 = Math.sin(t * 0.9 + 1) * 0.0012;
112112
// aim: bring the rear sight onto the eye line
113-
const ax = -M.sight.x, ay = -M.sight.y, az = -0.09 - M.sight.z;
113+
const ax = -M.sight.x, ay = -M.sight.y, az = -0.24 - M.sight.z; // eye well behind the rear sight, so the sights stay small and the view open
114114
root.position.set(MO.lerp(HIP.p[0], ax, aim) + bx + sx * 0.0035 - run * 0.05 + rx,
115115
MO.lerp(HIP.p[1], ay, aim) + by + br + dy * 0.02 - drop - run * 0.035 - P.crouchK * 0.008 * (1 - aim) + sy * -0.003,
116116
MO.lerp(HIP.p[2], az, aim) + kz * 0.016 * (1 - 0.45 * aim) + run * 0.06);

0 commit comments

Comments
 (0)