Merge #94: Calibrate city prices with PeeringDB and Hurricane Electric data (clayberF)
This commit is contained in:
commit
1b12a2c014
14 changed files with 241 additions and 6 deletions
|
|
@ -11,6 +11,7 @@ All notable changes to this project are documented here. The project follows
|
|||
- Glowball Sakura Lager joins the map: a Tier 2 carrier in the big hubs of the US, Europe and Asia-Pacific that sells transit, takes PNIs and peers openly wherever it is. It is not a Tier 1, so it buys its own transit from three of them, while 13 smaller networks in its regions buy theirs from it, and one PNI with it reaches about 3% of all traffic. Far from home, in Asia and New Zealand, it charges more than the locals, and it sells no transit in Australia.
|
||||
- Check a selected link’s redundancy against current demand: see disconnected endpoints, additional service loss and full fallback links without changing the live network.
|
||||
- Links can now use a custom routing metric, set either as a multiplier or as an exact cost. Pick Custom under Routing metric to fine-tune where your traffic goes; it explains how a link's cost is worked out and what each preset comes to on that link.
|
||||
- Prices now follow how connected each city really is, based on PeeringDB and Hurricane Electric data. Transit costs up to 1.8× more in cities where few networks are present, a POP costs 1.25× to 1.5× where there is little or no carrier-neutral data center, and countries with thousands of networks, like Brazil and the US, bring more ISP customers. Big hubs such as Frankfurt, Amsterdam, New York and São Paulo keep their prices.
|
||||
|
||||
## [1.36.0] — 2026-10-28
|
||||
|
||||
|
|
|
|||
|
|
@ -693,6 +693,7 @@
|
|||
"city_panel.every_port_is_taken_add_a":"Alle Ports sind belegt. Füg einen Router hinzu oder wechsle auf ein Modell mit mehr Ports, bevor du etwas Neues ansteckst.",
|
||||
"city_panel.everything_is_in_one_building_move":"Alles steht in einem Gebäude. Verschieb ein paar Uplinks in den Tabs Transit und Peering an den anderen Standort.",
|
||||
"city_panel.fabrics_list":"Fabrics: {list}",
|
||||
"city_panel.few_data_centers_pops_x":"Wenige Rechenzentren: POPs {x}×",
|
||||
"city_panel.fiber_from_city":"Glasfaser von {city}",
|
||||
"city_panel.fiber_is_down":"Glasfaser ist down",
|
||||
"city_panel.g_of_circuits":"{g} an Verbindungen",
|
||||
|
|
|
|||
|
|
@ -691,6 +691,7 @@
|
|||
"city_panel.every_port_is_taken_add_a":"Todos los puertos están ocupados. Añade un router o cambia a un modelo con más puertos antes de conectar nada nuevo.",
|
||||
"city_panel.everything_is_in_one_building_move":"Todo está en un solo edificio. Mueve algunos uplinks a la otra sede desde las pestañas Tránsito y Peering.",
|
||||
"city_panel.fabrics_list":"Fabrics: {list}",
|
||||
"city_panel.few_data_centers_pops_x":"Pocos centros de datos: POPs {x}×",
|
||||
"city_panel.fiber_from_city":"Fibra desde {city}",
|
||||
"city_panel.fiber_is_down":"la fibra está caída",
|
||||
"city_panel.g_of_circuits":"{g} de circuitos",
|
||||
|
|
|
|||
|
|
@ -691,6 +691,7 @@
|
|||
"city_panel.every_port_is_taken_add_a":"Tous les ports sont pris. Ajoute un routeur ou passe à un modèle avec plus de ports avant de brancher quoi que ce soit.",
|
||||
"city_panel.everything_is_in_one_building_move":"Tout est dans un seul bâtiment. Déplace des uplinks vers l’autre site depuis les onglets Transit et Peering.",
|
||||
"city_panel.fabrics_list":"Fabrics : {list}",
|
||||
"city_panel.few_data_centers_pops_x":"Peu de data centers : POP {x}×",
|
||||
"city_panel.fiber_from_city":"Fibre depuis {city}",
|
||||
"city_panel.fiber_is_down":"fibre en panne",
|
||||
"city_panel.g_of_circuits":"{g} de circuits",
|
||||
|
|
|
|||
|
|
@ -691,6 +691,7 @@
|
|||
"city_panel.every_port_is_taken_add_a":"Tutte le porte sono occupate. Aggiungi un router o passa a un modello con più porte prima di collegare altro.",
|
||||
"city_panel.everything_is_in_one_building_move":"È tutto in un solo edificio. Sposta alcuni uplink sull’altro sito dalle schede Transit e Peering.",
|
||||
"city_panel.fabrics_list":"Fabric: {list}",
|
||||
"city_panel.few_data_centers_pops_x":"Pochi data center: POP {x}×",
|
||||
"city_panel.fiber_from_city":"Fibra da {city}",
|
||||
"city_panel.fiber_is_down":"la fibra è down",
|
||||
"city_panel.g_of_circuits":"{g} di circuiti",
|
||||
|
|
|
|||
|
|
@ -691,6 +691,7 @@
|
|||
"city_panel.every_port_is_taken_add_a":"Todas as portas estão ocupadas. Adicione um router ou troque por um modelo com mais portas antes de plugar algo novo.",
|
||||
"city_panel.everything_is_in_one_building_move":"Está tudo num prédio só. Mova alguns uplinks para o outro site nas abas Transit e Peering.",
|
||||
"city_panel.fabrics_list":"Fabrics: {list}",
|
||||
"city_panel.few_data_centers_pops_x":"Poucos data centers: POPs {x}×",
|
||||
"city_panel.fiber_from_city":"Fibra de {city}",
|
||||
"city_panel.fiber_is_down":"a fibra caiu",
|
||||
"city_panel.g_of_circuits":"{g} de circuitos",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ const SITE2_N=[tr('economy.the_other_building'),tr('economy.campus_b_the_one_wit
|
|||
const siteNo=(name,n)=>name.replace('#',1+((S&&S.asn)|0)%(n||1));
|
||||
const siteName=(c,s)=>s==='b'?CITY[c].dc2?siteNo(CITY[c].dc2,CITY[c].dc2N):SITE2_N[hstr(c)%SITE2_N.length]:siteNo(CITY[c].dc,CITY[c].dcN);
|
||||
const BE_TAPE=30000;
|
||||
const popCost=c=>POP_COST+(c&&CITY[c]&&CITY[c].tape?BE_TAPE:0)+(c&&CITY[c]&&CITY[c].ru?RU_BOX:0)+(c&&CITY[c]&&CITY[c].uae?UAE_LIC:0)+(c&&CITY[c]&&CITY[c].saudi?KSA_LIC:0);
|
||||
const popCost=c=>Math.round(POP_COST*colo(c))+(c&&CITY[c]&&CITY[c].tape?BE_TAPE:0)+(c&&CITY[c]&&CITY[c].ru?RU_BOX:0)+(c&&CITY[c]&&CITY[c].uae?UAE_LIC:0)+(c&&CITY[c]&&CITY[c].saudi?KSA_LIC:0);
|
||||
const CN_LIC=150000, CN_JV_MO=6000;
|
||||
// Scrubbing centers come in tiers by clean bandwidth. Always-on diverts instantly; on-demand is cheaper
|
||||
// but takes a couple of days to engage. A clean-pipe add-on on a transit scrubs upstream, per port.
|
||||
|
|
|
|||
196
src/game/20-world/55-city-pdb.js
Normal file
196
src/game/20-world/55-city-pdb.js
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
/* Real-world calibration, pulled 2026-10-25 (Pacific islands 2026-10-26). Per city: [carrier-neutral facilities, network presences across them,
|
||||
ASNs registered in its country]. Facilities and presences are PeeringDB facilities within 50 km or in the same city
|
||||
(peeringdb.com/api/fac, net_count summed); ASNs per country are from bgp.he.net/report/world.
|
||||
A city missing here keeps the plain regional price. One entry per line, sorted by id. */
|
||||
const CITY_PDB={
|
||||
abj:[5,11,32],
|
||||
acc:[7,78,124],
|
||||
add:[2,3,10],
|
||||
aju:[4,3,9693],
|
||||
akl:[27,398,755],
|
||||
alg:[0,0,16],
|
||||
ams:[69,2731,1827],
|
||||
apw:[0,0,11],
|
||||
ash:[86,1010,33300],
|
||||
asu:[3,8,124],
|
||||
ath:[6,108,307],
|
||||
atn:[42,589,33300],
|
||||
auh:[4,1,231],
|
||||
bcn:[13,159,1341],
|
||||
bde:[0,0,4027],
|
||||
beg:[7,49,227],
|
||||
bel:[3,7,9693],
|
||||
ber:[22,351,3705],
|
||||
bet:[16,174,152],
|
||||
bhz:[13,40,9693],
|
||||
bkk:[32,397,675],
|
||||
blr:[14,104,6412],
|
||||
bne:[21,277,3196],
|
||||
bog:[16,195,598],
|
||||
bom:[59,1050,6412],
|
||||
bos:[31,209,33300],
|
||||
bru:[33,328,443],
|
||||
bsb:[14,108,9693],
|
||||
bud:[6,146,369],
|
||||
bue:[28,372,1357],
|
||||
buh:[23,289,1424],
|
||||
bvb:[3,6,9693],
|
||||
cac:[4,6,9693],
|
||||
cai:[5,28,97],
|
||||
cal:[15,127,2595],
|
||||
cas:[2,2,39],
|
||||
cau:[2,2,9693],
|
||||
cbo:[1,0,33],
|
||||
ccs:[6,32,296],
|
||||
cgb:[4,5,9693],
|
||||
cgr:[4,4,9693],
|
||||
chi:[64,809,33300],
|
||||
cor:[2,29,1357],
|
||||
cph:[30,290,529],
|
||||
cpq:[19,65,9693],
|
||||
cpt:[6,267,879],
|
||||
cpv:[4,12,9693],
|
||||
cwb:[11,79,9693],
|
||||
cxj:[2,3,9693],
|
||||
dac:[30,107,2105],
|
||||
dal:[59,969,33300],
|
||||
dar:[9,67,124],
|
||||
del:[31,479,6412],
|
||||
den:[28,310,33300],
|
||||
dkr:[2,4,23],
|
||||
dla:[3,14,34],
|
||||
doh:[6,29,31],
|
||||
drw:[3,15,3196],
|
||||
dub:[21,277,350],
|
||||
dur:[4,137,879],
|
||||
dxb:[8,135,231],
|
||||
edi:[4,46,4027],
|
||||
fec:[5,4,9693],
|
||||
fih:[7,19,57],
|
||||
fln:[5,23,9693],
|
||||
for:[16,362,9693],
|
||||
fra:[56,2450,3705],
|
||||
fuj:[1,49,231],
|
||||
gbe:[1,2,39],
|
||||
gdl:[4,22,814],
|
||||
gua:[5,16,103],
|
||||
gum:[6,28,11],
|
||||
gyn:[5,28,9693],
|
||||
ham:[26,228,3705],
|
||||
hel:[23,232,427],
|
||||
hir:[1,0,11],
|
||||
hkg:[57,1107,1514],
|
||||
hnl:[7,33,33300],
|
||||
hou:[21,173,33300],
|
||||
hre:[1,0,37],
|
||||
hyd:[17,152,6412],
|
||||
icn:[37,201,1197],
|
||||
igu:[5,26,124],
|
||||
ist:[28,334,1290],
|
||||
jed:[5,25,220],
|
||||
jib:[3,19,5],
|
||||
jkt:[98,3015,4108],
|
||||
jnb:[14,561,879],
|
||||
jpa:[4,18,9693],
|
||||
kcy:[22,313,33300],
|
||||
kgl:[5,14,34],
|
||||
khi:[7,15,488],
|
||||
kla:[2,18,71],
|
||||
kul:[20,210,434],
|
||||
kyv:[33,506,2342],
|
||||
lad:[8,27,79],
|
||||
lag:[13,279,304],
|
||||
lax:[44,939,33300],
|
||||
ldb:[3,7,9693],
|
||||
lim:[12,156,267],
|
||||
lis:[9,129,187],
|
||||
ljd:[1,2,9693],
|
||||
lon:[100,2588,4027],
|
||||
lpb:[1,2,71],
|
||||
lun:[4,3,24],
|
||||
maa:[20,374,6412],
|
||||
mad:[31,578,1341],
|
||||
maj:[0,0,12],
|
||||
man:[29,353,4027],
|
||||
mao:[7,15,9693],
|
||||
mba:[4,176,274],
|
||||
mcp:[2,0,9693],
|
||||
mcz:[1,5,9693],
|
||||
mde:[2,18,598],
|
||||
mel:[20,395,3196],
|
||||
mex:[18,122,814],
|
||||
mgf:[4,9,9693],
|
||||
mia:[27,553,33300],
|
||||
mil:[29,728,1534],
|
||||
mnl:[17,352,750],
|
||||
mos:[49,632,6683],
|
||||
mpm:[7,20,36],
|
||||
mrs:[8,273,2249],
|
||||
mtl:[35,283,2595],
|
||||
mty:[5,27,814],
|
||||
muc:[22,230,3705],
|
||||
mvd:[1,2,53],
|
||||
nat:[1,3,9693],
|
||||
nbo:[9,283,274],
|
||||
nou:[2,2,19],
|
||||
nyc:[96,1322,33300],
|
||||
oos:[5,22,443],
|
||||
osa:[19,229,1330],
|
||||
osl:[20,209,448],
|
||||
ott:[6,21,2595],
|
||||
pan:[8,26,158],
|
||||
par:[77,1528,2249],
|
||||
pek:[10,15,6717],
|
||||
per:[12,248,3196],
|
||||
phx:[26,279,33300],
|
||||
pmo:[3,46,1534],
|
||||
pmw:[3,8,9693],
|
||||
poa:[22,120,9693],
|
||||
pom:[2,0,46],
|
||||
ppg:[0,0,2],
|
||||
ppt:[0,0,6],
|
||||
prg:[24,336,775],
|
||||
pvh:[3,4,9693],
|
||||
qro:[11,144,814],
|
||||
rao:[6,3,9693],
|
||||
rbr:[0,0,9693],
|
||||
rec:[6,31,9693],
|
||||
rek:[15,51,93],
|
||||
ria:[2,2,9693],
|
||||
rio:[33,577,9693],
|
||||
rom:[12,213,1534],
|
||||
ror:[0,0,4],
|
||||
ruh:[8,29,220],
|
||||
sao:[70,1875,9693],
|
||||
scl:[36,274,450],
|
||||
sea:[37,539,33300],
|
||||
sgn:[6,36,1068],
|
||||
sha:[11,27,6717],
|
||||
sin:[58,1271,782],
|
||||
sjc:[57,1048,33300],
|
||||
sjo:[8,6,128],
|
||||
sjp:[2,4,9693],
|
||||
slc:[22,202,33300],
|
||||
slz:[1,6,9693],
|
||||
sof:[15,451,889],
|
||||
ssa:[13,44,9693],
|
||||
stg:[18,63,3705],
|
||||
sto:[31,539,1011],
|
||||
suv:[0,0,23],
|
||||
svg:[2,14,448],
|
||||
syd:[40,979,3196],
|
||||
tbu:[0,0,5],
|
||||
the:[2,1,9693],
|
||||
tll:[7,80,256],
|
||||
tok:[58,917,1330],
|
||||
tor:[46,509,2595],
|
||||
tpe:[15,274,500],
|
||||
tun:[2,0,30],
|
||||
uio:[9,16,287],
|
||||
van:[13,214,2595],
|
||||
vie:[30,377,860],
|
||||
vix:[6,30,9693],
|
||||
waw:[25,855,2743],
|
||||
wdh:[1,2,22],
|
||||
zrh:[38,535,1209],
|
||||
};
|
||||
|
|
@ -251,7 +251,7 @@ function compute(){
|
|||
for(const e of E){if(e.k==='t')R2.useT[e.id]=(R2.useT[e.id]||0)+e.used;else if(e.k==='ix')R2.useIx[e.id]=e.used;else if(e.k==='p')R2.usePni[e.id]=e.used;else R2.useCache[e.id]=e.used;}
|
||||
// money
|
||||
const C=R2.cost,V=R2.rev,pm=S.priceMul;
|
||||
C.pops=Object.values(S.pops).reduce((a,p)=>a+POP_MO+((p.routers||1)-1)*ROUTER_MO+cageMo(p.routers)+(p.routers||1)*RG[p.rgen||0].mo+(p.gen?GEN_MO:0),0);
|
||||
C.pops=Object.entries(S.pops).reduce((a,[c,p])=>a+popMo(c)+((p.routers||1)-1)*ROUTER_MO+cageMo(p.routers)+(p.routers||1)*RG[p.rgen||0].mo+(p.gen?GEN_MO:0),0);
|
||||
C.optical=S.links.filter(l=>l.kind==='df').reduce((a,l)=>a+(l.ready>S.day?0:ampCount(l.km)*AMP_MO*(l.own&&isRdm(l.sys)&&!l.sub?Math.max(1,l.pairs|0):1)+(l.regen|0)*REGEN_MO)+(l.spares?Math.round(150+(l.ch||[]).length*80):0),0);
|
||||
C.links=S.links.reduce((a,l)=>a+(l.mo||0),0);
|
||||
C.nni=(S.nni||[]).reduce((a,x)=>a+NNI[x.tier].mo,0);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
function cnOk(){return S.cnLic&&S.cnLic.state==='ok';}
|
||||
function regionMult(c){const C=CITY[c];if(!C||C.cn)return 1;if(C.kr)return KR_TRANSIT;if(C.au)return AU_TRANSIT;if(C.tape)return 1.5;return C.reg==='AS'?2.5:C.reg==='AF'?2:C.reg==='OC'?1.8:C.reg==='SA'?1.6:1;}
|
||||
// Few networks in the building means few transit sellers to haggle with: up to 1.8× where almost nobody is present.
|
||||
// Hand-set markets (Korea, Australia, Belgian red tape) keep their own price.
|
||||
const txComp=c=>{const q=CITY_PDB[c];return q?clamp((1000/Math.max(q[1],10))**0.15,1,1.8):1;};
|
||||
// No neutral data center means building your own room: POPs cost more to build and to run.
|
||||
const colo=c=>{const q=CITY_PDB[c];return !q?1:q[0]===0?1.5:q[0]<=2?1.25:1;};
|
||||
const popMo=c=>Math.round(POP_MO*colo(c));
|
||||
function regionMult(c){const C=CITY[c];if(!C||C.cn)return 1;if(C.kr)return KR_TRANSIT;if(C.au)return AU_TRANSIT;if(C.tape)return 1.5;const base=C.reg==='AS'?2.5:C.reg==='AF'?2:C.reg==='OC'?1.8:C.reg==='SA'?1.6:1;return Math.round(base*txComp(c)*10)/10;}
|
||||
// A network's own markup on top of that, where it is far from home (Glowball Sakura Lager in Asia and New Zealand).
|
||||
const netMult=(n,c)=>regionMult(c)*((n&&n.far&&CITY[c]&&n.far[CITY[c].reg])||1);
|
||||
const uaePair=(a,b)=>!!CITY[a].uae&&!!CITY[b].uae;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ function spawnOffer(){
|
|||
if(lv>=3&&MEGA.some(m=>mine.includes(m.c)))types.push('ingest');if(lv>=4&&MEGA.some(m=>mine.includes(m.c)))types.push('aiwan','aiwan','mtrain');if(lv>=4&&S.links.some(l=>l.kind==='df'&&l.own&&l.ready<=S.day))types.push('pairs');
|
||||
if(lv>=5)types.push('esport');if(lv>=6&&mine.length>=2)types.push('sov','sov');if(lv>=8)types.push('cgame','cgame');if(lv>=9)types.push('metav','metav');if(lv>=11&&MEGA.some(m=>mine.includes(m.c)))types.push('agi');if(lv>=13&&mine.length>=2)types.push('mars');
|
||||
const br=mine.filter(c=>CITY[c].br);if(br.length)types.push('provedor','provedor','provedor');
|
||||
// Countries with thousands of ASNs (Brazil's provedores, US regionals) are full of small ISPs shopping for transit.
|
||||
const dense=mine.filter(c=>(CITY_PDB[c]||[])[2]>=2000);if(lv>=2&&dense.length)types.push('isp');
|
||||
const fabC=mine.filter(c=>FABS.some(f=>f.cities.includes(c)));if(lv>=2&&fabC.length){types.push('fabip','fabip');if(mine.length>=2)types.push('fabl2');}
|
||||
const t=pick(types),T=BIZ_T[t];
|
||||
if(T.event||T.sdwan||T.fiber||T.mega){spawnSpecial(t);return;}
|
||||
|
|
@ -96,6 +98,7 @@ function spawnOffer(){
|
|||
let name=list.length?pick(list):(T.names?pick(T.names):'Startup #'+Math.floor(Math.random()*999));
|
||||
useName(name);
|
||||
if(t==='provedor')city=pick(br);
|
||||
if(t==='isp'&&dense.length&&Math.random()<0.5)city=pick(dense);
|
||||
if(t==='hft'){const fin=['nyc','chi','lon','fra','tok','sin','hkg','ams','ash'],mf=mine.filter(c=>fin.includes(c));city=mf.length?pick(mf):pick(mine);city2=pick(fin.filter(c=>c!==city));}
|
||||
let rate=T.l2?Math.round((150+kmBetween(city,city2)*0.08)*T.km):T.rate;
|
||||
if(CITY[city].au&&!T.l2&&!T.fiber&&!T.event){rate=Math.round(rate*AU_ARPU);bw=Math.min(bw,pick(T.opts.slice(0,2)));}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
function cityPanel(c){
|
||||
const C=CITY[c],p=S.pops[c],ix=ixName(c),down=p&&p.down>S.day;
|
||||
let h=`<div class="ph"><div style="min-width:0"><div class="eyebrow">${REG[C.reg]} · ${esc(siteName(c,'a'))}</div><h2>${C.name}</h2>
|
||||
<div class="facts"><span class="fact">${tr('city_panel.g_of_eyeballs',{g:fmtG(eyeP(c))})}</span>${grantFact(c)}${latSlow(c)?`<span class="fact bad">🐢 ${tr('city_panel.ms_ms_to_transit',{ms:Math.round(R.latFar[c].ms)})}</span>`:''}${regionMult(c)>1?`<span class="fact">${tr('city_panel.transit_x_pricier',{x:regionMult(c)})}</span>`:''}${C.reg==='AS'&&!C.cn?'<span class="fact ixf">'+tr('city_panel.underserved_users_grow_60_faster')+'</span>':''}${ix?`<span class="fact ixf">${tr('city_panel.ix_ix',{ix:esc(ix)})}</span>`:''}${p?`<span class="fact mine">${tr('common.your_pop')}</span><button class="fact trb" data-act="trace" data-args='{"city":"${c}"}'>🔍 ${tr('common.traceroute')}</button>`:''}${down?`<span class="fact down">DOWN</span>`:''}</div></div>
|
||||
<div class="facts"><span class="fact">${tr('city_panel.g_of_eyeballs',{g:fmtG(eyeP(c))})}</span>${grantFact(c)}${latSlow(c)?`<span class="fact bad">🐢 ${tr('city_panel.ms_ms_to_transit',{ms:Math.round(R.latFar[c].ms)})}</span>`:''}${regionMult(c)>1?`<span class="fact">${tr('city_panel.transit_x_pricier',{x:regionMult(c)})}</span>`:''}${colo(c)>1?`<span class="fact">${tr('city_panel.few_data_centers_pops_x',{x:colo(c)})}</span>`:''}${C.reg==='AS'&&!C.cn?'<span class="fact ixf">'+tr('city_panel.underserved_users_grow_60_faster')+'</span>':''}${ix?`<span class="fact ixf">${tr('city_panel.ix_ix',{ix:esc(ix)})}</span>`:''}${p?`<span class="fact mine">${tr('common.your_pop')}</span><button class="fact trb" data-act="trace" data-args='{"city":"${c}"}'>🔍 ${tr('common.traceroute')}</button>`:''}${down?`<span class="fact down">DOWN</span>`:''}</div></div>
|
||||
<button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div>`;
|
||||
if(!p){
|
||||
h+=`<div class="scroll">${C.note?`<p class="note" style="margin-top:0">${esc(C.note)}</p>`:''}
|
||||
${C.cn?chinaSection(c):''}${C.cn&&!cnOk()?'':`<section><h3>${tr('city_panel.open_a_pop_here')}</h3><p class="lead">${tr('city_panel.a_pop_point_of_presence_is')}</p>
|
||||
${C.ru?`<p class="why">${tr('city_panel.includes_the_mandatory_government',{cost:fmt$(RU_BOX),mo:fmt$(RU_BOX_MO)})}</p>`:''}${btn(tr('city_panel.build_pop_cost_mo_mo',{cost:fmt$(popCost(c)),mo:fmt$(POP_MO)}),'buildPop',{city:c},'pink big',S.cash<popCost(c))}
|
||||
${C.ru?`<p class="why">${tr('city_panel.includes_the_mandatory_government',{cost:fmt$(RU_BOX),mo:fmt$(RU_BOX_MO)})}</p>`:''}${btn(tr('city_panel.build_pop_cost_mo_mo',{cost:fmt$(popCost(c)),mo:fmt$(popMo(c))}),'buildPop',{city:c},'pink big',S.cash<popCost(c))}
|
||||
<p class="note">${tr('city_panel.or_drag_from_one_of_your')}</p></section>`}`;
|
||||
h+=offersHere(c);
|
||||
const trs=NETS.filter(n=>sellsAt(n,c));
|
||||
|
|
|
|||
|
|
@ -692,6 +692,7 @@
|
|||
"city_panel.every_port_is_taken_add_a":"Every port is taken. Add a router or swap to a model with more ports before you plug in anything new.",
|
||||
"city_panel.everything_is_in_one_building_move":"Everything is in one building. Move some uplinks to the other site from the Transit and Peering tabs.",
|
||||
"city_panel.fabrics_list":"Fabrics: {list}",
|
||||
"city_panel.few_data_centers_pops_x":"Few data centers: POPs {x}×",
|
||||
"city_panel.fiber_from_city":"Fiber from {city}",
|
||||
"city_panel.fiber_is_down":"fiber is down",
|
||||
"city_panel.g_of_circuits":"{g} of circuits",
|
||||
|
|
|
|||
|
|
@ -610,7 +610,8 @@ test('Australia: hard mode start in Sydney, dear transit and waves, cheap IX por
|
|||
assert.equal(ev('S.home'), 'syd');
|
||||
assert.equal(ev("regionMult('syd')"), 3, 'transit into Australia costs more than Asia');
|
||||
assert.ok(ev("regionMult('syd')>regionMult('sin')&®ionMult('syd')<regionMult('icn')"));
|
||||
assert.equal(ev("regionMult('akl')"), 1.8, 'Auckland keeps the Oceania price');
|
||||
assert.ok(ev("regionMult('akl')") < ev('AU_TRANSIT'), 'Auckland is not priced like Australia');
|
||||
assert.equal(ev("regionMult('akl')"), ev("Math.round(1.8*txComp('akl')*10)/10"), 'Auckland pays the Oceania price, adjusted for its market');
|
||||
assert.equal(ev("waveMarket('syd','lax',true).reg"), 2.6, 'any subsea wave touching Australia');
|
||||
assert.equal(ev("waveMarket('mel','syd',false).reg"), 1.8);
|
||||
assert.ok(ev("ixPortMo('syd',1)<PORT[1].ix"), 'IX ports are the cheap exception');
|
||||
|
|
@ -1070,3 +1071,25 @@ test('city density: no small city crowds a bigger one, Brazil is slimmer than Eu
|
|||
ev('cam.x=CITY.cpv.x;cam.y=CITY.cpv.y;cam.z=6;draw(0)');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('prices follow real connectivity: thin markets cost more, hubs stay put', () => {
|
||||
const { ev, errors } = load();
|
||||
start(ev);
|
||||
assert.deepEqual(JSON.parse(ev('JSON.stringify(Object.keys(CITY_PDB).filter(c=>!CITY[c]))')), [], 'every entry is a city on the map');
|
||||
assert.ok(ev('Object.keys(CITY_PDB).length') >= 190, 'real-world data for most cities');
|
||||
// A city without data keeps the plain regional price.
|
||||
assert.equal(ev("(()=>{const q=CITY_PDB.fra;delete CITY_PDB.fra;const r=[txComp('fra'),colo('fra'),popMo('fra')];CITY_PDB.fra=q;return r.join()})()"), `1,1,${ev('POP_MO')}`);
|
||||
assert.equal(ev("regionMult('syd')"), ev('AU_TRANSIT'), 'Australia keeps its hand-set transit price');
|
||||
for (const c of ['fra', 'ams', 'lon', 'nyc']) assert.equal(ev(`txComp('${c}')`), 1, `${c} is a hub`);
|
||||
assert.equal(ev("regionMult('sao')"), 1.6, 'São Paulo keeps the South American price');
|
||||
assert.ok(ev("regionMult('rbr')") > ev("regionMult('sao')") * 1.5, 'Rio Branco has few sellers');
|
||||
assert.ok(ev("txComp('rbr')") <= 1.8);
|
||||
assert.equal(ev("colo('rbr')"), 1.5, 'no neutral data center');
|
||||
assert.equal(ev("popCost('rbr')"), ev('POP_COST') * 1.5);
|
||||
assert.equal(ev("popMo('fra')"), ev('POP_MO'));
|
||||
ev("ACT.buildPop({city:'rbr'});compute()");
|
||||
assert.ok(ev('R.cost.pops') >= ev("popMo('rbr')"), 'running cost uses the city rent');
|
||||
ev("selectCity('rbr')");
|
||||
assert.ok(ev("CITY_PDB.sao[2]>=2000&&CITY_PDB.nyc[2]>=2000&&CITY_PDB.kgl[2]<2000"), 'Brazil and the US are dense in ASNs, Rwanda is not');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue