Prompt specification
Build or customize the Three.js 3D scene "Follow a message through delayed communication links" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Follow a message through delayed communication links
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/follow-a-message-through-delayed-communication-links-x2408
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts the 1918 armistice and its communication networks. Let users send an illustrative announcement through a period-inspired network with stated delays. Explain the timing model without inventing a real military order or its consequences. Voxel style.
Working Three.js Starter (follow-a-message-through-delayed-communication-links-x2408):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The Armistice Signal — 11 November 1918</title>
<style>
:root {
color-scheme: dark;
--ink: #eef0e7;
--muted: #aeb8b7;
--panel: rgba(15, 22, 27, 0.91);
--line: rgba(232, 218, 183, 0.22);
--gold: #e1c98f;
--cyan: #7dd3fc;
--orange: #f2a66f;
--green: #93c47d;
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #101820;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button, select {
font: inherit;
}
button {
cursor: pointer;
}
button:focus-visible,
select:focus-visible,
summary:focus-visible {
outline: 2px solid var(--cyan);
outline-offset: 2px;
}
#viewport {
position: fixed;
inset: 0;
}
#viewport canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
}
#loading {
position: fixed;
inset: 0;
z-index: 50;
display: grid;
place-items: center;
padding: 30px;
text-align: center;
background: #101820;
color: var(--gold);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
letter-spacing: 0.08em;
}
.panel {
position: fixed;
z-index: 10;
top: 18px;
left: 18px;
width: min(370px, calc(100vw - 36px));
max-height: calc(100vh - 36px);
overflow-y: auto;
padding: 20px;
border: 1px solid var(--line);
border-radius: 6px;
background: var(--panel);
box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
backdrop-filter: blur(15px);
}
.eyebrow {
margin: 0 0 8px;
color: var(--gold);
font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.18em;
text-transform: uppercase;
}
h1 {
margin: 0;
font: 800 clamp(27px, 4vw, 38px)/0.96 Georgia, "Times New Roman", serif;
letter-spacing: -0.025em;
}
.subtitle {
margin: 10px 0 15px;
color: var(--muted);
font-size: 13px;
line-height: 1.45;
}
.date-stamp {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin: 14px 0 18px;
padding: 10px 12px;
border-top: 1px solid var(--line);
border-bottom: 1px solid var(--line);
color: var(--gold);
font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.08em;
}
.date-stamp span:last-child {
color: var(--ink);
font-size: 17px;
}
.section-label {
display: block;
margin: 16px 0 7px;
color: var(--muted);
font: 700 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.13em;
text-transform: uppercase;
}
select {
width: 100%;
padding: 10px 11px;
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 4px;
background: #202a31;
color: var(--ink);
}
blockquote {
margin: 9px 0 0;
padding: 11px 12px;
border-left: 3px solid var(--gold);
background: rgba(225, 201, 143, 0.07);
color: #f0ead9;
font: italic 13px/1.45 Georgia, serif;
}
.channels {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 7px;
}
.channel {
min-height: 61px;
padding: 9px 10px;
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 4px;
background: rgba(255, 255, 255, 0.035);
color: var(--ink);
text-align: left;
transition: border-color 150ms, background 150ms, transform 150ms;
}
.channel:hover:not(:disabled) {
transform: translateY(-1px);
border-color: rgba(255, 255, 255, 0.3);
}
.channel[aria-pressed="true"] {
border-color: var(--channel-color);
background: color-mix(in srgb, var(--channel-color) 14%, transparent);
box-shadow: inset 0 -2px 0 var(--channel-color);
}
.channel strong {
display: block;
font-size: 12px;
line-height: 1.15;
}
.channel small {
display: block;
margin-top: 5px;
color: var(--muted);
font: 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.channel:disabled {
cursor: default;
opacity: 0.62;
}
.assumption-card {
margin-top: 10px;
padding: 12px;
border: 1px solid var(--line);
border-radius: 4px;
background: rgba(255, 255, 255, 0.025);
}
.assumption-card div {
display: flex;
justify-content: space-between;
gap: 12px;
margin: 4px 0;
color: var(--muted);
font-size: 11px;
line-height: 1.35;
}
.assumption-card div:first-child {
margin-top: 0;
}
.assumption-card div:last-child {
margin-bottom: 0;
}
.assumption-card b {
color: var(--ink);
text-align: right;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
details {
margin-top: 11px;
border-top: 1px solid var(--line);
padding-top: 10px;
color: var(--muted);
font-size: 11px;
line-height: 1.5;
}
summary {
cursor: pointer;
color: var(--gold);
font-weight: 700;
}
details p {
margin: 9px 0;
}
.formula {
display: block;
margin: 8px 0;
padding: 9px;
border: 1px solid var(--line);
border-radius: 3px;
color: var(--ink);
background: rgba(0, 0, 0, 0.16);
text-align: center;
font: 700 13px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.assumption-table {
width: 100%;
margin: 8px 0;
border-collapse: collapse;
font: 10px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.assumption-table th,
.assumption-table td {
padding: 5px 3px;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
text-align: left;
}
.assumption-table th {
color: var(--gold);
}
.actions {
display: grid;
grid-template-columns: 1fr 44px 44px;
gap: 7px;
margin-top: 14px;
}
.actions button {
min-height: 42px;
border: 1px solid rgba(255, 255, 255, 0.16);
border-radius: 4px;
color: var(--ink);
background: #253039;
font-weight: 750;
font-size: 12px;
}
.actions #send {
border-color: #d4bb80;
background: var(--gold);
color: #182026;
}
.actions #send:disabled {
cursor: default;
opacity: 0.55;
}
.safety-note {
margin: 13px 0 0;
padding-left: 10px;
border-left: 2px solid var(--orange);
color: #c9c5b9;
font-size: 10px;
line-height: 1.5;
}
.status {
position: fixed;
z-index: 10;
right: 18px;
bottom: 18px;
width: min(355px, calc(100vw - 36px));
padding: 16px;
border: 1px solid var(--line);
border-radius: 6px;
background: var(--panel);
box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
backdrop-filter: blur(15px);
}
.status-head {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 14px;
}
.status h2 {
margin: 0;
font-size: 15px;
line-height: 1.25;
}
#sample-delay {
flex: 0 0 auto;
color: var(--gold);
font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace;
}
#status-detail {
min-height: 32px;
margin: 7px 0 11px;
color: var(--muted);
font-size: 11px;
line-height: 1.45;
}
.progress-track {
height: 5px;
overflow: hidden;
border-radius: 10px;
background: rgba(255, 255, 255, 0.1);
}
#progress {
width: 0;
height: 100%;
background: linear-gradient(90deg, var(--gold), var(--cyan));
transition: width 80ms linear;
}
.clock-row {
display: flex;
justify-content: space-between;
gap: 10px;
margin: 7px 0 12px;
color: var(--muted);
font: 10px ui-monospace, SFMono-Regular, Menlo, monospace;
}
#clock {
color: var(--ink);
}
.timeline-title {
margin: 0 0 7px;
color: var(--gold);
font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.12em;
text-transform: uppercase;
}
#timeline {
max-height: 190px;
overflow-y: auto;
margin: 0;
padding: 0;
list-style: none;
}
#timeline:empty::after {
content: "The event timeline will appear here.";
color: #7e898b;
font-size: 11px;
}
#timeline li {
display: grid;
grid-template-columns: 12px 1fr auto;
align-items: start;
gap: 8px;
min-height: 31px;
padding: 6px 0;
border-top: 1px solid rgba(255, 255, 255, 0.07);
color: #788487;
font-size: 10px;
line-height: 1.3;
}
#timeline li:first-child {
border-top: 0;
}
#timeline li .dot {
width: 7px;
height: 7px;
margin-top: 3px;
border-radius: 50%;
background: #4c595c;
}
#timeline li .event-time {
color: inherit;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
white-space: nowrap;
}
#timeline li.reached {
color: var(--ink);
}
#timeline li.reached .dot {
background: var(--green);
}
#timeline li.current {
color: var(--gold);
}
#timeline li.current .dot {
background: var(--gold);
box-shadow: 0 0 10px rgba(225, 201, 143, 0.8);
}
#node-card {
position: fixed;
z-index: 9;
top: 18px;
right: 18px;
width: min(280px, calc(100vw - 36px));
padding: 13px 15px;
border-left: 3px solid var(--gold);
background: rgba(15, 22, 27, 0.82);
color: var(--muted);
font-size: 11px;
line-height: 1.45;
pointer-events: none;
backdrop-filter: blur(10px);
}
#node-card strong {
display: block;
margin-bottom: 3px;
color: var(--ink);
font-size: 12px;
}
.help {
position: fixed;
z-index: 8;
left: 50%;
bottom: 19px;
transform: translateX(-50%);
padding: 7px 11px;
border-radius: 30px;
background: rgba(15, 22, 27, 0.7);
color: #aeb8b7;
font: 10px ui-monospace, SFMono-Regular, Menlo, monospace;
pointer-events: none;
backdrop-filter: blur(8px);
}
@media (max-width: 850px) {
.panel {
top: 10px;
left: 10px;
width: min(340px, calc(100vw - 20px));
max-height: 48vh;
padding: 15px;
}
.status {
right: 10px;
bottom: 10px;
width: min(330px, calc(100vw - 20px));
padding: 13px;
}
#node-card,
.help {
display: none;
}
#timeline {
max-height: 105px;
}
}
@media (max-width: 520px) {
.channels {
grid-template-columns: 1fr 1fr;
}
.channel {
min-height: 56px;
}
.status {
width: calc(100vw - 20px);
}
.status .timeline-title,
#timeline {
display: none;
}
}
</style>
</head>
<body>
<div id="viewport" aria-label="Interactive voxel scene of an armistice communications network"></div>
<div id="loading" role="status">LOADING THE 1918 SIGNAL NETWORK…</div>
<aside class="panel" aria-label="Armistice announcement controls">
<p class="eyebrow">A communication study · 11 November 1918</p>
<h1>The Armistice<br>Signal</h1>
<p class="subtitle">
A voxel diorama of how a notice could cross a period-inspired communications
network after the cessation of hostilities.
</p>
<div class="date-stamp">
<span>ARMISTICE</span>
<span>11:00</span>
</div>
<label class="section-label" for="message">Informational notice</label>
<select id="message">
<option value="notice">Armistice effective-time notice</option>
<option value="circulation">Illustrative circulation notice</option>
<option value="public">Public-style armistice notice</option>
</select>
<blockquote id="message-preview"></blockquote>
<label class="section-label" for="direction">Symbolic route</label>
<select id="direction">
<option value="across">Across the armistice line</option>
<option value="allied">Allied side only</option>
<option value="german">German side only</option>
</select>
<span class="section-label">Transmission medium</span>
<div class="channels" role="group" aria-label="Transmission medium">
<button class="channel" data-channel="phone" aria-pressed="false"
style="--channel-color: var(--cyan)">
<strong>Trench telephone</strong>
<small>H 3m · 2–6m/link</small>
</button>
<button class="channel" data-channel="telegraph" aria-pressed="true"
style="--channel-color: var(--gold)">
<strong>Field telegraph</strong>
<small>H 2m · 1–4m/link</small>
</button>
<button class="channel" data-channel="courier" aria-pressed="false"
style="--channel-color: var(--orange)">
<strong>Courier</strong>
<small>H 15m · 10–30m/link</small>
</button>
<button class="channel" data-channel="postal" aria-pressed="false"
style="--channel-color: #b7a5e8">
<strong>Postal circular</strong>
<small>H 3h · 3–6h/link</small>
</button>
</div>
<div class="assumption-card" aria-live="polite">
<div><span>Fixed handling</span><b id="handling-value"></b></div>
<div><span>Link assumption</span><b id="link-value"></b></div>
<div><span>Route hops</span><b id="hop-value"></b></div>
<div><span>Modeled range</span><b id="range-value"></b></div>
</div>
<details>
<summary>Timing model and historical limits</summary>
<p>
The model uses
<span class="formula">T = H + Σ Lᵢ</span>
where <b>H</b> is one fixed handling allowance and each
<b>Lᵢ</b> is a link delay sampled once from the selected channel’s band.
</p>
<table class="assumption-table">
<thead>
<tr><th>Medium</th><th>H</th><th>Each link</th></tr>
</thead>
<tbody>
<tr><td>Telephone</td><td>3m</td><td>2–6m</td></tr>
<tr><td>Telegraph</td><td>2m</td><td>1–4m</td></tr>
<tr><td>Courier</td><td>15m</td><td>10–30m</td></tr>
<tr><td>Postal</td><td>180m</td><td>180–360m</td></tr>
</tbody>
</table>
<p>
These bands are transparent <b>scenario assumptions</b>, not archival
measurements for 11 November 1918. Playback compresses every total into
roughly 12 seconds.
</p>
<p>
The 11:00 reference clock is used only for comparison; it is not an
archival dispatch timestamp. The landscape, relay points, and routes are
symbolic rather than geographic reconstructions.
</p>
</details>
<div class="actions">
<button id="send">Send notice</button>
<button id="pause" disabled aria-label="Pause or resume animation">Pause</button>
<button id="reset" aria-label="Reset simulation">Reset</button>
</div>
<p class="safety-note">
This prototype intentionally accepts only informational notices. It does
not issue, reconstruct, or imply a military order, and it does not simulate
battlefield consequences.
</p>
</aside>
<section class="status" aria-live="polite" aria-label="Transmission status">
<div class="status-head">
<h2 id="status-title">Ready to circulate a notice</h2>
<span id="sample-delay">SAMPLE —</span>
</div>
<p id="status-detail">
Choose a medium and send one of the non-operational informational notices.
</p>
<div class="progress-track" aria-hidden="true">
<div id="progress"></div>
</div>
<div class="clock-row">
<span id="clock">REFERENCE 11 NOV · 11:00</span>
<span>PLAYBACK COMPRESSED</span>
</div>
<p class="timeline-title">Modeled relay timeline</p>
<ol id="timeline"></ol>
</section>
<div id="node-card">
<strong>Armistice liaison point</strong>
A symbolic contact point representing liaison arrangements. It is not a
reconstruction of a named headquarters or the signing location.
</div>
<div class="help">
DRAG TO ORBIT · RIGHT-DRAG TO PAN · WHEEL TO ZOOM · CLICK A NODE
</div>
<script type="module">
const loading = document.getElementById("loading");
try {
const THREE = await import(
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js"
);
boot(THREE);
} catch (error) {
console.error(error);
loading.textContent =
"Unable to load Three.js. Check the network connection and reload this file.";
}
function boot(THREE) {
const $ = (selector) => document.querySelector(selector);
const viewport = $("#viewport");
const messageSelect = $("#message");
const directionSelect = $("#direction");
const messagePreview = $("#message-preview");
const channelButtons = [...document.querySelectorAll(".channel")];
const sendButton = $("#send");
const pauseButton = $("#pause");
const resetButton = $("#reset");
const timeline = $("#timeline");
const statusTitle = $("#status-title");
const statusDetail = $("#status-detail");
const sampleDelay = $("#sample-delay");
const progress = $("#progress");
const clockLabel = $("#clock");
const nodeCard = $("#node-card");
const messages = {
notice:
"Notice: The armistice took effect at 11:00 a.m. on 11 November 1918.",
circulation:
"Illustrative circulation: armistice information is moving through this period-inspired network. This is not a historical dispatch.",
public:
"Public-style notice: The agreed cessation of hostilities under the armistice began at 11:00 a.m. on 11 November 1918."
};
const channels = {
phone: {
name: "Trench telephone",
handling: 3,
min: 2,
max: 6,
color: 0x7dd3fc
},
telegraph: {
name: "Field telegraph",
handling: 2,
min: 1,
max: 4,
color: 0xe1c98f
},
courier: {
name: "Courier",
handling: 15,
min: 10,
max: 30,
color: 0xf2a66f
},
postal: {
name: "Postal circular",
handling: 180,
min: 180,
max: 360,
color: 0xb7a5e8
}
};
const routes = {
across: [0, 1, 2, 3, 4],
allied: [0, 1, 2],
german: [2, 3, 4]
};
let selectedChannel = "telegraph";
let run = null;
let sendCounter = 0;
const playbackDuration = 12;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x101820);
scene.fog = new THREE.Fog(0x101820, 20, 39);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
viewport.appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xc7d9e8, 0x273124, 2.1);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xffe1b2, 3.1);
sun.position.set(-8, 14, 9);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -12;
sun.shadow.camera.right = 12;
sun.shadow.camera.top = 12;
sun.shadow.camera.bottom = -12;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 35;
sun.shadow.bias = -0.0006;
scene.add(sun);
const coolFill = new THREE.DirectionalLight(0x7ba8d9, 1.15);
coolFill.position.set(9, 6, -8);
scene.add(coolFill);
const world = new THREE.Group();
scene.add(world);
const palette = {
earth: [0x4d5542, 0x596047, 0x45513f, 0x625d48],
sand: 0xa79b74,
dark: 0x202a2b,
blue: 0x6d91ad,
rust: 0x9d6554,
cream: 0xe3d8b8
};
function standardMaterial(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.88,
metalness: 0.02,
...options
});
}
function addBox(
width, height, depth, color,
x = 0, y = 0, z = 0,
parent = world,
options = {}
) {
const material = color?.isMaterial
? color
: standardMaterial(color, options);
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(width, height, depth),
material
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addCylinder(
radiusTop, radiusBottom, height, color,
x = 0, y = 0, z = 0,
parent = world,
radialSegments = 8
) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(
radiusTop, radiusBottom, height, radialSegments
),
standardMaterial(color)
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function makeLabel(text, accent = "#e1c98f", width = 2.75) {
const canvas = document.createElement("canvas");
canvas.width = 640;
canvas.height = 160;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "rgba(12, 18, 23, 0.90)";
ctx.fillRect(4, 4, 632, 152);
ctx.strokeStyle = accent;
ctx.lineWidth = 5;
ctx.strokeRect(5, 5, 630, 150);
const lines = text.split("\n");
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = accent;
lines.forEach((line, index) => {
let fontSize = lines.length > 1 ? 34 : 38;
ctx.font = `700 ${fontSize}px ui-monospace, monospace`;
while (ctx.measureText(line).width > 590 && fontSize > 20) {
fontSize -= 2;
ctx.font = `700 ${fontSize}px ui-monospace, monospace`;
}
const y = lines.length === 1
? 80
: 80 + (index - (lines.length - 1) / 2) * 47;
ctx.fillText(line, 320, y);
});
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
})
);
sprite.scale.set(width, width * 0.25, 1);
sprite.userData.isLabel = true;
return sprite;
}
// Seeded random values keep the diorama stable between reloads.
let sceneSeed = 12783;
function sceneRandom() {
sceneSeed = (sceneSeed * 1664525 + 1013904223) >>> 0;
return sceneSeed / 4294967296;
}
// Raised voxel terrain platform.
addBox(
15.4, 0.52, 9.2,
new THREE.MeshStandardMaterial({
color: 0x273039,
roughness: 0.96
}),
0, -0.46, 0
);
const tileGeometry = new THREE.BoxGeometry(0.88, 1, 0.78);
for (let ix = 0; ix < 15; ix++) {
for (let iz = 0; iz < 9; iz++) {
const height = 0.16 + sceneRandom() * 0.23;
const color = palette.earth[
Math.floor(sceneRandom() * palette.earth.length)
];
const tile = new THREE.Mesh(
tileGeometry,
standardMaterial(color)
);
tile.position.set(
-6.16 + ix * 0.88,
-0.2 + height / 2,
-3.12 + iz * 0.78
);
tile.scale.y = height;
tile.castShadow = true;
tile.receiveShadow = true;
world.add(tile);
}
}
// Two opposing trench lines.
for (const side of [-1, 1]) {
addBox(
0.88, 0.12, 6.3,
palette.dark,
side * 4.85, 0.23, 0
);
for (let z = -2.85; z <= 2.85; z += 0.45) {
for (const offset of [-0.52, 0.52]) {
const bagColor = sceneRandom() > 0.5 ? 0x8f856a : 0x746e58;
addBox(
0.34, 0.22, 0.42,
bagColor,
side * 4.85 + offset, 0.38, z
);
}
}
// Barbed-wire posts and rails, all built from narrow boxes.
for (let z = -3; z <= 3; z += 0.8) {
addBox(
0.055, 1.25, 0.055,
0x3b3b34,
side * 3.72, 0.72, z
);
}
for (const y of [0.48, 0.76, 1.02]) {
addBox(
0.035, 0.035, 6.25,
0x55534a,
side * 3.72, y, 0
);
}
}
// A symbolic ceasefire line made from pale voxel markers.
for (let z = -2.6; z <= 2.6; z += 0.52) {
if (Math.abs(z) > 0.55) {
addBox(
0.13, 0.08, 0.31,
palette.cream,
0, 0.26, z
);
}
}
function makeBuilding(x, z, color, scale = 1) {
const group = new THREE.Group();
group.position.set(x, 0.12, z);
group.scale.setScalar(scale);
world.add(group);
addBox(1.15, 0.85, 1.35, color, 0, 0.43, 0, group);
addBox(0.88, 0.42, 1.02, color, 0, 1.04, 0, group);
addBox(0.55, 0.27, 0.72, color, 0, 1.36, 0, group);
const windowMaterial = standardMaterial(0xe0c77f, {
emissive: 0x6f5320,
emissiveIntensity: 0.35
});
addBox(0.17, 0.24, 0.025, windowMaterial, -0.24, 0.57, 0.685, group);
addBox(0.17, 0.24, 0.025, windowMaterial, 0.24, 0.57, 0.685, group);
addBox(0.28, 0.42, 0.03, 0x3c3329, 0, 0.24, 0.69, group);
return group;
}
makeBuilding(-6.0, -2.95, 0x74634f, 0.85);
makeBuilding(-5.8, 2.85, 0x675b4b, 0.72);
makeBuilding(6.0, 2.95, 0x65584c, 0.82);
makeBuilding(6.1, -2.85, 0x735e4e, 0.65);
function makeTree(x, z, height = 1.2) {
const group = new THREE.Group();
group.position.set(x, 0.12, z);
world.add(group);
addBox(
0.18, height, 0.18,
0x514536,
0, height / 2, 0, group
);
addBox(
0.72, 0.62, 0.72,
0x3e523c,
0, height + 0.13, 0, group
);
addBox(
0.5, 0.45, 0.5,
0x4d6044,
0.18, height + 0.49, 0.08, group
);
}
[
[-6.3, 1.2, 1.25], [-5.6, 0.3, 0.95],
[-3.2, -3.1, 1.12], [3.5, 3.2, 1.08],
[5.5, -1.7, 1.28], [6.4, 0.9, 0.92]
].forEach(([x, z, h]) => makeTree(x, z, h));
function makeVoxelPerson(x, z, coatColor, facing = 1) {
const group = new THREE.Group();
group.position.set(x, 0.33, z);
group.rotation.y = facing > 0 ? 0 : Math.PI;
world.add(group);
addBox(0.17, 0.34, 0.18, 0x2c3030, -0.11, 0.17, 0, group);
addBox(0.17, 0.34, 0.18, 0x2c3030, 0.11, 0.17, 0, group);
addBox(0.38, 0.52, 0.25, coatColor, 0, 0.57, 0, group);
addBox(0.12, 0.38, 0.14, coatColor, -0.25, 0.58, 0, group);
addBox(0.12, 0.38, 0.14, coatColor, 0.25, 0.58, 0, group);
addBox(0.27, 0.27, 0.27, 0xc7aa87, 0, 0.96, 0, group);
addBox(0.36, 0.12, 0.36, 0x42483f, 0, 1.12, 0, group);
}
makeVoxelPerson(-5.25, -1.7, palette.blue, 1);
makeVoxelPerson(-4.95, 1.7, 0x758b95, 1);
makeVoxelPerson(5.2, -1.5, palette.rust, -1);
makeVoxelPerson(4.95, 1.9, 0x876659, -1);
function makeFlag(x, z) {
const group = new THREE.Group();
group.position.set(x, 0.25, z);
world.add(group);
addBox(0.055, 1.45, 0.055, 0x4b4639, 0, 0.72, 0, group);
addBox(0.66, 0.38, 0.055, 0xe8e0cb, 0.34, 1.22, 0, group);
addBox(0.12, 0.12, 0.06, 0xa5453e, 0.48, 1.22, 0.04, group);
}
makeFlag(-0.72, 0.9);
makeFlag(0.72, 0.9);
// Generic communication nodes.
const nodeDefs = [
{
name: "Allied front trench",
label: "ALLIED FRONT",
color: 0x78a9cf,
position: new THREE.Vector3(-4.85, 0.31, 0),
description:
"A symbolic forward position on the Allied side. It is not a named unit or a reconstructed location."
},
{
name: "Divisional relay",
label: "DIVISIONAL RELAY",
color: 0x91b4ca,
position: new THREE.Vector3(-2.8, 0.35, -2.3),
description:
"A generic relay point illustrating the accumulation of handling and link delays. No historical relay is identified."
},
{
name: "Armistice liaison point",
label: "LIAISON POINT",
color: 0xe1c98f,
position: new THREE.Vector3(0, 0.35, 0),
description:
"A symbolic contact point representing liaison arrangements. It is not a reconstruction of a named headquarters or the signing location."
},
{
name: "Divisional relay",
label: "DIVISIONAL RELAY",
color: 0xc48a78,
position: new THREE.Vector3(2.8, 0.35, 2.3),
description:
"A generic relay on the German side of the symbolic network. The scene does not identify an archival route or office."
},
{
name: "German front trench",
label: "GERMAN FRONT",
color: 0xc48472,
position: new THREE.Vector3(4.85, 0.31, 0),
description:
"A symbolic forward position on the German side. It is not a named unit or a reconstructed location."
}
];
const nodes = [];
const hitboxes = [];
nodeDefs.forEach((definition, index) => {
const group = new THREE.Group();
group.position.copy(definition.position);
world.add(group);
const nodeMaterial = standardMaterial(definition.color, {
emissive: definition.color,
emissiveIntensity: 0.12,
roughness: 0.66
});
addBox(
0.76, 0.22, 0.76,
0x303b40,
0, 0.1, 0, group
);
addBox(
0.16, 1.13, 0.16,
0x536168,
0, 0.68, 0, group
);
const beacon = addBox(
0.5, 0.5, 0.5,
nodeMaterial,
0, 1.33, 0, group
);
const label = makeLabel(
definition.label,
`#${new THREE.Color(definition.color).getHexString()}`,
index === 2 ? 2.8 : 2.45
);
label.position.set(0, 1.95, 0);
group.add(label);
const hit = new THREE.Mesh(
new THREE.BoxGeometry(0.95, 2.4, 0.95),
new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0,
depthWrite: false
})
);
hit.position.y = 0.85;
hit.userData.nodeIndex = index;
group.add(hit);
hitboxes.push(hit);
const light = new THREE.PointLight(definition.color, 0.35, 4.2, 2);
light.position.set(0, 1.35, 0);
group.add(light);
nodes.push({
...definition,
group,
beacon,
light,
pulse: 0
});
});
const timeSign = makeLabel(
"11 NOV 1918\n11:00 · ARMISTICE",
"#e1c98f",
3.3
);
timeSign.position.set(0, 3.75, -2.6);
world.add(timeSign);
const genericSign = makeLabel(
"GENERIC SIGNAL NETWORK · NOT A GEOGRAPHIC RECONSTRUCTION",
"#8fa2a5",
4.2
);
genericSign.position.set(0, 0.7, 3.65);
world.add(genericSign);
// The graph edges are thin cuboids to preserve the voxel visual language.
const graphEdges = [
[0, 1],
[1, 2],
[2, 3],
[3, 4]
];
const edgeObjects = graphEdges.map(([a, b]) => {
const start = nodes[a].position.clone().add(new THREE.Vector3(0, 1.32, 0));
const end = nodes[b].position.clone().add(new THREE.Vector3(0, 1.32, 0));
const direction = end.clone().sub(start);
const length = direction.length();
const midpoint = start.clone().add(end).multiplyScalar(0.5);
const base = new THREE.Mesh(
new THREE.BoxGeometry(0.045, 0.045, length),
new THREE.MeshBasicMaterial({
color: 0x75878d,
transparent: true,
opacity: 0.28
})
);
base.position.copy(midpoint);
base.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 0, 1),
direction.clone().normalize()
);
world.add(base);
const active = new THREE.Mesh(
new THREE.BoxGeometry(0.085, 0.085, length),
new THREE.MeshBasicMaterial({
color: channels[selectedChannel].color,
transparent: true,
opacity: 0.92
})
);
active.position.copy(base.position);
active.quaternion.copy(base.quaternion);
active.visible = false;
world.add(active);
return { a, b, base, active };
});
function currentRoute() {
return routes[directionSelect.value];
}
function routeHasEdge(a, b) {
const route = currentRoute();
return route.some((node, index) => {
return (
(node === a && route[index + 1] === b) ||
(node === b && route[index + 1] === a)
);
});
}
function updateRouteAppearance() {
const color = channels[selectedChannel].color;
edgeObjects.forEach((edge) => {
const active = routeHasEdge(edge.a, edge.b);
edge.active.visible = active;
edge.base.visible = !active;
edge.active.material.color.setHex(color);
});
}
function formatDuration(minutes) {
const rounded = Math.round(minutes);
if (rounded < 60) {
return `${rounded} min`;
}
if (rounded % 60 === 0) {
return `${rounded / 60} h`;
}
return `${Math.floor(rounded / 60)} h ${rounded % 60} min`;
}
function formatRange(min, max) {
return `+${formatDuration(min)} to +${formatDuration(max)}`;
}
function referenceStamp(minutes = 0) {
const date = new Date(
Date.UTC(1918, 10, 11, 11, 0) + minutes * 60_000
);
const day = date.getUTCDate();
const hours = String(date.getUTCHours()).padStart(2, "0");
const mins = String(date.getUTCMinutes()).padStart(2, "0");
return `${day} Nov · ${hours}:${mins}`;
}
function refreshMessage() {
messagePreview.textContent = `“${messages[messageSelect.value]}”`;
}
function refreshAssumptions() {
const channel = channels[selectedChannel];
const hops = currentRoute().length - 1;
const min = channel.handling + channel.min * hops;
const max = channel.handling + channel.max * hops;
$("#handling-value").textContent = formatDuration(channel.handling);
$("#link-value").textContent = `${channel.min}–${channel.max} min`;
$("#hop-value").textContent = String(hops);
$("#range-value").textContent = formatRange(min, max);
channelButtons.forEach((button) => {
const selected = button.dataset.channel === selectedChannel;
button.setAttribute("aria-pressed", String(selected));
});
updateRouteAppearance();
}
function lockControls(locked) {
sendButton.disabled = locked;
messageSelect.disabled = locked;
directionSelect.disabled = locked;
channelButtons.forEach((button) => {
button.disabled = locked;
});
pauseButton.disabled = !run || run.completed;
}
function readyStatus() {
statusTitle.textContent = "Ready to circulate a notice";
statusDetail.textContent =
"The route shows information movement only. No order or battlefield consequence is simulated.";
sampleDelay.textContent = "SAMPLE —";
progress.style.width = "0%";
clockLabel.textContent = "REFERENCE 11 NOV · 11:00";
}
function resetSimulation() {
if (run) {
run.packets.forEach((packet) => scene.remove(packet));
}
run = null;
timeline.replaceChildren();
pauseButton.textContent = "Pause";
sendButton.textContent = "Send notice";
lockControls(false);
readyStatus();
updateRouteAppearance();
}
function mulberry32(seed) {
return function random() {
let value = seed += 0x6D2B79F5;
value = Math.imul(value ^ value >>> 15, value | 1);
value ^= value + Math.imul(value ^ value >>> 7, value | 61);
return ((value ^ value >>> 14) >>> 0) / 4294967296;
};
}
function makePacket(color) {
const group = new THREE.Group();
scene.add(group);
const material = new THREE.MeshBasicMaterial({ color });
const head = new THREE.Mesh(
new THREE.BoxGeometry(0.24, 0.24, 0.24),
material
);
group.add(head);
for (let i = 1; i <= 3; i++) {
const tail = new THREE.Mesh(
new THREE.BoxGeometry(0.12 - i * 0.015, 0.12 - i * 0.015, 0.12),
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.58 - i * 0.13
})
);
tail.position.z = -i * 0.19;
group.add(tail);
}
return group;
}
function buildTimelineRows() {
timeline.replaceChildren();
const rows = [];
const handlingRow = document.createElement("li");
handlingRow.innerHTML = `
<span class="dot"></span>
<span>Origin handling allowance</span>
<span class="event-time">${referenceStamp(run.handling)}</span>
`;
timeline.appendChild(handlingRow);
rows.push({
element: handlingRow,
start: 0,
end: run.handling
});
let cumulative = run.handling;
run.hops.forEach((hop, index) => {
cumulative += hop.delay;
const row = document.createElement("li");
row.innerHTML = `
<span class="dot"></span>
<span>${nodes[hop.from].name} → ${nodes[hop.to].name}</span>
<span class="event-time">${referenceStamp(cumulative)}</span>
`;
timeline.appendChild(row);
rows.push({
element: row,
start: cumulative - hop.delay,
end: cumulative
});
hop.arrival = cumulative;
});
run.rows = rows;
}
function startRun() {
const channel = channels[selectedChannel];
const route = [...currentRoute()];
const random = mulberry32(9041 + sendCounter * 101);
sendCounter += 1;
const hops = [];
for (let i = 0; i < route.length - 1; i++) {
const delay =
channel.min +
Math.floor(random() * (channel.max - channel.min + 1));
hops.push({
from: route[i],
to: route[i + 1],
delay,
arrival: 0
});
}
const total =
channel.handling + hops.reduce((sum, hop) => sum + hop.delay, 0);
run = {
channel: selectedChannel,
route,
hops,
handling: channel.handling,
total,
elapsed: 0,
virtualTime: 0,
paused: false,
completed: false,
packets: [],
rows: []
};
hops.forEach((hop) => {
run.packets.push(makePacket(channel.color));
});
buildTimelineRows();
updateRouteAppearance();
lockControls(true);
sendButton.textContent = "Transmission running";
pauseButton.textContent = "Pause";
statusTitle.textContent = "Preparing the notice";
statusDetail.textContent =
`${channel.name}: ${formatDuration(channel.handling)} fixed handling allowance.`;
sampleDelay.textContent = `SAMPLE +${formatDuration(total)}`;
}
function updateRun(delta) {
if (!run || run.paused || run.completed) {
updateTimelineClasses();
return;
}
const previousTime = run.virtualTime;
run.elapsed += delta;
run.virtualTime = Math.min(
run.total,
(run.elapsed / playbackDuration) * run.total
);
run.hops.forEach((hop) => {
if (
previousTime < hop.arrival &&
run.virtualTime >= hop.arrival
) {
nodes[hop.to].pulse = 1;
}
});
run.hops.forEach((hop, index) => {
const packet = run.packets[index];
const startTime = hop.arrival - hop.delay;
const progress = THREE.MathUtils.clamp(
(run.virtualTime - startTime) / hop.delay,
0,
1
);
const visible =
run.virtualTime >= startTime &&
run.virtualTime <= hop.arrival;
packet.visible = visible;
if (visible) {
const from = nodes[hop.from].position.clone()
.add(new THREE.Vector3(0, 1.32, 0));
const to = nodes[hop.to].position.clone()
.add(new THREE.Vector3(0, 1.32, 0));
const direction = to.clone().sub(from);
packet.position.copy(from).lerp(to, progress);
packet.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 0, 1),
direction.normalize()
);
}
});
if (run.virtualTime < run.handling) {
statusTitle.textContent = "Preparing the notice";
statusDetail.textContent =
`${run.channel === "postal" ? "Postal" : "Network"} handling allowance: ` +
`${formatDuration(run.handling)}.`;
} else {
const activeHop = run.hops.find((hop) => {
return (
run.virtualTime >= hop.arrival - hop.delay &&
run.virtualTime <= hop.arrival
);
});
if (activeHop) {
statusTitle.textContent = run.paused
? "Paused — in transit"
: "In transit through the network";
statusDetail.textContent =
`${nodes[activeHop.from].name} → ${nodes[activeHop.to].name}. ` +
`This link sampled ${formatDuration(activeHop.delay)}.`;
}
}
if (run.virtualTime >= run.total && !run.completed) {
run.completed = true;
run.packets.forEach((packet) => {
packet.visible = false;
});
nodes[run.route[run.route.length - 1]].pulse = 1;
statusTitle.textContent = "Delivered in the model";
statusDetail.textContent =
`The informational notice reached ` +
`${nodes[run.route[run.route.length - 1]].name}. ` +
`This is a simulation result, not an archival event.`;
sendButton.textContent = "Send another";
lockControls(false);
pauseButton.disabled = true;
}
progress.style.width = `${(run.virtualTime / run.total) * 100}%`;
clockLabel.textContent =
`REFERENCE +${formatDuration(run.virtualTime)} · ${referenceStamp(run.virtualTime)}`;
updateTimelineClasses();
}
function updateTimelineClasses() {
if (!run) return;
run.rows.forEach((row) => {
const reached = run.virtualTime >= row.end;
const current =
!run.completed &&
run.virtualTime >= row.start &&
run.virtualTime < row.end;
row.element.classList.toggle("reached", reached);
row.element.classList.toggle("current", current);
});
}
// Custom camera controls: orbit, pan, zoom, and node picking.
const controls = {
azimuth: 0.68,
polar: 0.96,
radius: 18.7,
target: new THREE.Vector3(0, 0.8, 0)
};
function updateCamera() {
const sinPolar = Math.sin(controls.polar);
camera.position.set(
controls.target.x +
controls.radius * sinPolar * Math.sin(controls.azimuth),
controls.target.y +
controls.radius * Math.cos(controls.polar),
controls.target.z +
controls.radius * sinPolar * Math.cos(controls.azimuth)
);
camera.lookAt(controls.target);
}
function resetCamera() {
controls.azimuth = 0.68;
controls.polar = 0.96;
controls.radius = 18.7;
controls.target.set(0, 0.8, 0);
updateCamera();
}
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
let pointerState = null;
renderer.domElement.addEventListener("contextmenu", (event) => {
event.preventDefault();
});
renderer.domElement.addEventListener("pointerdown", (event) => {
pointerState = {
id: event.pointerId,
x: event.clientX,
y: event.clientY,
startX: event.clientX,
startY: event.clientY,
moved: false,
button: event.button
};
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointerState || pointerState.id !== event.pointerId) return;
const dx = event.clientX - pointerState.x;
const dy = event.clientY - pointerState.y;
pointerState.x = event.clientX;
pointerState.y = event.clientY;
if (
Math.hypot(
event.clientX - pointerState.startX,
event.clientY - pointerState.startY
) > 5
) {
pointerState.moved = true;
}
if (pointerState.button === 2 || event.shiftKey) {
const right = new THREE.Vector3()
.setFromMatrixColumn(camera.matrix, 0);
const up = new THREE.Vector3()
.setFromMatrixColumn(camera.matrix, 1);
const scale = controls.radius * 0.00115;
controls.target.addScaledVector(right, -dx * scale);
controls.target.addScaledVector(up, dy * scale);
controls.target.x = THREE.MathUtils.clamp(
controls.target.x, -7, 7
);
controls.target.z = THREE.MathUtils.clamp(
controls.target.z, -5, 5
);
} else {
controls.azimuth -= dx * 0.006;
controls.polar = THREE.MathUtils.clamp(
controls.polar + dy * 0.005,
0.34,
1.35
);
}
updateCamera();
});
renderer.domElement.addEventListener("pointerup", (event) => {
if (!pointerState || pointerState.id !== event.pointerId) return;
if (!pointerState.moved) {
const rect = renderer.domElement.getBoundingClientRect();
pointer.x =
((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y =
-((event.clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(pointer, camera);
const hit = raycaster.intersectObjects(hitboxes, false)[0];
if (hit) {
const node = nodes[hit.object.userData.nodeIndex];
nodeCard.innerHTML = `
<strong>${node.name}</strong>
${node.description}
`;
}
}
pointerState = null;
});
renderer.domElement.addEventListener("pointercancel", () => {
pointerState = null;
});
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
controls.radius = THREE.MathUtils.clamp(
controls.radius + event.deltaY * 0.012,
9.5,
28
);
updateCamera();
},
{ passive: false }
);
messageSelect.addEventListener("change", () => {
refreshMessage();
if (run?.completed) resetSimulation();
});
directionSelect.addEventListener("change", () => {
refreshAssumptions();
if (run?.completed) resetSimulation();
});
channelButtons.forEach((button) => {
button.addEventListener("click", () => {
selectedChannel = button.dataset.channel;
refreshAssumptions();
if (run?.completed) resetSimulation();
});
});
sendButton.addEventListener("click", startRun);
pauseButton.addEventListener("click", () => {
if (!run || run.completed) return;
run.paused = !run.paused;
pauseButton.textContent = run.paused ? "Resume" : "Pause";
updateRun(0);
});
resetButton.addEventListener("click", resetSimulation);
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.setSize(width, height);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
refreshMessage();
refreshAssumptions();
readyStatus();
resetCamera();
loading.remove();
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
updateRun(delta);
nodes.forEach((node) => {
node.pulse = Math.max(0, node.pulse - delta * 1.65);
const pulse = node.pulse;
node.beacon.material.emissiveIntensity = 0.12 + pulse * 2.8;
node.beacon.scale.setScalar(1 + pulse * 0.28);
node.light.intensity = 0.35 + pulse * 2.2;
});
renderer.render(scene, camera);
}
animate();
}
</script>
</body>
</html>
```