diff --git a/CHANGELOG.md b/CHANGELOG.md
index dc7bad2..39252dc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ All notable changes to this project are documented here. The project follows
- Zooming is smoother on big maps: while you zoom, cities and ships keep their picture and are only redrawn sharp once the zoom stops, instead of being repainted at every small step.
- The graphics card draws the coastlines with fewer points when you zoom out, where the extra detail was smaller than a pixel, so the map costs it a lot less work, which helps phones most.
- The map leaves far less memory behind it on every frame for the browser to clean up while you play.
+- Settings › Viewport info is now Diagnostic info: besides your screen's size, it shows how the map is drawn (by the graphics card or in 2D, and why) and how fast, ready to copy into a bug report.
## [2.9.1] — 2026-11-04
diff --git a/site/i18n/de.js b/site/i18n/de.js
index 809873c..66b00a6 100644
--- a/site/i18n/de.js
+++ b/site/i18n/de.js
@@ -1610,7 +1610,6 @@
"common.vendor_tac":"Hersteller-TAC",
"common.venus":"Venus",
"common.via_rs":"über RS",
-"common.viewport_info":"Ansichtsinfo",
"common.vigilante":"Selbstjustiz",
"common.walk_away":"Aussteigen",
"common.wave_lease":"Wave-Miete",
@@ -3916,8 +3915,9 @@
"settings.auto_draws_the_map_with_your":"Auto zeichnet die Karte mit deiner Grafikkarte, wenn der Browser es erlaubt, damit auch große Netze flüssig bleiben. Immer 2D läuft überall, ist auf großen Karten aber langsamer.",
"settings.auto_follows_your_device_s_reduce":"Auto folgt der Einstellung „Bewegung reduzieren“ deines Geräts. Aus friert die Karte ein: keine wandernden Pakete, kein Pulsieren, kein schwebender Text.",
"settings.customers_and_alerts":"Kunden und Warnungen",
+"settings.diagnostic_info":"Diagnoseinfos",
"settings.display_and_sound":"Anzeige und Ton",
-"settings.for_reporting_layout_bugs_shows_what":"Zum Melden von Layout-Fehlern: zeigt, was dein Bildschirm dem Spiel mitteilt.",
+"settings.for_bug_reports_shows_your_screen":"Für Fehlerberichte: zeigt in einer Ecke die Größe deines Bildschirms, wie die Karte gezeichnet wird (Grafikkarte oder 2D, und warum) und wie schnell.",
"settings.let_an_ai_agent_drive_this_game":"Eine KI soll dieses Spiel spielen",
"settings.map_drawing":"Kartendarstellung",
"settings.n_min":"{n} Min.",
diff --git a/site/i18n/es.js b/site/i18n/es.js
index 9744b6b..c82b48f 100644
--- a/site/i18n/es.js
+++ b/site/i18n/es.js
@@ -1608,7 +1608,6 @@
"common.vendor_tac":"TAC del fabricante",
"common.venus":"Venus",
"common.via_rs":"vía RS",
-"common.viewport_info":"Información del viewport",
"common.vigilante":"Justiciero",
"common.walk_away":"Marcharse",
"common.wave_lease":"Alquiler de onda",
@@ -3914,8 +3913,9 @@
"settings.auto_draws_the_map_with_your":"Auto dibuja el mapa con tu tarjeta gráfica cuando el navegador lo permite, y así las redes grandes siguen fluidas. Siempre 2D funciona en todas partes, pero va más lento en mapas grandes.",
"settings.auto_follows_your_device_s_reduce":"Auto sigue el ajuste de reducir movimiento de tu dispositivo. Desactivado congela el mapa: sin paquetes en movimiento, pulsos ni texto flotante.",
"settings.customers_and_alerts":"Clientes y alertas",
+"settings.diagnostic_info":"Información de diagnóstico",
"settings.display_and_sound":"Pantalla y sonido",
-"settings.for_reporting_layout_bugs_shows_what":"Para informar de fallos de diseño: muestra lo que tu pantalla le dice al juego.",
+"settings.for_bug_reports_shows_your_screen":"Para informar de fallos: muestra en una esquina el tamaño de tu pantalla, cómo se dibuja el mapa (tarjeta gráfica o 2D, y por qué) y a qué velocidad.",
"settings.let_an_ai_agent_drive_this_game":"Deja que un agente de IA juegue",
"settings.map_drawing":"Dibujo del mapa",
"settings.n_min":"{n} min",
diff --git a/site/i18n/fr.js b/site/i18n/fr.js
index 85ebe05..0999427 100644
--- a/site/i18n/fr.js
+++ b/site/i18n/fr.js
@@ -1608,7 +1608,6 @@
"common.vendor_tac":"TAC du constructeur",
"common.venus":"Vénus",
"common.via_rs":"via RS",
-"common.viewport_info":"Infos viewport",
"common.vigilante":"Justicier",
"common.walk_away":"Laisser tomber",
"common.wave_lease":"Location de longueur d’onde",
@@ -3914,8 +3913,9 @@
"settings.auto_draws_the_map_with_your":"Auto dessine la carte avec ta carte graphique quand le navigateur le permet, ce qui garde les grands réseaux fluides. Toujours en 2D marche partout mais rame sur les grandes cartes.",
"settings.auto_follows_your_device_s_reduce":"Auto suit le réglage « réduire les animations » de ton appareil. Inactif fige la carte : plus de paquets en mouvement, de pulsations ni de texte flottant.",
"settings.customers_and_alerts":"Clients et alertes",
+"settings.diagnostic_info":"Infos de diagnostic",
"settings.display_and_sound":"Affichage et son",
-"settings.for_reporting_layout_bugs_shows_what":"Pour signaler des bugs de mise en page : montre ce que ton écran dit au jeu.",
+"settings.for_bug_reports_shows_your_screen":"Pour signaler un bug : affiche dans un coin la taille de ton écran, comment la carte est dessinée (carte graphique ou 2D, et pourquoi) et à quelle vitesse.",
"settings.let_an_ai_agent_drive_this_game":"Laisser un agent IA jouer",
"settings.map_drawing":"Dessin de la carte",
"settings.n_min":"{n} min",
diff --git a/site/i18n/it.js b/site/i18n/it.js
index 31ade7b..3855c17 100644
--- a/site/i18n/it.js
+++ b/site/i18n/it.js
@@ -1608,7 +1608,6 @@
"common.vendor_tac":"TAC del vendor",
"common.venus":"Venere",
"common.via_rs":"via RS",
-"common.viewport_info":"Info viewport",
"common.vigilante":"Giustiziere",
"common.walk_away":"Lascia perdere",
"common.wave_lease":"Affitto della wave",
@@ -3914,8 +3913,9 @@
"settings.auto_draws_the_map_with_your":"Auto disegna la mappa con la tua scheda grafica quando il browser lo consente, così anche le reti grandi restano fluide. Sempre 2D funziona ovunque ma è più lento sulle mappe grandi.",
"settings.auto_follows_your_device_s_reduce":"Auto segue l’impostazione “riduci movimento” del tuo dispositivo. Off congela la mappa: niente pacchetti in movimento, pulsazioni o testo fluttuante.",
"settings.customers_and_alerts":"Clienti e avvisi",
+"settings.diagnostic_info":"Info di diagnostica",
"settings.display_and_sound":"Schermo e audio",
-"settings.for_reporting_layout_bugs_shows_what":"Per segnalare bug di layout: mostra cosa lo schermo dice al gioco.",
+"settings.for_bug_reports_shows_your_screen":"Per segnalare bug: mostra in un angolo le dimensioni dello schermo, come viene disegnata la mappa (scheda grafica o 2D, e perché) e a che velocità.",
"settings.let_an_ai_agent_drive_this_game":"Lascia giocare un agente IA",
"settings.map_drawing":"Disegno della mappa",
"settings.n_min":"{n} min",
diff --git a/site/i18n/pt.js b/site/i18n/pt.js
index b46d71c..9939e1c 100644
--- a/site/i18n/pt.js
+++ b/site/i18n/pt.js
@@ -1608,7 +1608,6 @@
"common.vendor_tac":"TAC do fabricante",
"common.venus":"Vênus",
"common.via_rs":"via RS",
-"common.viewport_info":"Info do viewport",
"common.vigilante":"Justiceiro",
"common.walk_away":"Desistir",
"common.wave_lease":"Aluguel da wave",
@@ -3914,8 +3913,9 @@
"settings.auto_draws_the_map_with_your":"Auto desenha o mapa com sua placa de vídeo quando o navegador permite, o que mantém redes grandes fluidas. Sempre 2D funciona em qualquer lugar, mas é mais lento em mapas grandes.",
"settings.auto_follows_your_device_s_reduce":"Auto segue a configuração de reduzir movimento do seu aparelho. Desligado congela o mapa: sem pacotes andando, pulsos ou texto flutuante.",
"settings.customers_and_alerts":"Clientes e alertas",
+"settings.diagnostic_info":"Informações de diagnóstico",
"settings.display_and_sound":"Tela e som",
-"settings.for_reporting_layout_bugs_shows_what":"Para reportar bugs de layout: mostra o que sua tela informa ao jogo.",
+"settings.for_bug_reports_shows_your_screen":"Para reportar bugs: mostra em um canto o tamanho da sua tela, como o mapa é desenhado (placa de vídeo ou 2D, e por quê) e a que velocidade.",
"settings.let_an_ai_agent_drive_this_game":"Deixa um agente de IA jogar",
"settings.map_drawing":"Desenho do mapa",
"settings.n_min":"{n} min",
diff --git a/src/game/90-actions/89-game-and-settings.js b/src/game/90-actions/89-game-and-settings.js
index fb83f74..a1671dc 100644
--- a/src/game/90-actions/89-game-and-settings.js
+++ b/src/game/90-actions/89-game-and-settings.js
@@ -35,7 +35,7 @@ Object.assign(ACT,{
settings:()=>{UI.setOpen=true;openModal(settingsHtml());},
settingsClose:()=>{UI.setOpen=false;if(!S||!UI.started)showTitle();else closeModal();},
prefSet:({v})=>{const [k,b]=String(v).split(':');if(!own(PREF_DEF,k))return;setPref(k,b==='1');sfx('click');refreshSettings();},
- vpSet:({v})=>{vpOn(v==='on');refreshSettings();},
+ vpSet:({v})=>{diagOn(v==='on');refreshSettings();},
resetAsk:()=>openModal(`
`),
whatsNewShow:()=>whatsNew(true,true),
updateNow:()=>{save(true);location.reload();},
diff --git a/src/game/96-map/10-canvas.js b/src/game/96-map/10-canvas.js
index e3021cc..ff76dfb 100644
--- a/src/game/96-map/10-canvas.js
+++ b/src/game/96-map/10-canvas.js
@@ -14,15 +14,5 @@ function fixStandaloneHeight(){const R0=document.documentElement;
R0.classList.toggle('iosfix',on);if(on)R0.style.setProperty('--app-h',sh+'px');else R0.style.removeProperty('--app-h');return on?sh:0;}
function resize(){const ah=fixStandaloneHeight();DPR=Math.min(2,window.devicePixelRatio||1);CW=innerWidth;CH=ah||innerHeight;cv.width=CW*DPR;cv.height=CH*DPR;}
addEventListener('resize',()=>{resize();WL.key=null;renderLeft();fitHud();});resize();
-// Viewport readout for debugging phone layouts: open the game once with ?vp in the address (or the start URL).
-function vpDebug(){let el=document.getElementById('vpdbg');if(!el){el=document.createElement('pre');el.id='vpdbg';el.style.cssText='position:fixed;left:8px;bottom:calc(var(--tabbar,0px) + 8px);z-index:99;margin:0;padding:6px 8px;background:rgba(30,38,64,.85);color:#7CFFB2;font:11px/1.35 ui-monospace,monospace;border-radius:8px;pointer-events:none';document.body.appendChild(el);
- const pr=document.createElement('div');pr.id='vpprobe';pr.style.cssText='position:fixed;visibility:hidden;padding:env(safe-area-inset-top,0px) 0 env(safe-area-inset-bottom,0px)';document.body.appendChild(pr);}
- const pr=document.getElementById('vpprobe'),cs=getComputedStyle(pr),vv=window.visualViewport,de=document.documentElement,tb=document.getElementById('tabbar').getBoundingClientRect();
- el.textContent=`inner ${innerWidth}×${innerHeight} · screen ${screen.width}×${screen.height}\nvv ${vv?Math.round(vv.width)+'×'+Math.round(vv.height)+' top '+Math.round(vv.offsetTop):'-'} · client ${de.clientHeight}\nsafe top ${cs.paddingTop} bottom ${cs.paddingBottom}\nstandalone ${navigator.standalone===true||!!(window.matchMedia&&matchMedia('(display-mode: standalone)').matches)} · iosfix ${de.classList.contains('iosfix')} · CH ${CH}\nbody ${Math.round(document.body.getBoundingClientRect().height)} · tabbar ${Math.round(tb.top)}–${Math.round(tb.bottom)}`;}
-let VP_T=null;const vpOn=on=>{clearInterval(VP_T);VP_T=null;const el=document.getElementById('vpdbg');if(el)el.remove();if(on){VP_T=setInterval(vpDebug,500);vpDebug();}try{on?localStorage.setItem('sot-vp','1'):localStorage.removeItem('sot-vp');}catch(e){}};
-if(/[?&]vp\b/.test(location.search))vpOn(true);else if(/[?&]novp\b/.test(location.search))vpOn(false);
-try{if(localStorage.getItem('sot-vp')==='1')vpOn(true);}catch(e){}
-// Inside an installed app there is no address bar: five quick taps on the date toggle the readout.
-{let taps=[];document.getElementById('hDate').closest('.chip,div').addEventListener('click',()=>{const t=performance.now();taps=taps.filter(x=>t-x<1500).concat(t);if(taps.length>=5){taps=[];vpOn(!VP_T);}});}
// iOS settles the standalone viewport a moment after launch and after rotating.
for(const t of [300,1000])setTimeout(()=>{resize();WL.key=null;},t);addEventListener('pageshow',()=>{resize();WL.key=null;});
diff --git a/src/game/96-map/30-settings.js b/src/game/96-map/30-settings.js
index 348036a..f3025be 100644
--- a/src/game/96-map/30-settings.js
+++ b/src/game/96-map/30-settings.js
@@ -33,7 +33,7 @@ function settingsHtml(){const seg=(lab,act,cur,opts,note)=>`
`;}
const refreshSettings=()=>{if(UI.setOpen)openModal(settingsHtml());};
function animOn(){const m=UI.anim||'auto';if(m==='on')return true;if(m==='off')return false;try{return !matchMedia('(prefers-reduced-motion: reduce)').matches;}catch(e){return true;}}
diff --git a/src/game/96-map/56-webgl.js b/src/game/96-map/56-webgl.js
index aa4ee57..3423544 100644
--- a/src/game/96-map/56-webgl.js
+++ b/src/game/96-map/56-webgl.js
@@ -19,7 +19,7 @@ function mapGl(on,keep=true){GLX.want=!!on;if(keep)try{on?localStorage.removeIte
function glShow(on){on=!!on;if(GLX.shown===on)return;GLX.shown=on;const e=document.getElementById('mapgl'),fx=document.getElementById('mapfx');if(e)e.hidden=!on;if(fx)fx.hidden=!on;}
// Marks an error as the card's own, so draw() falls back to 2D instead of trying WebGL again every frame.
function glErr(e){const x=e instanceof Error?e:new Error(String(e));x.glErr=true;return x;}
-function glKill(why){console.warn('[tubes] the map stays 2D:',why&&why.message||why);GLX.dead=true;GLX.gl=null;spritesDrop();glShow(false);}
+function glKill(why){console.warn('[tubes] the map stays 2D:',why&&why.message||why);GLX.why=String(why&&why.message||why);GLX.dead=true;GLX.gl=null;spritesDrop();glShow(false);}
/* A card short of memory may refuse a texture or a buffer without throwing: it only leaves OUT_OF_MEMORY for
getError(), and the texture then draws black (every picture a black box) or the buffer draws nothing. So the big
uploads (the atlas, the land, the tubes, the cables) read it, and give the card up like any of its errors. Never
diff --git a/src/game/96-map/97-diagnostics.js b/src/game/96-map/97-diagnostics.js
new file mode 100644
index 0000000..b5a427e
--- /dev/null
+++ b/src/game/96-map/97-diagnostics.js
@@ -0,0 +1,36 @@
+/* Settings › Diagnostic info: one readout in a corner, for bug reports. What the screen tells the game (for phone
+ layouts), how the map is drawn (the graphics card or 2D, and why), and how fast: frames per second, the slowest
+ frames, the time draw() takes. It is also opened with ?vp or ?fps in the address (?novp, ?nofps close it), and,
+ inside an installed app where there is no address bar, with five quick taps on the date. Its words are technical on
+ purpose and stay in English: they are pasted into bug reports. */
+const DIAG={on:false,el:null,t:null,fr:[],dr:[],last:0,dms:-1};
+// One frame of the loop (99-loop.js): its interval, and the time draw() took if the map was drawn.
+function diagFrame(now){const D=DIAG;if(D.last)D.fr.push(now-D.last);D.last=now;if(D.dms>=0){D.dr.push(D.dms);D.dms=-1;}
+ if(D.fr.length>600)D.fr.splice(0,300);if(D.dr.length>600)D.dr.splice(0,300);}
+// What draws the map, and why it is the 2D canvas when it is.
+function diagMap(){if(!S)return 'map: none (title screen)';if(pzOn())return 'map: 2D (puzzle)';if(!GLX.want)return 'map: 2D (Always 2D)';
+ if(GLX.dead)return 'map: 2D ('+(GLX.why||'no WebGL2')+')';return GLX.gl&&GLX.shown?'map: WebGL2 · '+(GLX.gpu||'unknown GPU'):'map: WebGL2 (starting)';}
+// Frames since the last readout: per second, the 95th percentile and the slowest, and draw()'s mean.
+function diagPerf(){const f=DIAG.fr.splice(0),d=DIAG.dr.splice(0),s=f.slice().sort((a,b)=>a-b),sum=f.reduce((a,x)=>a+x,0),
+ q=x=>s.length?s[Math.min(s.length-1,Math.floor(s.length*x))].toFixed(0):'-',gl=GLX.shown&&!GLX.dead;
+ return `${sum?(f.length*1000/sum).toFixed(0):'-'} fps · p95 ${q(.95)} ms · max ${q(1)} ms\ndraw ${d.length?(d.reduce((a,x)=>a+x,0)/d.length).toFixed(1):'-'} ms · x${UI.speed||0} · zoom ${cam.z.toFixed(2)}`+
+ (gl?` · ${GLX.nSeg} segments · ${GLX.nPk} packets`:'');}
+function diagShow(){const D=DIAG;let el=D.el;
+ if(!el){el=D.el=document.createElement('pre');el.id='diag';el.style.cssText='position:fixed;left:8px;bottom:calc(var(--tabbar,0px) + 8px);z-index:99;margin:0;padding:6px 8px;max-width:calc(100vw - 32px);background:rgba(30,38,64,.85);color:#7CFFB2;font:11px/1.35 ui-monospace,monospace;border-radius:8px;pointer-events:none;white-space:pre-wrap;overflow-wrap:anywhere';
+ // A hidden probe reads the safe areas (the notch, the home bar) as CSS gives them.
+ const pr=document.createElement('div');pr.id='diagprobe';pr.style.cssText='position:fixed;visibility:hidden;padding:env(safe-area-inset-top,0px) 0 env(safe-area-inset-bottom,0px)';el.appendChild(pr);
+ D.txt=document.createTextNode('');el.appendChild(D.txt);document.body.appendChild(el);}
+ const cs=getComputedStyle(document.getElementById('diagprobe')),vv=window.visualViewport,de=document.documentElement,tb=document.getElementById('tabbar').getBoundingClientRect(),
+ sa=navigator.standalone===true||!!(window.matchMedia&&matchMedia('(display-mode: standalone)').matches);
+ D.txt.data=`Series of Tubes ${APP_VERSION} · ${LANG}\n`+
+ `inner ${innerWidth}×${innerHeight} · screen ${screen.width}×${screen.height} · dpr ${window.devicePixelRatio||1}\n`+
+ `vv ${vv?Math.round(vv.width)+'×'+Math.round(vv.height)+' top '+Math.round(vv.offsetTop):'-'} · client ${de.clientHeight}\nsafe top ${cs.paddingTop} bottom ${cs.paddingBottom}\n`+
+ `standalone ${sa} · iosfix ${de.classList.contains('iosfix')} · CH ${CH}\nbody ${Math.round(document.body.getBoundingClientRect().height)} · tabbar ${Math.round(tb.top)}–${Math.round(tb.bottom)}\n`+
+ diagMap()+'\n'+diagPerf();}
+// Shows or hides the readout, and remembers it on this device.
+function diagOn(on){const D=DIAG;clearInterval(D.t);D.t=null;if(D.el){D.el.remove();D.el=null;}D.on=!!on;D.fr.length=D.dr.length=0;D.last=0;D.dms=-1;
+ if(on){D.t=setInterval(diagShow,500);diagShow();}
+ try{on?localStorage.setItem('sot-vp','1'):localStorage.removeItem('sot-vp');localStorage.removeItem('sot-fps');}catch(e){}}
+{const q=location.search;let on=false;try{on=localStorage.getItem('sot-vp')==='1'||localStorage.getItem('sot-fps')==='1';}catch(e){}
+ if(/[?&](vp|fps)\b/.test(q))on=true;else if(/[?&]no(vp|fps)\b/.test(q))on=false;diagOn(on);}
+{let taps=[];document.getElementById('hDate').closest('.chip,div').addEventListener('click',()=>{const t=performance.now();taps=taps.filter(x=>t-x<1500).concat(t);if(taps.length>=5){taps=[];diagOn(!DIAG.on);}});}
diff --git a/src/game/96-map/97-fps-meter.js b/src/game/96-map/97-fps-meter.js
deleted file mode 100644
index 4ad6efd..0000000
--- a/src/game/96-map/97-fps-meter.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/* A frame meter for measuring the map on a real device: open the game once with ?fps (?nofps hides it again).
- Frames per second, the slowest frames, the time draw() takes, and which renderer and graphics card draw the map. */
-const FPSM={on:false,el:null,fr:[],dr:[],last:0,shown:0,dms:-1};
-try{const q=location.search;if(/[?&]fps\b/.test(q))localStorage.setItem('sot-fps','1');else if(/[?&]nofps\b/.test(q))localStorage.removeItem('sot-fps');
- FPSM.on=localStorage.getItem('sot-fps')==='1';}catch(e){}
-function fpsNote(now){const M=FPSM;if(M.last)M.fr.push(now-M.last);M.last=now;if(M.dms>=0){M.dr.push(M.dms);M.dms=-1;}
- if(now-M.shown<500)return;M.shown=now;
- if(!M.el){M.el=document.createElement('pre');M.el.id='fpsm';M.el.style.cssText='position:fixed;right:8px;bottom:calc(var(--tabbar,0px) + 8px);z-index:99;margin:0;padding:6px 8px;background:rgba(30,38,64,.85);color:#7CFFB2;font:11px/1.35 ui-monospace,monospace;border-radius:8px;pointer-events:none;white-space:pre';document.body.appendChild(M.el);}
- const f=M.fr.splice(0),d=M.dr.splice(0),s=f.slice().sort((a,b)=>a-b),sum=f.reduce((a,x)=>a+x,0),q=x=>s.length?s[Math.min(s.length-1,Math.floor(s.length*x))].toFixed(0):'-';
- const gl=GLX.shown&&!GLX.dead;
- M.el.textContent=`${sum?(f.length*1000/sum).toFixed(0):0} fps · p95 ${q(.95)} ms · max ${q(1)} ms\ndraw ${d.length?(d.reduce((a,x)=>a+x,0)/d.length).toFixed(1):'-'} ms · ${gl?'WebGL':'2D'} · x${UI.speed||0}`+(gl?`\n${GLX.nSeg} segments · ${GLX.nPk} packets\n${GLX.gpu.slice(0,60)}`:'');}
diff --git a/src/game/99-loop.js b/src/game/99-loop.js
index 83390ba..41f70a8 100644
--- a/src/game/99-loop.js
+++ b/src/game/99-loop.js
@@ -12,8 +12,8 @@ function frame(now){
if(S&&!S.lost&&$('modal').hidden&&UI.speed&&!pzOn())runClock(dt);
if((UI.speed||pzOn())&&!(S&&S.lost))animT+=dt; /* paused = frozen dots, waves and clouds */
const t=animOn()?animT:0;
- if(!(UI.mapHid=mapHidden())&&!mapStill(t,now)){const d0=FPSM.on?performance.now():0;try{draw(t);}catch(e){tickErr(e);}UI.drawnAt=now;if(FPSM.on)FPSM.dms=performance.now()-d0;}
- if(FPSM.on)fpsNote(now);
+ if(!(UI.mapHid=mapHidden())&&!mapStill(t,now)){const d0=DIAG.on?performance.now():0;try{draw(t);}catch(e){tickErr(e);}UI.drawnAt=now;if(DIAG.on)DIAG.dms=performance.now()-d0;}
+ if(DIAG.on)diagFrame(now);
}
// dt of real time at UI.speed: the days it adds up to. The frame calls it; so may a clock that also runs where frames
// do not (src/agent/, a hidden tab), under the frame's own conditions otherwise.
diff --git a/src/i18n/en.js b/src/i18n/en.js
index b349a32..c4ee816 100644
--- a/src/i18n/en.js
+++ b/src/i18n/en.js
@@ -1609,7 +1609,6 @@
"common.vendor_tac":"Vendor TAC",
"common.venus":"Venus",
"common.via_rs":"via RS",
-"common.viewport_info":"Viewport info",
"common.vigilante":"Vigilante",
"common.walk_away":"Walk away",
"common.wave_lease":"Wave lease",
@@ -3915,8 +3914,9 @@
"settings.auto_draws_the_map_with_your":"Auto draws the map with your graphics card when the browser allows it, which keeps big networks smooth. Always 2D works everywhere but is slower on big maps.",
"settings.auto_follows_your_device_s_reduce":"Auto follows your device’s reduce-motion setting. Off freezes the map: no moving packets, pulses or floating text.",
"settings.customers_and_alerts":"Customers and alerts",
+"settings.diagnostic_info":"Diagnostic info",
"settings.display_and_sound":"Display and sound",
-"settings.for_reporting_layout_bugs_shows_what":"For reporting layout bugs: shows what your screen tells the game.",
+"settings.for_bug_reports_shows_your_screen":"For bug reports: shows in a corner your screen's size, how the map is drawn (graphics card or 2D, and why) and how fast.",
"settings.let_an_ai_agent_drive_this_game":"Let an AI agent drive this game",
"settings.map_drawing":"Map drawing",
"settings.n_min":"{n} min",
diff --git a/tests/diagnostic-info.test.js b/tests/diagnostic-info.test.js
new file mode 100644
index 0000000..324fcf6
--- /dev/null
+++ b/tests/diagnostic-info.test.js
@@ -0,0 +1,106 @@
+// Settings › Diagnostic info (src/game/96-map/97-diagnostics.js): one readout for bug reports, which replaced the
+// separate viewport readout and frame meter. It shows the screen, what draws the map (and why it is 2D), and how fast;
+// the setting, ?vp/?fps and five taps on the date open it, and it is remembered on the device.
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const fs = require('node:fs');
+const path = require('node:path');
+const { load } = require('./harness');
+
+const SAVE = fs.readFileSync(path.join(__dirname, 'fixtures', 'big-network.json'), 'utf8');
+
+function open(opts = {}) {
+ const h = load({ seed: 777, ...opts });
+ h.ev(`S=migrate(JSON.parse(${JSON.stringify(SAVE)}));UI.started=true;UI.pitched=true;UI.speed=0;closeModal();compute();console.warn=()=>{};`);
+ // The readout refreshes on an interval: closing the window stops it, so the test process can end.
+ h.done = () => h.dom.window.close();
+ return h;
+}
+const text = (ev) => ev('(()=>{const e=document.getElementById("diag");return e?e.textContent:null;})()');
+
+test('the setting shows one readout with the screen, the map and its speed, and remembers it', () => {
+ const h = open();
+ const { ev, errors } = h;
+ try {
+ assert.equal(text(ev), null, 'off by default');
+ ev('ACT.settings()');
+ assert.match(ev('$("modal").innerHTML'), new RegExp(ev('tr("settings.diagnostic_info")')));
+ ev('ACT.vpSet({v:"on"})');
+ const t = text(ev);
+ for (const part of ['Series of Tubes', 'inner ', 'screen ', 'safe top', 'tabbar', 'map: ', 'fps', 'draw ']) assert.ok(t.includes(part), `shows "${part}"`);
+ assert.equal(ev('document.querySelectorAll("#diag").length'), 1, 'one readout');
+ assert.equal(ev('localStorage.getItem("sot-vp")'), '1');
+ ev('ACT.vpSet({v:"off"})');
+ assert.equal(text(ev), null);
+ assert.equal(ev('localStorage.getItem("sot-vp")'), null);
+ assert.deepEqual(errors, []);
+ } finally { h.done(); }
+});
+
+test('it says what draws the map, and why it is the 2D canvas', () => {
+ const h = open();
+ const { ev, errors } = h;
+ try {
+ ev('diagOn(true)');
+ const map = () => ev('diagMap()');
+ ev('mapGl(false,false)');
+ assert.equal(map(), 'map: 2D (Always 2D)');
+ ev('mapGl(true,false);glKill(new Error("the graphics card is out of memory (the pictures)"))');
+ assert.equal(map(), 'map: 2D (the graphics card is out of memory (the pictures))');
+ ev('GLX.dead=false;GLX.gl={};GLX.shown=true;GLX.gpu="ANGLE (NVIDIA GeForce GTX 980)"');
+ assert.equal(map(), 'map: WebGL2 · ANGLE (NVIDIA GeForce GTX 980)');
+ ev('const s=S;S=null;window.__S=s');
+ assert.equal(map(), 'map: none (title screen)');
+ ev('S=__S;GLX.gl=null;GLX.shown=false');
+ assert.deepEqual(errors, []);
+ } finally { h.done(); }
+});
+
+test('it measures frames per second, the slowest frames and draw()', () => {
+ const h = open();
+ const { ev, errors } = h;
+ try {
+ ev('diagOn(true)');
+ // 60 frames, so 59 intervals: 58 of 16 ms and a last one of 50 ms (978 ms in all), each map drawn in 2 ms.
+ ev('let t=1000;for(let i=0;i<60;i++){t+=i===59?50:16;DIAG.dms=2;diagFrame(t);}diagShow();');
+ const t = text(ev);
+ assert.match(t, /\b60 fps · p95 16 ms · max 50 ms/);
+ assert.match(t, /draw 2\.0 ms · x0 · zoom /);
+ assert.deepEqual(errors, []);
+ } finally { h.done(); }
+});
+
+test('?fps and ?vp open it, ?nofps closes it, and the old frame meter setting carries over', () => {
+ for (const [url, storage, want] of [['?fps', {}, true], ['?vp', {}, true], ['?nofps', { 'sot-vp': '1' }, false], ['', { 'sot-fps': '1' }, true], ['', {}, false]]) {
+ const h = load({ seed: 777, url: 'https://tests.invalid/' + url, storage });
+ try {
+ assert.equal(h.ev('!!document.getElementById("diag")'), want, `${url || 'no flag'} ${JSON.stringify(storage)}`);
+ assert.equal(h.ev('localStorage.getItem("sot-fps")'), null, 'the old key is gone');
+ } finally { h.dom.window.close(); }
+ }
+});
+
+test('five quick taps on the date toggle it (an installed app has no address bar)', () => {
+ const h = open();
+ const { ev, errors } = h;
+ try {
+ const tap = () => ev('document.getElementById("hDate").click()');
+ for (let i = 0; i < 5; i++) tap();
+ assert.equal(ev('DIAG.on'), true);
+ for (let i = 0; i < 5; i++) tap();
+ assert.equal(ev('DIAG.on'), false);
+ assert.deepEqual(errors, []);
+ } finally { h.done(); }
+});
+
+test('on a 360 px phone the readout wraps inside the screen instead of running off it', () => {
+ const h = open();
+ const { ev } = h;
+ try {
+ ev('diagOn(true)');
+ const st = ev('document.getElementById("diag").style.cssText');
+ assert.match(st, /max-width: calc\(100vw - 32px\)/);
+ assert.match(st, /white-space: pre-wrap/);
+ assert.match(st, /pointer-events: none/, 'it never takes a tap meant for the map');
+ } finally { h.done(); }
+});