Add South America, Taiwan, more India, the UAE and Cape Town; game menu; more incident variety
This commit is contained in:
parent
de313bda0b
commit
f93c7de191
11 changed files with 270 additions and 53 deletions
24
CHANGELOG.md
24
CHANGELOG.md
|
|
@ -4,6 +4,30 @@ All notable changes to this project are documented here. The project follows
|
|||
[Semantic Versioning](https://semver.org/). Each release is deployed to
|
||||
[seriesoftub.es](https://seriesoftub.es).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- South America is on the map properly: Fortaleza, Rio de Janeiro, Buenos
|
||||
Aires, Santiago, Lima, Bogotá and Panama City, with new cables including a
|
||||
ring round Cape Horn, a direct São Paulo–New York cable and the first
|
||||
cable from Chile to Sydney. Nothing crosses the Darién Gap by land, transit
|
||||
is pricier because so much traffic hairpins through Miami, and fiber over
|
||||
the Andes costs double and breaks often. IX.brrr is run by a nonprofit
|
||||
with cheap public prices, and small Brazilian provedores now buy transit
|
||||
from you.
|
||||
- More India: Delhi, Chennai, Bengaluru and Hyderabad, with east-coast cables
|
||||
to Singapore and a lot of road widening.
|
||||
- Taiwan: Taipei, with cables to Tokyo, Hong Kong, Los Angeles, Seattle and
|
||||
Shanghai, and ships that keep dragging their anchors over them.
|
||||
- The UAE: Abu Dhabi and Fujairah join Dubai. Only the licensed duopoly may
|
||||
run fiber inside the country, so there is no dark fiber, waves cost 3×, and
|
||||
POPs need a free-zone license. Most cables land in Fujairah.
|
||||
- Cape Town, with Atlantic cables up the west coast of Africa and load
|
||||
shedding: bring a generator.
|
||||
- New local networks: Clarovision, Vivo-ish, Mercado Livre-ly, Jio-graphy,
|
||||
Airtel-tale, Chunghwa Tele-calm and do-ish.
|
||||
- Tap your network's name in the top left for a menu to export or import a
|
||||
save, or start a new network.
|
||||
|
||||
## [1.5.0] — 2026-10-23
|
||||
|
||||
- Several transits in the same city now share the load instead of filling one
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"homepage": "https://seriesoftub.es/",
|
||||
"repository": { "type": "git", "url": "git+https://github.com/fjaeckel/seriesoftubes.git" },
|
||||
"scripts": {
|
||||
"test": "node --test --test-concurrency=1 tests/game.test.js tests/build.test.js tests/persist.test.js tests/services.test.js tests/peering.test.js tests/issues.test.js",
|
||||
"test": "node --test --test-concurrency=1 tests/game.test.js tests/build.test.js tests/persist.test.js tests/services.test.js tests/peering.test.js tests/issues.test.js tests/regions.test.js",
|
||||
"build": "bash scripts/build.sh",
|
||||
"serve": "npm run build && npx --yes serve@14.2.4 _site"
|
||||
},
|
||||
|
|
|
|||
BIN
site/in.png
Normal file
BIN
site/in.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 383 KiB |
180
site/index.html
180
site/index.html
File diff suppressed because one or more lines are too long
BIN
site/menu.png
Normal file
BIN
site/menu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 228 KiB |
BIN
site/sa.png
Normal file
BIN
site/sa.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 309 KiB |
BIN
site/tw.png
Normal file
BIN
site/tw.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 317 KiB |
BIN
site/uae.png
Normal file
BIN
site/uae.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 286 KiB |
BIN
site/za.png
Normal file
BIN
site/za.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 217 KiB |
|
|
@ -85,3 +85,30 @@ test('some routers take forever to boot, PacketOinkers most of all', () => {
|
|||
assert.match(ev("document.getElementById('panelBody').textContent"), /a slow one/);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('the network name opens a menu with save, load and start over', () => {
|
||||
const { ev, errors } = load();
|
||||
base(ev);
|
||||
ev("document.querySelector('[data-act=menu]').click()");
|
||||
const t = ev("document.getElementById('modalCard').textContent");
|
||||
for (const w of ['Export save', 'Import a save', 'Start a new network', 'Back to the map']) assert.ok(t.includes(w), w);
|
||||
ev("document.querySelector('#modalCard [data-act=resetAsk]').click()");
|
||||
assert.match(ev("document.getElementById('modalCard').textContent"), /cannot be undone/);
|
||||
ev("document.querySelector('#modalCard [data-act=newgame]').click()");
|
||||
assert.equal(ev("!!localStorage.getItem('sot-save-v1')&&JSON.parse(localStorage.getItem('sot-save-v1')).day>0"), false);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('a rare global outage shows a banner, dents traffic and only happens once', () => {
|
||||
const { ev, errors } = load();
|
||||
base(ev);
|
||||
ev("compute()");const before = ev("R.demand");
|
||||
ev("elephant();compute();renderAll()");
|
||||
assert.ok(ev("R.demand") < before * 0.8);
|
||||
assert.equal(ev("document.getElementById('mega').hidden"), false);
|
||||
for (let i = 0; i < 5; i++) ev("dayTick()");
|
||||
ev("renderAll()");
|
||||
assert.equal(ev("document.getElementById('mega').hidden"), true);
|
||||
assert.equal(ev("S.phpDone"), true);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
90
tests/regions.test.js
Normal file
90
tests/regions.test.js
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { load } = require('./harness');
|
||||
|
||||
function start(ev) { ev("ACT.start({});S.cash=1e9;S.lvl=4;for(const g of GOALS)S.done[g.id]=0"); }
|
||||
|
||||
test('new cities exist, sit on land and have sellers, cables and IX members', () => {
|
||||
const { ev, errors } = load();
|
||||
start(ev);
|
||||
const ids = ['for', 'rio', 'bue', 'scl', 'lim', 'bog', 'pan', 'del', 'maa', 'blr', 'hyd', 'tpe', 'auh', 'fuj', 'cpt'];
|
||||
for (const c of ids) {
|
||||
assert.ok(ev(`!!CITY['${c}']`), c);
|
||||
assert.ok(ev(`NETS.some(n=>n.price&&n.pops.includes('${c}'))`), `${c} has a transit seller`);
|
||||
}
|
||||
for (const c of ['for', 'rio', 'bue', 'scl', 'lim', 'bog', 'pan', 'maa', 'tpe', 'fuj', 'cpt'])
|
||||
assert.ok(ev(`CABLE_PAIRS.some(p=>p.a==='${c}'||p.b==='${c}')`), `${c} has a cable`);
|
||||
assert.ok(ev("ixMembers('sao').includes('clr')&&ixMembers('del').includes('jio')&&ixMembers('tpe').includes('cht')"));
|
||||
assert.ok(ev("CABLE_PAIRS.some(p=>(p.a==='scl'&&p.b==='syd')||(p.a==='syd'&&p.b==='scl'))"), 'Humboldt-ish cable to Sydney');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('South America: no land route over the Darién Gap, the Andes cost double, IX.brrr is cheap', () => {
|
||||
const { ev } = load();
|
||||
start(ev);
|
||||
assert.equal(ev("isSub('pan','bog')"), true, 'Panama to Bogotá is subsea');
|
||||
assert.equal(ev("isSub('mia','sao')"), true);
|
||||
assert.equal(ev("isSub('bue','sao')"), false);
|
||||
assert.equal(ev("landMult('scl','bue')"), 2);
|
||||
assert.equal(ev("landMult('bue','sao')"), 1);
|
||||
assert.match(ev("landWhy('scl','bue')"), /Andes/);
|
||||
assert.equal(ev("regionMult('sao')"), 1.6);
|
||||
ev("ACT.buildPop({city:'sao'})");
|
||||
assert.ok(ev("ixPortMo('sao',1)") < ev("PORT[1].ix*0.5"), 'nonprofit IX ports are cheap');
|
||||
ev("selectCity('sao');ACT.tab({t:'peer'})");
|
||||
assert.match(ev("document.getElementById('panelBody').textContent"), /Run by a nonprofit/);
|
||||
});
|
||||
|
||||
test('Brazilian POPs attract provedores', () => {
|
||||
const { ev } = load();
|
||||
start(ev);
|
||||
ev("ACT.buildPop({city:'rio'})");
|
||||
const seen = JSON.parse(ev("(()=>{const o=[];for(let i=0;i<300;i++){S.offers=[];spawnOffer();o.push(...S.offers.filter(x=>x.type==='provedor').map(x=>x.city));}return JSON.stringify(o)})()"));
|
||||
assert.ok(seen.length > 0, 'provedor offers appear');
|
||||
assert.ok(seen.every(c => c === 'rio'), 'only in Brazilian POPs');
|
||||
});
|
||||
|
||||
test('UAE: duopoly fiber only, no dark fiber, free-zone license', () => {
|
||||
const { ev, errors } = load();
|
||||
start(ev);
|
||||
assert.equal(ev("dfAllowed('dxb','auh')"), false);
|
||||
assert.equal(ev("dfAllowed('dxb','bom')"), true);
|
||||
assert.equal(ev("landMult('dxb','fuj')"), 3);
|
||||
assert.equal(ev("popCost('auh')-popCost('fra')"), ev('UAE_LIC'));
|
||||
ev("ACT.buildPop({city:'dxb'});UI.lmode='df';openLinkModal('dxb','auh')");
|
||||
assert.match(ev("document.getElementById('modalCard').textContent"), /No dark fiber inside the UAE/);
|
||||
ev("UI.lmode='wave';openLinkModal('dxb','auh')");
|
||||
assert.match(ev("document.getElementById('modalCard').textContent"), /licensed operators/);
|
||||
ev("closeModal()");
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('regional incidents: Taiwan anchors, Andes landslides, load shedding', () => {
|
||||
const { ev, errors } = load();
|
||||
start(ev);
|
||||
ev("for(const c of ['tpe','scl','bue','cpt'])ACT.buildPop({city:c})");
|
||||
ev("UI.via=null;openLinkModal('tpe','hkg');ACT.buildLink({tier:1});closeModal()");
|
||||
ev("UI.via='land';openLinkModal('scl','bue');ACT.buildLink({tier:1});closeModal()");
|
||||
assert.ok(ev("S.links.some(l=>l.a==='tpe'&&l.sub)") && ev("S.links.some(l=>l.a==='scl'&&!l.sub)"), 'links built');
|
||||
let anchors = 0, andes = 0, shed = 0;
|
||||
for (let i = 0; i < 400; i++) {
|
||||
ev("S.inc=[];for(const l of S.links)l.cut=0;for(const c in S.pops){S.pops[c].down=0;S.pops[c].gen=false}fireFailure()");
|
||||
const m = ev("S.inc.map(x=>x.msg).join(' ')");
|
||||
if (/anchor/.test(m) && /Taipei/.test(m)) anchors++;
|
||||
if (/Andes|mountain pass|llama|4,000/.test(m)) andes++;
|
||||
if (/Load shedding/.test(m)) shed++;
|
||||
}
|
||||
assert.ok(anchors > 0, 'anchors drag over Taiwan cables');
|
||||
assert.ok(andes > 0, 'the Andes break fiber');
|
||||
assert.ok(shed > 0, 'South Africa sheds load');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('every new city panel renders', () => {
|
||||
const { ev, errors } = load();
|
||||
start(ev);
|
||||
for (const c of ['for', 'pan', 'del', 'tpe', 'auh', 'fuj', 'cpt', 'bog']) {
|
||||
ev(`selectCity('${c}');for(const t of ['cust','up','peer','links','infra'])ACT.tab({t})`);
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue