From a179836969fe5030fb664e2a502505b1341fb4fa Mon Sep 17 00:00:00 2001 From: Nick Bouwhuis Date: Sat, 24 Oct 2026 18:19:08 +0200 Subject: [PATCH] Add random network names and an Another one button --- CHANGELOG.md | 3 +++ site/index.html | 33 ++++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5922275..04fe569 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- New networks get a random name, from Shinternet to PTT Telecom. Click + "Another one" for more questionable branding, or type your own. + ## [1.10.0] — 2026-10-24 - Router ports are finite. Every transit, IX, PNI and cache port, every wave diff --git a/site/index.html b/site/index.html index 0d70c11..64bb7c4 100644 --- a/site/index.html +++ b/site/index.html @@ -308,6 +308,8 @@ section h3{font-size:17px;margin-bottom:6px;display:flex;align-items:center;gap: .tagline{color:var(--ink2);font-size:14.5px;line-height:1.45;margin:10px 0 14px} label.f{display:block;font-weight:900;font-size:12px;letter-spacing:.06em;text-transform:uppercase;color:var(--ink2);margin:12px 0 5px} input.t{width:100%;box-sizing:border-box;border:3px solid var(--ink);border-radius:12px;padding:8px 12px;font-family:var(--display);font-weight:800;font-size:18px;background:var(--soft)} +.network-name{display:flex;flex-wrap:wrap;align-items:center;gap:8px} +.network-name input.t{flex:1 1 240px;width:auto;min-width:0} .starts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px} .start{border:3px solid var(--ink);border-radius:14px;padding:8px 10px;background:var(--paper);cursor:pointer;text-align:left;box-shadow:0 3px 0 var(--ink)} .start.on{background:#FFE3F0;border-color:var(--me);box-shadow:0 3px 0 var(--me)} @@ -2200,14 +2202,15 @@ const ACT={ spares:({id})=>{const l=S.links.find(x=>x.id===id);if(!l)return;l.spares=!l.spares;sfx('click');after();}, crews:({id})=>{const l=S.links.find(x=>x.id===id);if(!l||l.ready<=S.day)return;const c=Math.round(15000+l.km*6);if(!spend(c))return;l.ready=Math.max(S.day+1,l.ready-30);toast('More crews on site.
Construction is 30 days ahead.','good');after();}, addGen:({city})=>{const p=S.pops[city];if(!p||p.gen)return;if(!spend(GEN_COST))return;p.gen=true;floater(CITY[city].x,CITY[city].y-30,'Generator!','#FF8A3D');after();}, - start:()=>{const nm=(($('nmIn')&&$('nmIn').value)||'Packet Pals').slice(0,24);beginGame(nm,UI.startCity,{mode:UI.mode==='sandbox'?'sandbox':'normal'});}, + randomName:()=>{const input=$('nmIn');if(input)input.value=UI.nm=randomNetworkName(input.value);}, + start:()=>{const nm=(($('nmIn')&&$('nmIn').value)||randomNetworkName()).slice(0,24);beginGame(nm,UI.startCity,{mode:UI.mode==='sandbox'?'sandbox':'normal'});}, modeSet:({m})=>{UI.mode=m;document.querySelectorAll('.modeb').forEach(b=>b.classList.toggle('pink',b.dataset.m===m));document.querySelectorAll('.modeb').forEach(b=>b.classList.toggle('ghost',b.dataset.m!==m));}, - scenarios:()=>{UI.nm=(($('nmIn')&&$('nmIn').value)||UI.nm||(S&&S.name)||'Packet Pals').slice(0,24);scenarioModal();}, - startScn:({id,sure})=>{const sc=SCN.find(x=>x.id===id);if(!sc)return;if(!sure&&S&&UI.started&&!S.lost&&!(S.scn&&(S.scn.done||S.scn.failed))){openModal(`

Start ${esc(sc.n)}?

${esc(S.name)} will be replaced. Export it from the menu first if you want to keep it.

${btn('Start the scenario','startScn',{id,sure:1},'pink big')}${btn('Keep playing','closeModal',{},'ghost big')}
`);return;}beginGame(UI.nm||(S&&S.name)||'Packet Pals',sc.city,{scn:sc});}, - startWeekly:({sure}={})=>{if(!sure&&S&&UI.started&&!S.lost&&!(S.scn&&(S.scn.done||S.scn.failed))){openModal(`

Start the weekly challenge?

${esc(S.name)} will be replaced. Export it from the menu first if you want to keep it.

${btn('Start the challenge','startWeekly',{sure:1},'pink big')}${btn('Keep playing','closeModal',{},'ghost big')}
`);return;}const wk=weekly();beginGame(UI.nm||(S&&S.name)||'Packet Pals',wk.city,{scn:wk,seed:wk.seed});}, + scenarios:()=>{UI.nm=(($('nmIn')&&$('nmIn').value)||UI.nm||(S&&S.name)||randomNetworkName()).slice(0,24);scenarioModal();}, + startScn:({id,sure})=>{const sc=SCN.find(x=>x.id===id);if(!sc)return;if(!sure&&S&&UI.started&&!S.lost&&!(S.scn&&(S.scn.done||S.scn.failed))){openModal(`

Start ${esc(sc.n)}?

${esc(S.name)} will be replaced. Export it from the menu first if you want to keep it.

${btn('Start the scenario','startScn',{id,sure:1},'pink big')}${btn('Keep playing','closeModal',{},'ghost big')}
`);return;}beginGame(UI.nm||(S&&S.name)||randomNetworkName(),sc.city,{scn:sc});}, + startWeekly:({sure}={})=>{if(!sure&&S&&UI.started&&!S.lost&&!(S.scn&&(S.scn.done||S.scn.failed))){openModal(`

Start the weekly challenge?

${esc(S.name)} will be replaced. Export it from the menu first if you want to keep it.

${btn('Start the challenge','startWeekly',{sure:1},'pink big')}${btn('Keep playing','closeModal',{},'ghost big')}
`);return;}const wk=weekly();beginGame(UI.nm||(S&&S.name)||randomNetworkName(),wk.city,{scn:wk,seed:wk.seed});}, pickStart:({city})=>{UI.startCity=city;document.querySelectorAll('.start').forEach(b=>b.classList.toggle('on',b.dataset.city===city));}, cont:()=>{migrate(S);track('game_continue',true);UI.started=true;closeModal();renderAll();}, - newgame:()=>{try{localStorage.removeItem('sot-save-v1');}catch(e){}S=null;UI.started=false;UI.sel=null;$('dash').hidden=true;$('bankBox').hidden=true;renderAll();showTitle();}, + newgame:()=>{try{localStorage.removeItem('sot-save-v1');}catch(e){}S=null;UI.started=false;UI.sel=null;UI.nm=null;$('dash').hidden=true;$('bankBox').hidden=true;renderAll();showTitle();}, keepPlaying:()=>{closeModal();}, exportSave:()=>exportSave(), importPick:()=>{let f=$('importIn');if(!f){f=document.createElement('input');f.type='file';f.accept='.json,application/json';f.id='importIn';f.hidden=true;document.body.appendChild(f);f.addEventListener('change',()=>{importFile(f.files[0]);f.value='';});}f.click();}, @@ -2640,17 +2643,33 @@ function toast(html,kind='',actions=[]){ } function openModal(html){$('modalCard').innerHTML=html;$('modal').hidden=false;} function closeModal(){$('modal').hidden=true;UI.pending=null;} +const NETWORK_NAMES=[ + 'Packet Pals','Shinternet','PTT Telecom','Peering Pressure','Best Effort Telecom', + 'Mostly Online','Buffering & Sons','Lord of the Pings','The Ping Dynasty', + 'LAN Before Time','Bits Please','Packet Racket','Hopless Networks', + 'Route of All Evil','TTL You Later','Fiber McFiberface','Carrier Pigeon', + 'Spanning Tree Huggers','Dial-Up & Cry','Flaky Fiber','404 Telecom', + 'Unstable Cable','Lag Happens','Loss Leaders','Last Mile Standing', + 'Have You Tried Off & On', +]; +function randomNetworkName(current){ + // Naming must not advance a running scenario's seeded simulation. + const names=NETWORK_NAMES.filter(n=>n!==current); + return names[Math.floor(_rand()*names.length)]; +} function showTitle(){ const sv=loadSave(); + if(UI.nm==null)UI.nm=randomNetworkName(); const starts=[['fra','Crossroads of Europe. DE-KICKS IX, cheap transit.'],['nyc','Huge eyeball market. Pricey neighbours.'],['sin','Asia hub. Great peering, far from home.'],['sao','Big hungry market, few providers.']]; openModal(`

Series
of Tubes

Build an internet. Lay fiber between cities, buy transit, peer at exchanges, sign up businesses, and keep the eyeballs happy while backhoes, sharks and route leaks do their best to stop you.

${sv?`
${btn(`Continue ${esc(sv.name)} · ${dateStr(sv.day)}`,'cont',{},'pink big')}
`:''} - +
${btn('Another one','randomName',{},'ghost sm')}
${starts.map(([c,d])=>``).join('')}
${[['normal','Normal'],['sandbox','Sandbox']].map(([m,l])=>``).join('')}${btn('Scenarios & weekly challenge →','scenarios',{},'sm')}
${btn(sv?'Start a new network':'Start building','start',{},'big')}${btn('How to play','help',{},'ghost')}${btn('Import a save','importPick',{},'ghost sm')}

v${APP_VERSION} · Source on GitHub · Cookieless stats, no tracking

`); + $('nmIn').addEventListener('input',e=>{UI.nm=e.target.value;}); if(sv){S=migrate(sv);compute();} } // "What's new": shown once to returning players after an update, or on demand. @@ -3002,7 +3021,7 @@ let pressing=false; document.addEventListener('pointerdown',e=>{if(e.target.closest('#panel,#left'))pressing=true;}); addEventListener('pointerup',()=>setTimeout(()=>pressing=false,0)); addEventListener('pointercancel',()=>{pressing=false;});addEventListener('blur',()=>{pressing=false;}); -document.addEventListener('click',e=>{const b=e.target.closest('[data-act]');if(!b||b.disabled)return;audioInit();const fn=ACT[b.dataset.act];if(!fn)return;if(!S&&!['start','pickStart','cont','help','helpClose','newgame','mute','animSet','soundSet','closeModal','speed','bankClose','whatsNewShow','updateNow','updateLater','importPick','importGo','modeSet','scenarios','startScn','startWeekly'].includes(b.dataset.act))return;let a={};try{a=JSON.parse(b.dataset.args||'{}');}catch(_){}fn(a);}); +document.addEventListener('click',e=>{const b=e.target.closest('[data-act]');if(!b||b.disabled)return;audioInit();const fn=ACT[b.dataset.act];if(!fn)return;if(!S&&!['start','randomName','pickStart','cont','help','helpClose','newgame','mute','animSet','soundSet','closeModal','speed','bankClose','whatsNewShow','updateNow','updateLater','importPick','importGo','modeSet','scenarios','startScn','startWeekly'].includes(b.dataset.act))return;let a={};try{a=JSON.parse(b.dataset.args||'{}');}catch(_){}fn(a);}); /* ================= LOOP ================= */ let last=performance.now(),acc=0,hudT=0,animT=0;