Compare commits

...

8 commits

Author SHA1 Message Date
jvanvik
41e6fd78ef Review fixes for Starblink, Island Wi-Fi and late joiners
Some checks failed
CI / plan (push) Has been cancelled
CI / build (push) Has been cancelled
CI / translations (push) Has been cancelled
Container image / gate (push) Has been cancelled
CI / part (push) Has been cancelled
CI / test (push) Has been cancelled
CI / timings (push) Has been cancelled
Container image / test (push) Has been cancelled
Container image / publish (push) Has been cancelled
- Until a zone's first circuit or spur is up, its row and panel say when the islands come online instead of homes out of 0 and a red 0% served (wisp-commissioning-homes-of-zero).
- Once your own constellation flies, a zone's Starblink row points to GEO, MEO or a spur (wisp.leo_no_rivals), never to a pie dish (zone-leo-pie-dish-advice).
- The late joiner's welcome and bank note say the match is on home broadband, not island Wi-Fi, in all six languages (late-match-island-homes).
- A gateway's section shows its city's transit ports (Transit out of the city) and warns when they fill; the fiber row only where there is fiber (leo-backhaul-transit-only).
- Spurs are subsea cable, no longer unrepeatered, in every language and the catalog comment (spur-unrepeatered-1400km).
- French calls a spur a câble de dérivation, not a câble d'antenne (fr-spur-cable-antenna).
2026-11-12 03:36:31 +01:00
jvanvik
5ca8270db9 Island Wi-Fi: no new routing fields until you run a zone
emptyR() carried cityWisp, wisp and wispL in every game, so a game with no island zones no longer routed to the same R
as main and tests/route-fuzz.test.js failed on its first move. compute() now adds them only while a zone runs (as
satU), wispMoney() returns without them, and the agent's results docs say so. tests/wisp-zones.test.js checks that a
game without zones, and one below level 2, has none of them. The mp-sim fixtures were written again with
tests/lib/mp-sim-fixtures.js (only the three empty fields left them; a second run changes nothing).
2026-11-12 02:40:09 +01:00
jvanvik
66ac7d0af1 Island Wi-Fi, Starblink and late joiners work together
Checked after merging the three, and pinned with a test (tests/late-joiners.test.js): a late network with a Starblink
zone and a lit spur pays its islanders' income in full but has only its homes matched; investors on a revenue share
take their cut of homes, islands and an IPv4 lease, never of the match; a spur cut and a solar storm need a lit spur or
a LEO circuit, not a number of days, and come on the network's own outage schedule (S.nextFail, counted from S.day0),
so no grace needed moving; a reload keeps the game.

- CHANGELOG: Island Wi-Fi names zones as the game does (Abaco and Eleuthera) and says a spur has upkeep but no rent.
- Agent: a stray "., " in the pops doc where the Starblink and Island Wi-Fi lines met.
- Plans: open question 6 (WISP zones and a rented LEO tier) marked answered and built.
2026-11-12 02:25:24 +01:00
jvanvik
dcdb501f16 Late joiners: a network that joins a server session late starts on its date, with a head start
One calendar for a server session (the user's answer to Q1): a network that joins begins on the session's date, and
one that joins after day 180, when the shared market starts to move, gets a head start (answered 2026-11-11).
Dormant until the host (T3) passes a start day: in the plain build and in single-device play S.day0 is 0 and the
game is as before.

- S.day0, the calendar day a network began: 0 in newGame(), repaired in sanitize() (at most S.day), so old saves load.
  netAge() is the network's age; the first-days rules count it: the charter window (and specSanitize), the tutorial's
  five days, the DDoS grace and early size cap, route leaks, RPKI, the world's bad news, shortages and control-plane
  events, sold-out routes, the scrubbing customers, loan offers, the broker's first calls, the Speedrun and Blitz
  badges and the day counts in the win, lose and Glass Baron windows. The market, the calendar and world events stay
  on the session's date.
- beginState() takes o.day for a session network in Normal mode (lateStart()): the day, the first outage and event,
  the home POP and the first IPv4 block are stamped with it, so the block cannot be sold on day one at the session's
  price.
- The head start (60-features/81-late-joiners.js): starting cash topped up by the rise in hardware prices (START_CASH
  x (hwTrend - 1), to $1,000, at most $60k, with the market rule only) and the first 365 days of home broadband
  matched (R.rev.late: what homes pay after the Australian wholesale cut or levy; outside investors' share, inside
  revMo). A second welcome with a button to the bank, a Goals card, a bank section, a line in a city's broadband pitch
  and a toast when the year is over; every label in all six dictionaries.
- The "since you started" lines (supply chain, bandwidth market, wave prices) measure from the network's own start.
- Server-run engine: srvBegin takes begin.day (an integer from 0, else the begin fails), the fake engine begins there
  and keeps day0 in its saves, CLOCK.off leaves the shape checker and the contract test, and the fixtures' network
  begins on day 473 (written again with tests/lib/mp-sim-fixtures.js; a second run changes nothing).
- Gameplay rule F11, the agent's day0 doc and status age, ARCHITECTURE and the plans (Q1's game side built, open
  question 1 answered).
- tests/late-joiners.test.js; F11 in tests/gameplay-rules.test.js; a late begin in tests/mp-sim-engine.test.js; one
  calendar in tests/mp-sim-contract.test.js.

Merged onto Starblink and Island Wi-Fi: revMo counts both the islands (V.wisp) and the match (V.late), the revenue
share base keeps V.wisp and leaves V.late out; F11 sits before F12 in the gameplay rules and their test; the mp-sim
fixtures were written again with tests/lib/mp-sim-fixtures.js (a second run changes nothing).
2026-11-12 02:16:44 +01:00
jvanvik
9067bae1ce CHANGELOG: shorter first sentences for the Unreleased bullets 2026-11-12 02:15:22 +01:00
jvanvik
efe4405ea4 Investors on a revenue share take their cut of IPv4 lease income (#150)
Merged onto Island Wi-Fi: the revenue share base keeps the islands (V.wisp) and adds IPv4 leases (V.ip4); the CHANGELOG bullet goes above the Island Wi-Fi and Starblink ones.
2026-11-12 02:15:22 +01:00
jvanvik
6f0c080875 Island Wi-Fi for 18 groups of outer islands, by satellite and spur cable (#83)
Each zone (Vanua Levu & Taveuni off Suva, the Out Islands off Nassau, and
16 more) is a pool of island homes at your POP in its city: no node and no
link on the map, its Gbps join the city's demand. Rent backhaul at the
city's teleport (about 35% sign up over GEO, 75% over MEO, 90% over
Starblink from a gateway there) or, from level 3, lay a spur cable and
everyone may sign up. The first order brings the island kit. Islanders pay
island prices, their homes are IPv6-only in the NAT64 pool, and investors
on a revenue share take their cut. A spur can be cut for weeks (failure
'wspur', chaos only): a satellite kept beside it carries the islands. Zones
are off in puzzles, the Architect, scenarios and below level 2.

The satellite geometry works on points now (satSeesAt, satPairAt, satKmAt;
the city functions wrap them, with the same answers). Starblink serves a
zone only from a gateway in its own city (16 of 18; a gateway anywhere in
reach would serve the same 16), with its storm and rival rule; Nunavut and
Southeast Alaska stay on GEO. Rules W6 and F12.
2026-11-12 02:12:21 +01:00
jvanvik
7967a29083 Rent low-orbit satellite capacity from Starblink (#83)
A Starblink gateway on a teleport at a POP on your fiber (level 5, within
56 degrees of the equator) rents LEO circuits of 5 to 50 Gbps to small
islands and remote towns within 1,200 km: a bent pipe 550 km up, about
30 ms round trip, 3% of the service counted as bad, and no selective
network refuses it. LEO puts GEO and MEO circuits on the same pair on
standby and waits beside a cable. The gateway's Infra section shows its
POP's forwarding load and the fiber out of the city, the islands'
bottleneck. A rare solar storm (and Pie's own) puts LEO in safe mode for
a day or two. Once your own crust carries traffic Starblink sells nothing
new. Rule O8. Hooks for island Wi-Fi: leoReachLL, leoKmLL, leoMsLL.
2026-11-12 01:34:46 +01:00
80 changed files with 2441 additions and 167 deletions

View file

@ -27,6 +27,7 @@ These are what the game promises, held up by `tests/gameplay-rules.test.js` (one
| W3 | Every city can buy transit from someone, or is a documented exception (Pitcairn: land your own cable, reach it through a pie dish, or rent a satellite circuit from a teleport; Stuttgart: peering only). | A start or an expansion must never be a dead end by accident. |
| W4 | Cable pairs join two distinct real cities, have a length, and cable ids are unique. | Broken landings break routing and the own-cable planner. |
| W5 | A city alone on its landmass has a cable or a beach to land one. | Islands are reachable. |
| W6 | Every island Wi-Fi zone (`WISP`, #83) hangs off a satellite city (`satRemote`) within 1,000 km of it, seen together with it by a GEO bird; its pool is 3 to 12 G of homes; its spur is at most 1,500 km, or there is none (`km:0`); ids are sorted. | A zone is the outer islands of the city they look to, reachable from the first teleport; smaller ones never pay, and pie terminals serve them. |
## Networks
@ -65,7 +66,7 @@ These are what the game promises, held up by `tests/gameplay-rules.test.js` (one
| Id | Rule | Why |
| --- | --- | --- |
| F1 | A new network gets a gentle start: no outage before day 45, no event before day 40 and only good news before day 50, nothing sold out for 90 days, hardware prices hold for 180, and a new customer loses no mood for 15 days. Its first IPv4 block covers the start: no home behind CGNAT, no IPv4 bill and no IPv4 warning before day 50, even signing every offer that fits. | New players learn before they get punished. |
| F1 | A new network gets a gentle start (counted from the network's own first day; hardware prices hold for the calendar's first 180 days, see F11): no outage before day 45, no event before day 40 and only good news before day 50, nothing sold out for 90 days, hardware prices hold for 180, and a new customer loses no mood for 15 days. Its first IPv4 block covers the start: no home behind CGNAT, no IPv4 bill and no IPv4 warning before day 50, even signing every offer that fits. | New players learn before they get punished. |
| F2 | On On-call, a simple build in a start city (broadband, the cheapest 100G transit, an exchange port with the route server) makes money within 3 months, in Frankfurt, New York, Singapore and Johannesburg. | Seeded today it turns a profit in month 1 or 2; a balance change that breaks this makes the start too hard. |
| F3 | A specialist path (#187) only brings a customer type in below its level when the network can already serve it, or nearly: the spotted cities have POPs, the latency is met, the fiber carries at least three quarters of the smallest order. | Capability, not luck: an offer you cannot fulfil with a reasonable build is a trap. |
| F4 | The chaos monkey visits only On-call and BGP at 3 a.m. (never Change Freeze, Sandbox, puzzles or scenarios), not before day 180, for 120 to 240 days; while it is here its snips replace the ordinary failures, each snip heals within a week, and it goes after tubes with no other way round first. | A test of resilience you can prepare for, not a pile-on: the reward goes to networks built with a second path. |
@ -75,6 +76,8 @@ These are what the game promises, held up by `tests/gameplay-rules.test.js` (one
| F8 | In the capacity market (Lambda Bazaar), a managed wave comes out of capacity you lit yourself (your own traffic gets that much less, and the customer suffers when your optics cannot carry it), rides one channel (an 800G or 1.6T wave needs an optic that big), and is priced against its fiber: a 400G wave 2.7 times a 100G one on land and 3.8 times on subsea, each bigger size cheaper per bit. Spectrum lists at 30% of the fiber's monthly cost, and heat moves any price by at most −30% to +35%. | Selling lit capacity must cost capacity, or every fiber sells twice; the ratios are 2025 market prices (TeleGeography), so bigger waves win on volume, not on price per bit. |
| F9 | A strict latency contract (`BIZ_T.lowlat`, #137) comes only from customer level 7, is 1.6T or 3.2T and never grows past 3.2T, has a latency limit something you can build meets (`latMaxOf`, as trading links), pays more per Gbps than any other big circuit on the same route even with all their extras, and once its 15-day grace is over credits a day's fee and loses patience faster for every day over its limit. | Real low-latency routes sell at a premium for guaranteed milliseconds and pay service credits when they miss; the cap keeps one contract from carrying a level. |
| F10 | Growth goes sideways, plus one paid way up: a PNI bundles eight members per router at its POP, up to 32 (`pniLagMax()`); transit, exchange and fabric LAGs stay at eight (`LAG_MAX`). Giant AI circuits land at campuses (`MEGA`) in at least 30 metros, no metro more than two, picked less often where giant circuits already crowd the city. | Raising caps only moves the wall; a fatter PNI costs a router (its price and its port slots), and the late game's demand spreads over many metros as real AI and cloud campuses do (#61, #323). |
| F11 | A network that joins a server session after its first 180 days starts on the session's date with F1's gentle start, the charter and the tutorial counted from its own first day, a starting-cash top-up as large as the rise in hardware prices (START_CASH × (hwTrend − 1), at most $60k), and its first 365 days of home broadband income matched (after wholesale cuts, outside investors' share); the market stays on the session's date. | One market for everyone, and a friend who joins late still gets a fair start. |
| F12 | Island Wi-Fi (#83), on a zone's own books at full take-up in era 1 (its homes at island prices less the towers' upkeep and the backhaul rent; the teleport, tracking antennas and a Starblink gateway are shared and left out), makes money on at least one way in; a spur earns more than any satellite option, MEO at least as much as GEO and LEO at least as much as MEO where both reach; spurs up to 250 km pay back within 5 years against the best GEO or MEO stage, up to 1,000 km within 10. | The ladder (GEO, then MEO or LEO, then your own cable) must be worth climbing, and its first rung must not lose money; the longest spurs are a choice, not a given. |
## DDoS
@ -95,4 +98,5 @@ These are what the game promises, held up by `tests/gameplay-rules.test.js` (one
| O4 | Through space with lasers, light travels at c in vacuum (about 1.47 times glass), up and down at the shell's height; orbit never carries traffic between cities under 3,000 km apart and only latency-routed circuits fly: IP traffic, bulk and scenic circuits stay on fiber. | Real constellations win only on long routes, and their capacity is small. |
| O5 | Launches fail only with chaos on (`rule('chaos')`), and never in the first 90 days after the unlock; heavy test flights explode by design, not by chance. Orbit incidents and geopolitical spats (`pieChaos()`) follow the same rule. | Like F1: learn the thing before it punishes you. |
| O7 | A fresh Tier 1 cannot afford a full Shortcrust from its first year's money: even a big network's yearly profit plus the largest loan a bank would offer (and the Ex-Im Pie Bank's most) stays below the cheapest full build (`pieFullCost('short')`). And a full lasered Shortcrust, played through the game loop on the big-network save by a sensible policy (reusable rockets, two pads, no launches past the crust's size except replacements, safe mode in storms, dishes grown with demand at well-served POPs, every orbit offer signed), pays back on its own books (`S.pie.book`: every launch, replacement, dish, licence and running cost against orbit income) in 5 to 10 years, never sooner; government money (the Rural Digital Pie Fund, Pitcairn's satellite grant) brings that forward by at most two years, never under four (`tests/pie-balance.test.js`; `PIE_BALANCE_YEARS=10` prints the long run). | Obscenely expensive is the joke and the goal; a constellation in year one would be a cheat code. |
| O8 | Rented LEO (Starblink, #83) reaches only within `SAT_ORB.leo.km` of a gateway under its shell (`SAT_ORB.leo.lat`) at a POP on your fiber (the mainland, or an island with a lit wired link or transit); once a crust of your own carries traffic it sells nothing new (no gateway, circuit or growth), while circuits already rented keep running; and every size costs more per Gbps than any subsea wave over its whole reach. | A bent pipe is regional; the rented tier must not undercut your own constellation; and a cable stays the better buy wherever one can go. |

View file

@ -6,6 +6,9 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
- Investors on a revenue share now take their cut of your IPv4 lease income too, as they already did of fiber pairs you lease out (#150). Selling a block is still a one-off that is all yours, like the up-front price of a fiber pair, and the NOC dashboard's Investor revenue share row now includes the leases.
- Island Wi-Fi: bring the internet to 18 groups of outer islands, over satellite capacity first and your own spur cable later (#83). Each group looks to an island city, like Vanua Levu to Suva or Abaco and Eleuthera to Nassau: open a POP there and its Customers tab lists them. Rent capacity at the city's teleport and about a third of the islanders sign up over GEO, three quarters over MEO and nine in ten over Starblink from a gateway there; from level 3 a spur cable from the city lets everyone sign up, with upkeep but no rent. Islanders pay island prices, their homes are IPv6-only from day one, and their traffic rides the city's routers and links. A spur can be cut and the repair ship takes weeks: a satellite circuit kept beside it carries the islands meanwhile. Investors on a revenue share take their cut of what the islands pay.
- Rent low-orbit satellite capacity from Starblink from level 5: islands near your fiber get circuits at about 30 ms round trip (#83). Host a Starblink gateway at a teleport on your fiber, then rent 5 to 50 Gbps to small islands and remote towns within 1,200 km of it. Users hardly notice the lag, and selective networks peer over it as over a cable; next to a cable it waits on standby, and a GEO or MEO circuit to the same island waits on standby beside it. Every island behind a gateway leans on that POP's routers, fiber and transit, which its teleport section now shows, and a rare solar storm puts the circuits in safe mode for a day or two. Once your own constellation carries traffic, Starblink sells you nothing new.
- A POP you mark as a micro POP, medium POP or regional hub now keeps that kind's routers when you also have a build standard (#315). Its router model and count come from its kind: "Bring everything up now" and your intern no longer swap its routers or add more to meet the build standard, while the standard's other targets still apply there. The POP's router section says so.
- Send to another device now gives a multiplayer network its session link, on copies of the game you host yourself (#263). The link carries on with the network in the session on the other device, and pasting it under From another device opens it there too; the save file stays a copy that plays on alone.
- Buy it and sign no longer spends money on an offer your IPv4 space cannot take (#150). The button only shows once the deal's address block fits.
@ -15,14 +18,14 @@ All notable changes to this project are documented here. The project follows
- The build standard can now take every broadband city IPv6-only while IPv4 is scarce (#150). Its new target, Broadband: IPv6-only, swaps the home routers of every city still on dual stack for 464XLAT ones, the cities with the most dual-stack homes first. "Bring everything up now" and your intern's Keep to the build standard order start a city's swap only with all of it to spare, and the intern counts it against the order's monthly budget. What the swaps under way still owe is set aside: the button's other jobs and every one of your intern's standing orders leave it alone, above the cash floor.
- "Bring everything up now" in the build standard no longer takes a fiber dark for a day while a customer's alien or managed wave rides it. Such a fiber keeps its line system and the sheet says why; the upgrade button on the fiber itself still does it when you choose. Your intern waits for those fibers too, but no longer skips fibers that only carry leased pairs or IRUs, which a line system swap never touches.
- Broadband cities can now go IPv6-only with 464XLAT, a second way to save IPv4 next to CGNAT. Start it from a city's Home broadband, which also says what it does to your monthly IPv4 bill: its home routers are swapped over a month or more, paid as each one goes in (new homes there get one too, at the same price), and the homes then need no IPv4 address of their own, only a share of a NAT64 pool at up to 256 homes per address, with fewer refunds than CGNAT at the same ratio. The bank's Address space section shows your homes as public, behind CGNAT and IPv6-only, with the NAT64 ratio next to the CGNAT one, and says which of the two to stretch when space runs out.
- CGNAT gets a little cheaper every year: the world moves to IPv6 about two points a year, so less of your homes' traffic needs IPv4 and the CGNAT and NAT64 boxes carry less of it.
- CGNAT gets a little cheaper every year as the world moves to IPv6. About two points less of your homes' traffic needs IPv4 each year, so the CGNAT and NAT64 boxes carry less of it.
- The router model and the line system your intern standardizes on are now picked in one place, the build standard. Keep routers ahead and Upgrade optical transport take them from there and say so, with a button to the sheet. With a model or line system in the standard, both orders bring everything up to it and stop there (Upgrade optical transport on every fiber, even at POPs that Keep to the build standard skips); "Keep as is" leaves them to the next one up when busy. A model or line system you had picked in an order that was running moves into your standard, so new POPs get that model too.
- Your intern no longer takes a fiber dark for the build standard just because it looks quiet: like the optical upgrade order, it first checks that every gigabit, circuit and express gets around the fiber for the day. The two orders share one line system swap a night (two for Kevin), never work on the same fiber in one shift, and a wave the standard just upgraded is no longer handed back the same day.
- Copies of the game you host yourself can now have multiplayer: friends join your session with a six-character code and build their networks next to yours in the same world, with a leaderboard, a feed with chat, saves kept on your server and a link to carry a network to another device. It needs the small session server that comes with the source code, so the game at seriesoftub.es stays single-player.
- Your intern no longer takes a fiber dark for the build standard just because it looks quiet. Like the optical upgrade order, it first checks that every gigabit, circuit and express gets around the fiber for the day. The two orders share one line system swap a night (two for Kevin), never work on the same fiber in one shift, and a wave the standard just upgraded is no longer handed back the same day.
- Copies of the game you host yourself can now have multiplayer, with friends building their networks next to yours in the same world. They join your session with a six-character code, and the session has a leaderboard, a feed with chat, saves kept on your server and a link to carry a network to another device. It needs the small session server that comes with the source code, so the game at seriesoftub.es stays single-player.
- Dark mode: pick Light, Dark or Auto (follows your device) under Settings › Theme. The panels, the NOC dashboard and the map all go dark, with a night-time sea and land, and the setting is kept on your device (#80).
- Express lightpaths: light a wave straight through the cities between your own dark fibers, without touching the routers there. Wherever two or more of your ROADM fibers on land meet, a fiber's panel lists where an express can go and the link window gets an Express tab; it uses ports only at its two ends, saves a hop of latency and takes one channel slot on every fiber it rides, and the light has to reach all the way between regen sites. A cut or a line system swap on any of those fibers darkens it, and a fiber can only be given up once no express rides it. (#58)
- Teleports bring satellites to small islands and remote towns, long before you have a cable there or a rocket company (#83). Build one at a POP from level 2 and rent GEO circuits (about 600 ms round trip, and users notice) or, with tracking antennas from level 3, MEO circuits (about 130 ms) to any island or town its satellites see. Next to an island's only cable a circuit waits on standby (whether the cable or the circuit came first) and carries the island when the cable is cut, and a city with no cable at all gets a POP and a circuit in one order.
- Set a build standard for your whole network: routers, a second building and a generator at every POP, LAGs, exchange ports and PNIs, line systems, optics and wave sizes, all in one sheet. New POPs get the POP part the day they open, the sheet shows what is below the standard and what fixing it costs, one tap brings everything up, and the new "Keep to the build standard" order has your intern do it a few jobs a day with money to spare. Find it in the menu, the Standing orders sheet and every POP's router section.
- Set a build standard for your whole network: what every POP, connection and fiber should have, all in one sheet. It covers routers, a second building and a generator at every POP, LAGs, exchange ports and PNIs, line systems, optics and wave sizes. New POPs get the POP part the day they open, the sheet shows what is below the standard and what fixing it costs, one tap brings everything up, and the new "Keep to the build standard" order has your intern do it a few jobs a day with money to spare. Find it in the menu, the Standing orders sheet and every POP's router section.
- IPv4 is scarce now: business customers need public address blocks, and the homes that do not fit share addresses behind CGNAT. A new network starts with a /21 from its registry, enough for its first months; buy, lease or sell blocks from /24 to /16 on the transfer market in the bank's new Address space section, or lease spare ones out for a monthly income. An offer you have no addresses for says so and waits, a customer that wants to grow at renewal stays at its size until you have the addresses, CGNAT costs a little and annoys some gamers, and you pick how many homes share an address. IPv6 stays free for everyone. This is part of On-call and BGP at 3 a.m.; the gentler rules, Sandbox, puzzles and scenarios keep IPv4 plentiful, and saved games get the addresses they already use plus room to grow (#150).
- Express lightpaths now pay their share when you add a regen site, and a dirty connector on a fiber dims the expresses riding it too (#58). A regen site added to a fiber that already carries expresses needs a regen card for each of their channels, just as for the fiber's own, and the price on the fiber's button includes them. A dirty connector dims every wave in that fiber, and the express's panel says which fiber it is; an MTU mismatch, microbursts or a marginal optic stay with that fiber's own routers and optics, which an express passes by.
- Many selective networks now refuse to peer where a satellite circuit is your only way out (#83). On an island or in a remote town that only a satellite joins to the rest of your network, they would hand you traffic for your whole network to haul through orbit, so more of them turn down a GEO hop (about 600 ms there and back) than a MEO one (about 130 ms), and each says why on the exchange and PNI lists. Once a wave, fiber or cable to the island is lit they peer again. An exchange session you already had there pauses until then; a PNI you already have and the members of an exchange you run yourself keep peering.

View file

@ -107,7 +107,9 @@ build stays the static page described above.
| `src/game/60-features/34-ipv6-only.js`, `src/game/90-actions/55-ipv6-only.js` | IPv6-only broadband: a city's home routers swapped for 464XLAT, and the NAT64 pool next to CGNAT; the build standard's `v6` row rolls it out (`ip6Todo()`, `ip6Owed()`) |
| `src/game/80-simulation/65-express.js`, `src/game/90-actions/87-express.js`, `src/game/93-ui/72-express.js`, `src/game/96-map/51-express-geometry.js` | Express lightpaths (#58): a link of kind `xp` from A to C over a chain of ROADM fibers, passing the cities between as light; its rules, actions, panels, the link window's Express tab, and how the map draws it |
| `src/game/10-catalog/75-satellites.js`, `src/game/60-features/45-teleports.js`, `src/game/90-actions/87-teleports.js`, `src/game/93-ui/72-teleport-panels.js` | Satellites (#83): teleports at POPs (`p.tele`) and rented GEO and MEO circuits (links of kind `sat`): the birds and their reach, the rules and money, the actions and the panels |
| `src/game/10-catalog/76-wisp-zones.js`, `src/game/60-features/46-wisp-zones.js`, `src/game/90-actions/87-wisp-zones.js`, `src/game/93-ui/73-wisp-panels.js` | Island Wi-Fi (#83): zones of outer islands (`WISP`), each a pool of homes at its city's POP (`p.wisp`) whose Gbps join the city's demand; their backhaul from the city's teleport (GEO, MEO, Starblink LEO) or a spur cable, the spur cut (incident `wspur`), the money, the actions and the panels |
| `src/game/60-features/89-multiplayer.js`, `src/game/95-modals/48-multiplayer.js`, `src/game/90-actions/92-multiplayer.js`, `src/styles/41-multiplayer.css` | Multiplayer, only in a copy built with `MP_API` ([MULTIPLAYER.md](MULTIPLAYER.md)): `S.mp`, saves and cards sent to the session server, the `#mp=` link; the title screen's door, the session panel and the HUD chip; `srvOn()`, false until server-run play is switched on |
| `src/game/60-features/81-late-joiners.js` | Late joiners of a server session: a network begins on the session's date (`S.day0`; `netAge()` counts its first-days rules from there), with a hardware top-up and a year of home broadband matched (`R.rev.late`); the Goals card, the bank section and the city pitch. Dormant until the host passes a start day (T3) |
| `src/game/98-server-play/`, `src/styles/43-server-play.css` | The page's side of server-run play (T4), only in a multiplayer build's page; a comment so far ([plans/server-run.md](plans/server-run.md)) |
| `scripts/mp-server.js`, `scripts/lib/mp.js` | The multiplayer session server: the command line and the built site, and the API with its storage. `npm run dev -- --mp` mounts the API in the development server |
| `scripts/lib/mp-sim-acts.js` | Server-run play's act tables (SEND, ASK, VOTE, LOCAL, CONFIRM, DRAFTS, TEXT, WINDOWS…) and the envelope check every request passes |

View file

@ -83,9 +83,10 @@ The four questions of the server-run design:
## Open questions waiting for the user
Asked on 2026-11-09, not answered yet:
1. **Late joiners' prices and beginner grace.** With one calendar, a friend who joins an old session meets its economy
from day one: at day 1868, hardware about 18% dearer and customer prices about 34% lower, with the 180-day beginner
grace long over. Keep that, or give a grace or extra starting cash counted from the joiner's own start?
1. ~~**Late joiners' prices and beginner grace.**~~ *Answered 2026-11-11 ("late joiners get a late joiners bonus and a
year of double income per Gbps of FTTP sold/provided") and built: the day-0 rules count from the network's own start
(`S.day0`, `netAge()`), and a network that joins after day 180 gets a hardware top-up and its first year of home
broadband matched (`60-features/81-late-joiners.js`, gameplay rule F11). Dormant until T3 passes a start day.*
2. **Other players' POPs on the map.** Draw other players' POPs and links on your map (from their cards) as part of
the server-run work, or wait for phase 2?
3. **The other modes in a multiplayer build.** Sandbox, scenarios, puzzles and the weekly keep running on the device.
@ -96,11 +97,12 @@ Asked on 2026-11-09, not answered yet:
settle the clash at the next merge?
5. **#58 whole-fiber splicing.** Is the express lightpath enough, or should a whole fiber pair also splice through a
city (one dark fiber A–C through B, with no ROADM at B)? The issue asks for "waves and/or entire fibers".
6. **#83 WISP zones and a rented LEO tier.** Add island demand pools served remotely on top of the existing island
cities, and a tier between MEO and Pie in the Sky that rents LEO capacity from a partner network? Or are teleports
with GEO and MEO circuits enough?
7. **Investors' cut of IPv4 lease income.** Should investors on a revenue-share loan take their cut of the income from
leasing out IPv4 blocks too? Today they do not (dark fiber sold to customers is in their share).
6. ~~**#83 WISP zones and a rented LEO tier.**~~ *Answered 2026-11-11 ("wisp and leo please") and built: Starblink
LEO circuits from a gateway at a teleport on your fiber (level 5), and Island Wi-Fi for 18 zones of outer islands
over GEO, MEO or Starblink and a spur cable (`60-features/45-teleports.js`, `60-features/46-wisp-zones.js`, gameplay
rules O8, W6 and F12).*
7. ~~**Investors' cut of IPv4 lease income.**~~ *Answered 2026-11-11 (yes) and built: investors on a revenue share
take their cut of IPv4 lease income, as of fiber pairs leased out; a sale stays all the player's.*
8. **Founding an exchange on a basic router.** Founding your own exchange gives a 400G port even where the POP's router
only takes 100G, though the shop would not sell that port. Document it as a limitation, block founding until the
router takes 400G, or found at the router's largest port size? (`tests/server-sim-prereqs.test.js` asserts today's
@ -110,8 +112,9 @@ Asked on 2026-11-09, not answered yet:
## Next
- **After the user's go:** T3 (host and protocol), T4 (the browser client) and the integration of server-run play,
as `docs/plans/server-run.md` describes them, with the corrections at its top. That includes the Q1 work: the game's
`S.day0` and day-0 rules, a start day for a new network on the server, and `CLOCK.off` taken out of the contract.
as `docs/plans/server-run.md` describes them, with the corrections at its top. The game's side of the Q1 work is
built (`S.day0`, the day-0 rules, `begin.day`, `CLOCK.off` gone, the late joiner's head start); T3 sends the start
day, checks every network's day after each tick and replaces the line-up of 4.7 ("What Q1 changes").
## Known limitations of what shipped
@ -142,8 +145,8 @@ Asked on 2026-11-09, not answered yet:
- **Dark mode (#80):** the share card PNG and the web manifest stay light; the WebGL map was checked by tests only, not
by eye in a real GPU browser.
- **IPv4 (#150):** the intern does not manage addresses (optional in the issue); transfers are instant (real ones take
weeks); lease-out income is not in the investor revenue share (open question 7); blocks granted to old saves can be
sold after two years (a one-off windfall); CGNAT annoyance costs refunds but does not slow broadband growth.
weeks); blocks granted to old saves can be sold after two years (a one-off windfall); CGNAT annoyance costs refunds
but does not slow broadband growth.
- **IPv6-only broadband:** no one-off grumble while a city's home routers are swapped; a new home in an IPv6-only city
pays its router even when cash is short (a running cost, so a finished city never looks like a stopped swap). The
NAT64 ratio is not in the build standard (the swap is), and the standard starts a swap only with the whole of it to
@ -151,7 +154,15 @@ Asked on 2026-11-09, not answered yet:
- **Express fiber (#58):** a whole fiber pair does not splice through a city (every fiber end is a POP; expresses
cover the need; open question 5). Of a fiber's own incidents only the dirty connector dims its expresses; MTU,
microbursts and a marginal optic stay with its routers and optics.
- **Satellites (#83):** no WISP zones and no rented LEO tier (open question 6); the rented GEO and MEO circuits never
- **Island Wi-Fi (#83):** a zone's traffic enters at its own city's POP, so Starblink serves it only from a gateway in
that city (16 of the 18 zones; a gateway anywhere in reach would serve the same 16): Nunavut and Southeast Alaska lie
beyond the 56° shell and MEO's ring, so they stay on GEO (Southeast Alaska keeps its spur). One circuit, one move
and one spur per zone; a standby satellite pays full rent; no standing order for island backhaul, no zones on the
map or the multiplayer card, no rain fade. The spurs follow real domestic cables: Tahiti to the Tuamotus and
Marquesas (Natitua), Tonga's domestic cable (cut by the Hunga Tonga eruption in 2022), Papua New Guinea's Kumul,
the Solomons' and the Maldives' domestic networks, the Bahamas' and Cape Verde's inter-island cables, and Southeast
Alaska's.
- **Satellites (#83):** the rented GEO and MEO circuits never
fail (no rain fade or sun outage; Pie in the Sky has its own); no island volcano or Caribbean and Pacific hurricane
events; no "Island Hopper" scenario; no footprints on the map; no satellite tab in the drag-to-link window (ordering
is from the city panel; the no-cable hint offers a teleport's order sheet only for the city it names); selective

View file

@ -72,6 +72,7 @@ in `pieV` saves. Remote cities (Pitcairn, Arctic) servable from orbit.
Rapid Unscheduled Disassembly, booster falls over, solar storm (safe mode), food fight (debris, rare,
Space Roomba fix), rain fade, backhoe at the dish, astronomers (VisorSat), Founder posts at 3 a.m.,
chaos monkey snips a laser link.
A solar storm also puts Starblink, the rented LEO tier at your teleports (#83), in safe mode for a day or two.
## Geopolitical spats (cartoon, even-handed, countries as data, never real leaders)
@ -112,6 +113,8 @@ open, paused when hidden, capped frame budget, fewer dots on phones. Final look
O1 gate, O2 half-baked carries nothing / capacity <= dishes, O3 disconnected dish no transit, O4 vacuum
latency, never beats fiber < 3000 km, O5 chaos + 90 quiet days, O6 rideshare <= demand,
O7 fresh Tier 1 cannot afford a full Shortcrust in year 1; full constellation never pays back < 5 years.
O8 (the rented LEO tier, #83): Starblink sells no new gateway, circuit or growth once a crust of yours carries
traffic; circuits already rented keep running, billed with the teleports, never on `S.pie.book`.
## Every change

View file

@ -30,9 +30,12 @@ the plain build is unchanged.
4. Phase-1 sessions **start fresh**: nothing is migrated. They keep running as phase 1 in the new build (section 8).
**Open with the user** (asked on 2026-11-09, not answered yet; `next-session.md` has the full list of nine):
- A late joiner meets the session's economy from day one. In a session about five years old (day 1868), hardware costs
- ~~A late joiner meets the session's economy from day one. In a session about five years old (day 1868), hardware costs
about 18% more and customers pay about 34% less, and the 180-day beginner grace is long over. Keep it so, or give a
grace or extra starting cash counted from the joiner's own start?
grace or extra starting cash counted from the joiner's own start?~~ *Answered 2026-11-11: "late joiners get a late
joiners bonus and a year of double income per Gbps of FTTP sold/provided". Built (see "What Q1 changes"): a network
that begins after day 180 gets a starting-cash top-up as large as the rise in hardware prices and its first 365 days
of home broadband income matched (`60-features/81-late-joiners.js`, gameplay rule F11).*
- Other players' POPs and links drawn on your map (from their cards): part of this work, or later?
- Sandbox, scenarios, puzzles and the weekly stay on the device in a multiplayer build (section 1). Is that fine, or
should sandbox (or all of them) run on the server too?
@ -198,6 +201,18 @@ ASK, or send a circuit's `l2route` entries on demand. Not decided yet; it is T4'
The design assumes each network keeps its own date (sections 0 and 1, 4.3 "Calendar", `p.net.off` in 4.6, 4.7, 14 and
row F4), and T1 and T2 were built that way. Under the answer:
**Built (2026-11-12, dormant until T3 passes a start day):** the game's `S.day0` and `netAge()`, every day-0 rule below
counted from the network's own start (and the scrubbing offers, the loan offers, the broker's first calls and the
"since you started" lines of the supply chain, the bandwidth market and the wave prices), `beginState`'s `o.day`
(`lateStart()`: the schedules, the home POP and the first IPv4 block stamped with it), `srvBegin`'s `begin.day` (an
integer from 0, else the begin fails), the fake engine's start day, `CLOCK.off` out of the shape checker, the fixtures
(their network begins on day 473) and the contract test, and the late joiner's head start
(`60-features/81-late-joiners.js`). The card's `day` (`mpCard()`) stays the calendar date, which phase 1 compares; the
market and the calendar stay the session's. Left for T3: the host sends `begin.day` (the session's day; a session's first
network keeps 0, a fresh network after bankruptcy is late again), checks after each tick that every reply's day is `d`
(lost and broken networks excepted), drops `off` from the live session and `p.net`, and replaces the line-up of 4.7;
"Move to the server" makes a session of one at the save's own day and keeps its `day0`.
- **Begin needs a start day.** `srvBegin` calls `beginState` with no day, and the `begin` message carries none. Both
take the session day, passed on as `beginState`'s `o.day`. The fake engine begins at the given day.
- **`CLOCK.off` goes,** or is pinned to zeros: in `tests/lib/mp-sim-shape.js`, the fixture generator

View file

@ -174,6 +174,8 @@ const SEND = [
'teDeploy',
'teToggle',
'teleBuild',
'teleLeo',
'teleLeoRm',
'teleRm',
'teleTrk',
'togglePrem',
@ -191,6 +193,11 @@ const SEND = [
'utilityKitNew',
'utilityPeers',
'utilityRouteServers',
'wispRm',
'wispSat',
'wispSatRm',
'wispSatSize',
'wispSpur',
'xpBuild',
'xpCh',
];
@ -365,6 +372,7 @@ const LOCAL = [
'via',
'vpSet',
'whatsNewShow',
'wispOpen',
'wsShare',
'xfer',
'xferFile',
@ -429,7 +437,10 @@ const CONFIRM = {
rmScrub: 'scrub:{city}',
rmSite: 'site{city}',
salesFire: 'salesFire',
teleLeoRm: 'leo:{city}',
teleRm: 'tele:{city}',
wispRm: 'wz:{z}',
wispSatRm: 'wsat:{z}',
};
// The UI.confirm key a preset act's first click writes (null for 'arg' acts and acts that do not confirm).
const SRV_ARM = Object.fromEntries(Object.entries(CONFIRM).filter(([, v]) => v !== 'arg'));

View file

@ -8,12 +8,15 @@
// {t:'loaded', nid, err}], one per network, in order. env: the checkpoint envelope {s, uidN, rt, last,
// day} (s: the save text; rt: what the realm needs besides it to play on exactly as before, opaque
// here: route memory, R's routing point, key order, the sales desk's memory); begin: {name, home,
// preset, asn, mp, tut} builds a new network, checkpointed at once (saved). A network that comes
// preset, asn, mp, tut, day?} builds a new network, checkpointed at once (saved); day is the
// session's date, where it begins (absent or 0: the session's first day). A network that comes
// without a save, whose save does not load, or that cannot begin answers err: broken (4.7), and
// the others load. A load of a network that is loaded replaces its realm (a failed one leaves none).
// engine.day(code, {d, speed, last, alone:[nid], nets:[nid], mute}) → {t:'dayDone', code, d, nets:{[nid]: {day, lost,
// pause?, err?, retried?, ms}}}. Each network in sorted order; one that failed twice answers err and
// its day as it was, and is broken from then on (no more days; actions answer 'stopped').
// its day as it was, and is broken from then on (no more days; actions answer 'stopped'). One
// calendar for the session: the host (T3) checks that every network's day here is d, lost and
// broken networks excepted; the engine does not.
// engine.act(code, nid, msg) → {t:'actDone', nid, epoch, rid, outcome, why?, v, upd, ms} (upd: the update with the
// result, version v; null when stopped) | {t:'err', code, nid, rid, what:'timeout'|'throw', msg}
// engine.ask(code, nid, msg) → {t:'askDone', nid, rid, modal?, ui?, err?, ms} (neither modal nor err: the what-if

View file

@ -300,12 +300,15 @@ function srvLoad(inp){const m=JSON.parse(inp),rt=m.rt&&typeof m.rt==='object'?m.
SIMR.seen=true;
return JSON.stringify({day:S.day,lost:!!S.lost});}
const srvClockNow=()=>self.__srvClock?{clock:__srvClock()}:{};
// srvBegin: a new network of a server session (T1's beginState, then the server's own marks and the welcome).
// srvBegin: a new network of a server session (T1's beginState, then the server's own marks and the welcome). b.day: the
// session's date, where the network begins (one calendar for the session; 0 or none: its first day).
function srvBegin(inp){const m=JSON.parse(inp),b=m.begin||{};SIMR.strict=!!m.strict;
if(typeof b.home!=='string'||!homeOk(b.home))throw new Error('srvBegin: '+String(b.home).slice(0,20)+' cannot be a home city');
if(!b.mp||typeof b.mp!=='object')throw new Error('srvBegin: no session');
const D=b.day===undefined?0:b.day;
if(!Number.isInteger(D)||D<0||D>1e7)throw new Error('srvBegin: '+String(b.day).slice(0,20)+' is no start day');
srvSetPrefs(m.prefs);UI.pitched=true;
beginState(String(b.name||'').slice(0,24)||randomNetworkName(),b.home,{mode:'normal',preset:b.preset,mp:b.mp,asn:Number(b.asn)});
beginState(String(b.name||'').slice(0,24)||randomNetworkName(),b.home,{mode:'normal',preset:b.preset,mp:b.mp,asn:Number(b.asn),day:D});
if(!S.mp)throw new Error('srvBegin: the session did not take');
S.mp.sim=1;S.tut=b.tut?0:null;compute();srvFresh(m.epoch);
// The welcome: in S.log, and an fx that waits for the first update after the first snapshot (srvPullParts).

View file

@ -150,6 +150,7 @@ function createCore(opts = {}) {
e.realm = build(n.nid, n.lang);
e.lang = e.realm.lang;
const epoch = epochOf();
// begin: {name, home, preset, asn, mp, tut, day?}, passed on untouched (srvBegin checks it; day: the session's date).
const [h] = n.begin
? call(e, 'srvBegin', { begin: n.begin, prefs: n.prefs, epoch, strict: !!opts.strict }, T.load)
: call(e, 'srvLoad', { save: n.env.s, uidN: n.env.uidN, rt: n.env.rt, prefs: n.prefs, rng: n.rng, epoch, strict: !!opts.strict }, T.load);

View file

@ -2835,6 +2835,17 @@
"keys.show_this_list":"Diese Liste zeigen",
"keys.space":"Leertaste",
"keys.zoom_the_map_out_or":"Karte heraus- oder hineinzoomen",
"late.bank_note":"Weil du dieser Session spät beigetreten bist. Verdoppelt wird, was dir Heim-Breitband nach einem Wholesale-Anteil zahlt, nicht Insel-WLAN, und Investoren bekommen davon nichts ab.",
"late.bb_pitch":{"one":"Du bist spät dazugekommen: Noch {n} Tag lang wird verdoppelt, was dir die Haushalte hier zahlen.","other":"Du bist spät dazugekommen: Noch {n} Tage lang wird verdoppelt, was dir die Haushalte hier zahlen."},
"late.card":{"one":"Heim-Breitband zahlt noch {n} Tag doppelt: gerade +{price}/Monat.","other":"Heim-Breitband zahlt noch {n} Tage doppelt: gerade +{price}/Monat."},
"late.hello":"<b>Spät zur Party, aber willkommen.</b> Diese Session läuft schon {n} Tage, und Hardware kostet {p} mehr als an ihrem ersten Tag, also legt die Bank {cash} auf dein Startkapital drauf. In deinem ersten Jahr zahlt Heim-Breitband doppelt: Jeder Dollar, den es dir zahlt, wird verdoppelt (Insel-WLAN nicht).",
"late.hello_flat":"<b>Spät zur Party, aber willkommen.</b> Diese Session läuft schon {n} Tage. In deinem ersten Jahr zahlt Heim-Breitband doppelt: Jeder Dollar, den es dir zahlt, wird verdoppelt (Insel-WLAN nicht).",
"late.match":"Heim-Breitband verdoppelt",
"late.over":"Dein Jahr als Nachzügler ist vorbei: Heim-Breitband zahlt wieder den normalen Satz.",
"late.this_month":"Aufschlag diesen Monat",
"late.title":"Vorsprung für Nachzügler",
"late.top_up":"Aufstockung des Startkapitals",
"late.until":"bis {date}",
"latency_contracts.credits_paid":"{price} an SLA-Gutschriften gezahlt",
"latency_contracts.over_sla":"<b>{name}</b>: {a} ⇄ {b} läuft mit {ms} ms, über den {max} ms aus dem Vertrag. Jeder Tag darüber kostet dich eine Tagesgebühr an SLA-Gutschriften ({price}).",
"latency_contracts.sla_terms":"Latenz-SLA {ms} ms: eine Tagesgebühr zurück für jeden Tag darüber · nie mehr als {max}",
@ -4778,16 +4789,34 @@
"satellites.cancel_n_circuits_first":{"one":"Kündige zuerst seine Satellitenverbindung.","other":"Kündige zuerst seine {n} Satellitenverbindungen."},
"satellites.choose":"Wählen",
"satellites.circuit_ordered":{"one":"<b>{cap} auf {bird} bestellt.</b> {a} ⇄ {b} wird ausgerichtet und getestet: läuft in {n} Tag.","other":"<b>{cap} auf {bird} bestellt.</b> {a} ⇄ {b} wird ausgerichtet und getestet: läuft in {n} Tagen."},
"satellites.close_the_leo_gateway":"LEO-Gateway schließen",
"satellites.close_the_teleport":"Teleport schließen",
"satellites.costs_row":"Teleports und Satelliten",
"satellites.geo_dishes":"GEO-Schüsseln",
"satellites.geo_dishes_and_meo_tracking":"GEO-Schüsseln und MEO-Nachführantennen",
"satellites.geo_users_notice":"Aus 36.000 km Höhe dauert die Runde etwa 600 ms: Videocalls und Games ruckeln, und die Nutzer werten {p} des Service als schlecht.",
"satellites.grow_to":"Auf {cap} vergrößern",
"satellites.host_leo_gateway_cost_mo":"LEO-Gateway <small>{cost} + {mo}/Monat</small>",
"satellites.in_view_list":"In Sicht: {list}.",
"satellites.it_waits_on_standby":"Zwischen den beiden hast du schon einen Link: Der Satellit wartet im Standby und trägt Traffic nur, wenn dieser Link ausfällt.",
"satellites.its_blurb":"Klassische C- und Ku-Band-Strahlen, die einen ganzen Ozean abdecken. Zuverlässig, überall, und so bepreist.",
"satellites.kac_blurb":"Ka-Band-Spotbeams über dem Westpazifik: das billigste Gbps im Orbit, wenn deine Insel unter einem Beam liegt.",
"satellites.leo_backhaul":"Glasfaser und Kabel aus {city} hinaus",
"satellites.leo_bottleneck":"{city} ist voll: Jede Insel hinter diesem Gateway wird mit ausgebremst. Stell hier mehr Router, eine größere Wave oder Transit hin.",
"satellites.leo_comes_at_level":"Kapazität im niedrigen Orbit (etwa 30 ms hin und zurück) kommt auf Level {lv}.",
"satellites.leo_gateway":"LEO-Gateway",
"satellites.leo_gateway_closed":"Das LEO-Gateway in {city} ist geschlossen.",
"satellites.leo_gateway_unwired":"Keine Glasfaser von dir verlässt {city} mehr: Die Inseln hinter diesem Gateway erreichen den Rest deines Netzes über einen weiteren Satelliten.",
"satellites.leo_gateway_up":"<b>{prov}-Gateway in {city} läuft.</b> Ihre Antennen auf deinem Dach: Miete von hier aus Kapazität im niedrigen Orbit zu Inseln im Umkreis von {km} km.",
"satellites.leo_landing":"Landet hier aus dem Orbit",
"satellites.leo_needs_fiber":"Ein LEO-Gateway muss an deiner Glasfaser hängen: {city} erreicht den Rest deines Netzes nur per Satellit. Lande dort zuerst ein Kabel oder eine Wave an, oder kauf Transit.",
"satellites.leo_no_rivals":"{prov} verkauft einer konkurrierenden Konstellation keine Kapazität, und deine fliegt schon: Stell stattdessen eine Pie-Schüssel auf die Insel.",
"satellites.leo_out_of_reach":"{prov} ist eine Bent Pipe: Ein Satellit muss dein Gateway und die Insel gleichzeitig sehen, also liegen sie höchstens {km} km auseinander. Von {a} nach {b} sind es {d} km.",
"satellites.leo_safe_mode_n_days":{"one":"Safe Mode wegen eines Sonnensturms: wieder da in {n} Tag.","other":"Safe Mode wegen eines Sonnensturms: wieder da in {n} Tagen."},
"satellites.leo_shell_misses_city":"{prov} erreicht {city} nicht: Seine Schalen decken {lat}° beiderseits des Äquators ab.",
"satellites.leo_storm_msg":"Ein geomagnetischer Sturm: {prov} schickt seine Satelliten in den Safe Mode. Deine LEO-Verbindungen tragen nichts, bis er vorbei ist; Verbindungen im Standby und Kabel übernehmen, was sie können.",
"satellites.leo_transit":"Transit aus {city} hinaus",
"satellites.leo_users_notice":"Bent Pipe aus 550 km Höhe, etwa 30 ms hin und zurück: Die Nutzer merken kaum etwas ({p} des Service gilt als schlecht), und selektive Netze peeren mit dir wie über ein Kabel. Sie landet an deinem Gateway in {city}: Wenn die Router oder die Glasfaser dieses POPs voll sind, wird jede Insel dahinter langsamer.",
"satellites.meo_comes_at_level":"Der MEO-Ring (etwa 130 ms hin und zurück) kommt auf Level {lv}.",
"satellites.meo_ring_misses_city":"Der MEO-Ring sieht {city} nicht: Er deckt {lat}° beiderseits des Äquators ab.",
"satellites.meo_users_notice":"Viel näher am Boden, etwa 130 ms hin und zurück: Die Nutzer merken kaum etwas ({p} des Service gilt als schlecht).",
@ -4796,7 +4825,9 @@
"satellites.ms_round_trip":"{ms} ms hin und zurück",
"satellites.n_birds_see_both":{"one":"{n} Satellit sieht beide","other":"{n} Satelliten sehen beide"},
"satellites.n_circuits_go_on_standby":{"one":"Deine Satellitenverbindung zwischen {a} und {b} geht neben dem neuen Link in Standby: Sie trägt Traffic nur, wenn dieser Link ausfällt.","other":"Deine {n} Satellitenverbindungen zwischen {a} und {b} gehen neben dem neuen Link in Standby: Sie tragen Traffic nur, wenn dieser Link ausfällt."},
"satellites.n_in_leo_reach":{"one":"{n} Insel oder abgelegener Ort im Umkreis von {km} km um dieses Gateway.","other":"{n} Inseln und abgelegene Orte im Umkreis von {km} km um dieses Gateway."},
"satellites.n_places_in_reach":{"one":"{n} Insel oder abgelegener Ort in Reichweite auf deinem Level.","other":"{n} Inseln und abgelegene Orte in Reichweite auf deinem Level."},
"satellites.needs_leo_gateway":"LEO-Kapazität braucht ein Gateway an deinem Teleport in {city}.",
"satellites.needs_tracking_antennas":"Der MEO-Ring braucht Nachführantennen an deinem Teleport in {city}.",
"satellites.new_pop_cost":"neuer POP {cost}",
"satellites.no_bird_sees_both":"Kein Satellit im Angebot sieht {a} und {b} zugleich.",
@ -4820,9 +4851,11 @@
"satellites.rent_satellite_capacity":"Satellitenkapazität mieten",
"satellites.satellite_capacity":"Satellitenkapazität",
"satellites.satellites":"Satelliten",
"satellites.sbk_blurb":"Tausende kleine Satelliten in 550 km Höhe, etwa 30 ms hin und zurück: der erste Satellit, über den sich deine Nutzer nicht beschweren. Alle paar Sekunden blinken sie von einem Satelliten zum nächsten; niemand merkt es.",
"satellites.sea_americas":"Amerika",
"satellites.sea_atlantic":"Atlantik",
"satellites.sea_indian":"Indischer Ozean",
"satellites.sea_leo":"bis 56° um den Äquator, 550 km hoch",
"satellites.sea_pacific":"Pazifik",
"satellites.sea_tropics":"bis 50° um den Äquator",
"satellites.sea_west_pacific":"Westpazifik",
@ -4835,6 +4868,7 @@
"satellites.tracking_antennas_up":"<b>Nachführantennen in {city} laufen.</b> Sie folgen dem MEO-Ring über den Himmel.",
"satellites.up_in_n_days":{"one":"läuft in {n} Tag","other":"läuft in {n} Tagen"},
"satellites.users_notice_geo_meo":"Die Nutzer merken die Verzögerung: Breitband über GEO zählt als halber Service, über MEO fast als ganzer. Ein Kabel gewinnt immer, deine Router schicken Traffic also nur nach oben, wenn es keinen anderen Weg gibt.",
"satellites.users_notice_leo":"Über LEO, etwa 30 ms hin und zurück, merken die Nutzer kaum etwas, und selektive Netze peeren wie über ein Kabel. Neben einem Kabel wartet die Verbindung im Standby.",
"satellites.users_ride_a_satellite":"Nutzer hängen am Satelliten",
"satellites.via_bird":"über {bird}",
"satellites.who_a_satellite_serves":"Satelliten bedienen kleine Inseln und abgelegene Orte, die derselbe Satellit sieht wie dein Teleport. Wähle das Ziel.",
@ -5239,6 +5273,60 @@
"utilities.title":"Werkzeuge",
"utilities.two_routers":"Mindestens zwei Router",
"utilities.view_pop":"POP ansehen",
"wisp.backhaul":"Backhaul",
"wisp.close":"Insel-WLAN schließen",
"wisp.closed":"Das Insel-WLAN auf {zone} ist geschlossen.",
"wisp.costs_row":"Insel-WLAN: Masten und Stichkabel",
"wisp.cut_anchor":"Ein Schiffsanker hat das Stichkabel nach {zone} vor {city} durchgerissen.",
"wisp.cut_dark":"Sonst erreicht nichts die Inseln: Sie sind offline, bis es geflickt ist.",
"wisp.cut_sat":"Der Satellitenlink trägt die Inseln so lange.",
"wisp.cut_slide":"Ein Unterwasser-Erdrutsch hat das Stichkabel nach {zone} zerrissen.",
"wisp.cut_trawler":"Ein Fischtrawler hat sich im Stichkabel nach {zone} verfangen.",
"wisp.cut_volcano":"Ein Unterwasservulkan ist direkt auf dem Stichkabel nach {zone} ausgebrochen.",
"wisp.decom":"Das Insel-WLAN schließt mit: {list}.",
"wisp.double_hop":"Doppelter Hop: {city} erreicht die Welt nur per Satellit, der Traffic der Inseln ginge also zweimal nach oben. Bring {city} zuerst ein Kabel.",
"wisp.full":"Der Link ist voll: Haushalte warten.",
"wisp.homes_online":"Haushalte online",
"wisp.inc_title":"Stichkabel gekappt",
"wisp.ipv6":"Seine Haushalte sind vom ersten Tag an IPv6-only (464XLAT): Ihr IPv4 teilt sich den NAT64-Pool, die Inseln brauchen also nie einen eigenen Block.",
"wisp.kit":"Mit der ersten Bestellung kommt auch das Insel-Kit: Masten, Solarpanels und Heimfunkgeräte, {cost}.",
"wisp.lay_spur":"Stichkabel verlegen {cost}",
"wisp.lead":"Zu den Haushalten dieser Inseln führt kein Kabel, also kannst du ihr Internet sein: zuerst Satellitenkapazität von einem Teleport hier, später ein Stichkabel. Inselbewohner zahlen Inselpreise: {rate} pro Gbps im Monat.",
"wisp.leo_no_rivals":"{prov} verkauft einer konkurrierenden Konstellation keine Kapazität, und deine fliegt schon: Diese Inseln können weiter GEO- oder MEO-Kapazität bekommen oder ein Stichkabel.",
"wisp.move_note":"Bestell auf einem anderen Satelliten, um die Inseln dorthin umzuziehen: Der alte Link trägt, bis der neue steht.",
"wisp.moved":"{zone} läuft jetzt über {bird}.",
"wisp.moving":{"one":"{cap} auf {bird} für {zone} bestellt: Die Inseln ziehen in {n} Tag um.","other":"{cap} auf {bird} für {zone} bestellt: Die Inseln ziehen in {n} Tagen um."},
"wisp.n_zones":{"one":"{n} Inselzone","other":"{n} Inselzonen"},
"wisp.no_pop":"Eröffne hier einen POP, um den Inseln ringsum WLAN zu bringen: {list}.",
"wisp.no_teleport":"Satellitenkapazität für die Inseln kommt an einem Teleport in {city} herunter. Bau dort zuerst einen.",
"wisp.online":"{zone} ist online: Die ersten Inselbewohner melden sich an.",
"wisp.online_in_n_days":{"one":"Die Inseln gehen in {n} Tag online: Dann melden sich die ersten Haushalte an.","other":"Die Inseln gehen in {n} Tagen online: Dann melden sich die ersten Haushalte an."},
"wisp.ordered":{"one":"{cap} auf {bird} für {zone} bestellt: Die Inselbewohner gehen in {n} Tag online.","other":"{cap} auf {bird} für {zone} bestellt: Die Inselbewohner gehen in {n} Tagen online."},
"wisp.pool":"{g} an Haushalten",
"wisp.rush":"Reparaturschiff chartern",
"wisp.section":"Insel-WLAN",
"wisp.served":"Versorgt auf den Inseln",
"wisp.spur":"Stichkabel",
"wisp.spur_cut":{"one":"Gekappt: Das Reparaturschiff ist {n} Tag entfernt.","other":"Gekappt: Das Reparaturschiff ist {n} Tage entfernt."},
"wisp.spur_laying":"Kabelschiff verlegt das Stichkabel",
"wisp.spur_lead":"{km} km Seekabel ab {city}. Das meiste haben Entwicklungsbanken bezahlt; das ist dein Anteil. Sobald es leuchtet, kann sich jeder auf den Inseln anmelden, und nichts ist gemietet.",
"wisp.spur_level":"Stichkabel gibt es ab Level {lv}.",
"wisp.spur_lit":"Stichkabel in Betrieb, {cap}",
"wisp.spur_none":"Zu weit oder zu viel Meereis für ein Stichkabel: Diese Inseln bleiben bei Satelliten.",
"wisp.spur_ordered":{"one":"Ein Kabelschiff läuft aus, um das Stichkabel nach {zone} zu verlegen: in Betrieb in {n} Tag.","other":"Ein Kabelschiff läuft aus, um das Stichkabel nach {zone} zu verlegen: in Betrieb in {n} Tagen."},
"wisp.spur_ready":"Das Stichkabel nach {zone} ist in Betrieb: Jetzt kann sich jeder auf den Inseln anmelden.",
"wisp.spur_trap":"Ein Kabel ist ein Single Point of Failure: Wird es gekappt, braucht das Reparaturschiff Wochen. Ein Satellitenlink im Standby trägt die Inseln so lange.",
"wisp.st_cut":"Gekappt",
"wisp.st_none":"Noch kein Link",
"wisp.st_soon":"Kommt bald",
"wisp.st_spur":"Kabel",
"wisp.take":"Die Inselbewohner melden sich an, so weit der Link es zulässt: etwa {geo} über GEO, {meo} über MEO, {leo} über LEO, alle über ein Kabel.",
"wisp.tele_reaches":"Insel-WLAN von diesem Teleport:",
"wisp.upkeep":"Masten, Solar und Crews",
"wisp.why_moving":"Ein Umzug auf einen anderen Satelliten läuft schon.",
"wisp.why_no_pop":"Eröffne zuerst einen POP in {city}: Die Crews und die Lizenz der Inseln arbeiten von dort.",
"wisp.why_same":"Die Inseln laufen schon über {bird}: Ändere lieber die Größe dieses Links.",
"wisp.why_spur_have":"Das Stichkabel liegt schon.",
"wkscn.copy_my_result":"Mein Ergebnis kopieren",
"wkscn.desc_a_g_event_comes_to":"An Tag {day} kommt ein Event mit {g} nach {city}. Bau das Netz dafür, aus dem Nichts.",
"wkscn.desc_a_ship_dragged_its_anchor":"Ein Schiff hat seinen Anker über {cab} geschleift. Finde einen anderen Weg von {a} nach {b}.",

View file

@ -2833,6 +2833,17 @@
"keys.show_this_list":"Mostrar esta lista",
"keys.space":"Espacio",
"keys.zoom_the_map_out_or":"Alejar o acercar el mapa",
"late.bank_note":"Por unirte tarde a esta sesión. Se iguala lo que te paga la banda ancha doméstica después de cualquier parte mayorista, no el Wi-Fi isleño, y los inversores no se llevan nada de ello.",
"late.bb_pitch":{"one":"Llegaste tarde: durante {n} día más, se iguala lo que te pagan los hogares de aquí.","other":"Llegaste tarde: durante {n} días más, se iguala lo que te pagan los hogares de aquí."},
"late.card":{"one":"La banda ancha doméstica paga el doble durante {n} día más: +{price}/mes ahora mismo.","other":"La banda ancha doméstica paga el doble durante {n} días más: +{price}/mes ahora mismo."},
"late.hello":"<b>Llegas tarde a la fiesta, pero bienvenido.</b> Esta sesión tiene {n} días y el hardware cuesta {p} más que en su primer día, así que el banco añade {cash} a tu capital inicial. Durante tu primer año, la banda ancha doméstica paga el doble: cada dólar que te paga se iguala (el Wi-Fi isleño no).",
"late.hello_flat":"<b>Llegas tarde a la fiesta, pero bienvenido.</b> Esta sesión tiene {n} días. Durante tu primer año, la banda ancha doméstica paga el doble: cada dólar que te paga se iguala (el Wi-Fi isleño no).",
"late.match":"Banda ancha doméstica igualada",
"late.over":"Tu año de recién llegado terminó: la banda ancha doméstica vuelve a pagar la tarifa normal.",
"late.this_month":"Igualado este mes",
"late.title":"Ventaja del recién llegado",
"late.top_up":"Refuerzo del capital inicial",
"late.until":"hasta el {date}",
"latency_contracts.credits_paid":"{price} pagados en créditos SLA",
"latency_contracts.over_sla":"<b>{name}</b>: {a} ⇄ {b} va a {ms} ms, por encima de los {max} ms del contrato. Cada día por encima te cuesta un día de cuota en créditos SLA ({price}).",
"latency_contracts.sla_terms":"SLA de latencia {ms} ms: un día de cuota devuelto por cada día por encima · nunca más de {max}",
@ -4776,16 +4787,34 @@
"satellites.cancel_n_circuits_first":{"one":"Primero cancela su circuito satelital.","other":"Primero cancela sus {n} circuitos satelitales."},
"satellites.choose":"Elegir",
"satellites.circuit_ordered":{"one":"<b>{cap} en {bird} pedidos.</b> {a} ⇄ {b} se está apuntando y probando: listo en {n} día.","other":"<b>{cap} en {bird} pedidos.</b> {a} ⇄ {b} se está apuntando y probando: listo en {n} días."},
"satellites.close_the_leo_gateway":"Cerrar el gateway LEO",
"satellites.close_the_teleport":"Cerrar el teleport",
"satellites.costs_row":"Teleports y satélites",
"satellites.geo_dishes":"Antenas GEO",
"satellites.geo_dishes_and_meo_tracking":"Antenas GEO y antenas de seguimiento MEO",
"satellites.geo_users_notice":"Desde 36.000 km de altura la ida y vuelta tarda unos 600 ms: las videollamadas y los juegos se traban, y los usuarios cuentan {p} del servicio como malo.",
"satellites.grow_to":"Ampliar a {cap}",
"satellites.host_leo_gateway_cost_mo":"Gateway LEO <small>{cost} + {mo}/mes</small>",
"satellites.in_view_list":"A la vista: {list}.",
"satellites.it_waits_on_standby":"Ya tienes un enlace entre estas dos: el satélite espera en reserva y solo lleva tráfico cuando ese enlace cae.",
"satellites.its_blurb":"Haces de banda C y Ku de toda la vida que cubren un océano entero. Fiables, en todas partes, y con precio a juego.",
"satellites.kac_blurb":"Haces puntuales en banda Ka sobre el Pacífico occidental: el Gbps más barato en órbita, si tu isla queda bajo un haz.",
"satellites.leo_backhaul":"Fibra y cables que salen de {city}",
"satellites.leo_bottleneck":"{city} está lleno: cada isla detrás de este gateway se frena con él. Pon aquí más routers, una wave más grande o tránsito.",
"satellites.leo_comes_at_level":"La capacidad en órbita baja (unos 30 ms de ida y vuelta) llega en el nivel {lv}.",
"satellites.leo_gateway":"Gateway LEO",
"satellites.leo_gateway_closed":"El gateway LEO de {city} está cerrado.",
"satellites.leo_gateway_unwired":"Ya no sale ninguna fibra tuya de {city}: las islas detrás de este gateway llegan al resto de tu red por otro satélite.",
"satellites.leo_gateway_up":"<b>Gateway de {prov} en marcha en {city}.</b> Sus antenas en tu tejado: alquila desde aquí capacidad en órbita baja hacia islas a menos de {km} km.",
"satellites.leo_landing":"Aterriza aquí desde la órbita",
"satellites.leo_needs_fiber":"Un gateway LEO tiene que estar sobre tu fibra: {city} solo llega al resto de tu red por satélite. Primero lleva allí un cable o una wave, o compra tránsito.",
"satellites.leo_no_rivals":"{prov} no vende capacidad a una constelación rival, y la tuya ya vuela: pon una antena-tarta en la isla.",
"satellites.leo_out_of_reach":"{prov} es un bent pipe: un satélite tiene que ver tu gateway y la isla a la vez, así que pueden estar como mucho a {km} km. De {a} a {b} hay {d} km.",
"satellites.leo_safe_mode_n_days":{"one":"Modo seguro por una tormenta solar: vuelve en {n} día.","other":"Modo seguro por una tormenta solar: vuelve en {n} días."},
"satellites.leo_shell_misses_city":"{prov} no llega a {city}: sus capas cubren {lat}° a cada lado del ecuador.",
"satellites.leo_storm_msg":"Una tormenta geomagnética: {prov} pone sus satélites en modo seguro. Tus circuitos LEO no llevan nada hasta que pase; los circuitos en reserva y los cables llevan lo que pueden.",
"satellites.leo_transit":"Tránsito que sale de {city}",
"satellites.leo_users_notice":"Bent pipe desde 550 km de altura, unos 30 ms de ida y vuelta: los usuarios apenas lo notan ({p} del servicio cuenta como malo), y las redes selectivas hacen peering contigo como por un cable. Aterriza en tu gateway de {city}: cuando los routers o la fibra de ese POP se llenan, cada isla detrás se frena.",
"satellites.meo_comes_at_level":"El anillo MEO (unos 130 ms de ida y vuelta) llega en el nivel {lv}.",
"satellites.meo_ring_misses_city":"El anillo MEO no ve {city}: cubre {lat}° a cada lado del ecuador.",
"satellites.meo_users_notice":"Mucho más cerca del suelo, unos 130 ms de ida y vuelta: los usuarios apenas lo notan ({p} del servicio cuenta como malo).",
@ -4794,7 +4823,9 @@
"satellites.ms_round_trip":"{ms} ms de ida y vuelta",
"satellites.n_birds_see_both":{"one":"{n} satélite ve los dos","other":"{n} satélites ven los dos"},
"satellites.n_circuits_go_on_standby":{"one":"Tu circuito satelital entre {a} y {b} pasa a reserva junto al nuevo enlace: solo lleva tráfico cuando ese enlace cae.","other":"Tus {n} circuitos satelitales entre {a} y {b} pasan a reserva junto al nuevo enlace: solo llevan tráfico cuando ese enlace cae."},
"satellites.n_in_leo_reach":{"one":"{n} isla o pueblo remoto a menos de {km} km de este gateway.","other":"{n} islas y pueblos remotos a menos de {km} km de este gateway."},
"satellites.n_places_in_reach":{"one":"{n} isla o pueblo remoto a tu alcance en tu nivel.","other":"{n} islas y pueblos remotos a tu alcance en tu nivel."},
"satellites.needs_leo_gateway":"La capacidad LEO necesita un gateway en tu teleport de {city}.",
"satellites.needs_tracking_antennas":"El anillo MEO necesita antenas de seguimiento en tu teleport de {city}.",
"satellites.new_pop_cost":"POP nuevo {cost}",
"satellites.no_bird_sees_both":"Ningún satélite a la venta ve a la vez {a} y {b}.",
@ -4818,9 +4849,11 @@
"satellites.rent_satellite_capacity":"Alquilar capacidad satelital",
"satellites.satellite_capacity":"Capacidad satelital",
"satellites.satellites":"Satélites",
"satellites.sbk_blurb":"Miles de satélites pequeños a 550 km de altura, unos 30 ms de ida y vuelta: el primer satélite del que tus usuarios no se quejarán. Saltan de un satélite al siguiente cada pocos segundos; nadie lo nota.",
"satellites.sea_americas":"Américas",
"satellites.sea_atlantic":"Atlántico",
"satellites.sea_indian":"Océano Índico",
"satellites.sea_leo":"hasta 56° del ecuador, a 550 km de altura",
"satellites.sea_pacific":"Pacífico",
"satellites.sea_tropics":"hasta 50° del ecuador",
"satellites.sea_west_pacific":"Pacífico occidental",
@ -4833,6 +4866,7 @@
"satellites.tracking_antennas_up":"<b>Antenas de seguimiento en marcha en {city}.</b> Siguen el anillo MEO por el cielo.",
"satellites.up_in_n_days":{"one":"listo en {n} día","other":"listo en {n} días"},
"satellites.users_notice_geo_meo":"Los usuarios notan el retardo: la banda ancha por GEO cuenta como medio servicio, por MEO casi como el servicio entero. Un cable siempre gana, así que tus routers solo mandan tráfico arriba cuando no hay otro camino.",
"satellites.users_notice_leo":"Por LEO, unos 30 ms de ida y vuelta, los usuarios apenas lo notan, y las redes selectivas hacen peering como por un cable. Junto a un cable espera en reserva.",
"satellites.users_ride_a_satellite":"usuarios vía satélite",
"satellites.via_bird":"vía {bird}",
"satellites.who_a_satellite_serves":"Los satélites sirven a islas pequeñas y pueblos remotos que ve el mismo satélite que tu teleport. Elige el destino.",
@ -5237,6 +5271,60 @@
"utilities.title":"Utilidades",
"utilities.two_routers":"Al menos dos routers",
"utilities.view_pop":"Ver POP",
"wisp.backhaul":"Backhaul",
"wisp.close":"Cerrar el Wi-Fi isleño",
"wisp.closed":"El Wi-Fi isleño de {zone} está cerrado.",
"wisp.costs_row":"Wi-Fi isleño: torres y ramales",
"wisp.cut_anchor":"El ancla de un barco arrastró el ramal de {zone} frente a {city}.",
"wisp.cut_dark":"Nada más llega a las islas: están sin conexión hasta que lo reparen.",
"wisp.cut_sat":"Mientras tanto, el circuito por satélite lleva a las islas.",
"wisp.cut_slide":"Un deslizamiento submarino partió el ramal de {zone}.",
"wisp.cut_trawler":"Un arrastrero enganchó el ramal de {zone}.",
"wisp.cut_volcano":"Un volcán submarino entró en erupción justo encima del ramal de {zone}.",
"wisp.decom":"El Wi-Fi isleño cierra con él: {list}.",
"wisp.double_hop":"Doble salto: {city} solo llega al mundo por satélite, así que el tráfico de las islas subiría dos veces. Primero lleva un cable a {city}.",
"wisp.full":"El enlace está lleno: hay hogares esperando.",
"wisp.homes_online":"Hogares conectados",
"wisp.inc_title":"Ramal cortado",
"wisp.ipv6":"Sus hogares son solo IPv6 (464XLAT) desde el primer día: su IPv4 comparte el pool NAT64, así que las islas nunca necesitan un bloque propio.",
"wisp.kit":"El primer pedido trae también el kit isleño: torres, paneles solares y radios para los hogares, {cost}.",
"wisp.lay_spur":"Tender el ramal {cost}",
"wisp.lead":"Ningún cable llega a los hogares de estas islas, así que puedes ser su internet: primero capacidad por satélite desde un teleport aquí, más tarde un cable ramal. Los isleños pagan precios de isla: {rate} por Gbps al mes.",
"wisp.leo_no_rivals":"{prov} no vende capacidad a una constelación rival, y la tuya ya vuela: estas islas aún pueden tener capacidad GEO o MEO, o un cable ramal.",
"wisp.move_note":"Pide en otro satélite para mudar allí las islas: el circuito viejo las lleva hasta que el nuevo esté listo.",
"wisp.moved":"{zone} ahora va por {bird}.",
"wisp.moving":{"one":"{cap} en {bird} pedido para {zone}: las islas se mudan en {n} día.","other":"{cap} en {bird} pedido para {zone}: las islas se mudan en {n} días."},
"wisp.n_zones":{"one":"{n} zona isleña","other":"{n} zonas isleñas"},
"wisp.no_pop":"Abre un POP aquí para llevar Wi-Fi a las islas de alrededor: {list}.",
"wisp.no_teleport":"La capacidad por satélite para las islas baja en un teleport en {city}. Primero construye uno allí.",
"wisp.online":"{zone} está en línea: los primeros isleños se están dando de alta.",
"wisp.online_in_n_days":{"one":"Las islas se conectan en {n} día: entonces se dan de alta los primeros hogares.","other":"Las islas se conectan en {n} días: entonces se dan de alta los primeros hogares."},
"wisp.ordered":{"one":"{cap} en {bird} pedido para {zone}: los isleños se conectan en {n} día.","other":"{cap} en {bird} pedido para {zone}: los isleños se conectan en {n} días."},
"wisp.pool":"{g} de hogares",
"wisp.rush":"Fletar un barco de reparación",
"wisp.section":"Wi-Fi isleño",
"wisp.served":"Servido en las islas",
"wisp.spur":"Cable ramal",
"wisp.spur_cut":{"one":"Cortado: el barco de reparación está a {n} día.","other":"Cortado: el barco de reparación está a {n} días."},
"wisp.spur_laying":"Un barco cablero tiende el ramal",
"wisp.spur_lead":"{km} km de cable submarino desde {city}. Los bancos de desarrollo pagaron la mayor parte; esta es tu parte. Cuando esté encendido, todos en las islas pueden darse de alta y no se alquila nada.",
"wisp.spur_level":"Los ramales llegan en el nivel {lv}.",
"wisp.spur_lit":"Ramal encendido, {cap}",
"wisp.spur_none":"Demasiado lejos, o demasiado hielo marino, para un ramal: estas islas siguen con satélites.",
"wisp.spur_ordered":{"one":"Un barco cablero zarpa a tender el ramal de {zone}: encendido en {n} día.","other":"Un barco cablero zarpa a tender el ramal de {zone}: encendido en {n} días."},
"wisp.spur_ready":"El ramal de {zone} está encendido: ya pueden darse de alta todos en las islas.",
"wisp.spur_trap":"Un solo cable es un único punto de fallo: cuando lo cortan, el barco de reparación tarda semanas. Un circuito por satélite en reserva lleva a las islas mientras tanto.",
"wisp.st_cut":"Ramal cortado",
"wisp.st_none":"Sin enlace aún",
"wisp.st_soon":"En camino",
"wisp.st_spur":"Ramal",
"wisp.take":"Los isleños se dan de alta hasta donde el enlace les deja: cerca del {geo} por GEO, del {meo} por MEO, del {leo} por LEO, y todos por cable.",
"wisp.tele_reaches":"Wi-Fi isleño desde este teleport:",
"wisp.upkeep":"Torres, solar y cuadrillas",
"wisp.why_moving":"Ya hay una mudanza a otro satélite en marcha.",
"wisp.why_no_pop":"Primero abre un POP en {city}: las cuadrillas y la licencia de las islas trabajan desde allí.",
"wisp.why_same":"Las islas ya van por {bird}: mejor cambia el tamaño de ese circuito.",
"wisp.why_spur_have":"El ramal ya está tendido.",
"wkscn.copy_my_result":"Copiar mi resultado",
"wkscn.desc_a_g_event_comes_to":"El día {day} llega a {city} un evento de {g}. Construye la red que necesita, desde cero.",
"wkscn.desc_a_ship_dragged_its_anchor":"Un barco arrastró el ancla sobre {cab}. Busca otro camino de {a} a {b}.",

View file

@ -2833,6 +2833,17 @@
"keys.show_this_list":"Afficher cette liste",
"keys.space":"Espace",
"keys.zoom_the_map_out_or":"Dézoomer ou zoomer la carte",
"late.bank_note":"Pour avoir rejoint cette session en retard. Ce que te paie le haut débit résidentiel après toute part de gros est doublé, pas le Wi-Fi des îles, et les investisseurs n’en prennent aucune part.",
"late.bb_pitch":{"one":"Tu es arrivé tard : pendant encore {n} jour, ce que les foyers d’ici te paient est doublé.","other":"Tu es arrivé tard : pendant encore {n} jours, ce que les foyers d’ici te paient est doublé."},
"late.card":{"one":"Le haut débit résidentiel paie double encore {n} jour : +{price}/mois en ce moment.","other":"Le haut débit résidentiel paie double encore {n} jours : +{price}/mois en ce moment."},
"late.hello":"<b>En retard à la fête, mais bienvenue.</b> Cette session a {n} jours et le matériel coûte {p} de plus qu’à son premier jour, alors la banque ajoute {cash} à ta mise de départ. Pendant ta première année, le haut débit résidentiel paie double : chaque dollar qu’il te paie est doublé (pas le Wi-Fi des îles).",
"late.hello_flat":"<b>En retard à la fête, mais bienvenue.</b> Cette session a {n} jours. Pendant ta première année, le haut débit résidentiel paie double : chaque dollar qu’il te paie est doublé (pas le Wi-Fi des îles).",
"late.match":"Haut débit résidentiel doublé",
"late.over":"Ton année de retardataire est terminée : le haut débit résidentiel paie de nouveau le tarif normal.",
"late.this_month":"Bonus ce mois-ci",
"late.title":"Coup de pouce du retardataire",
"late.top_up":"Complément de mise de départ",
"late.until":"jusqu’au {date}",
"latency_contracts.credits_paid":"{price} versés en crédits SLA",
"latency_contracts.over_sla":"<b>{name}</b> : {a} ⇄ {b} tourne à {ms} ms, au-delà des {max} ms du contrat. Chaque jour au-dessus te coûte une journée de facture en crédits SLA ({price}).",
"latency_contracts.sla_terms":"SLA de latence {ms} ms : une journée de facture remboursée par jour au-dessus · jamais plus de {max}",
@ -4776,16 +4787,34 @@
"satellites.cancel_n_circuits_first":{"one":"Résilie d’abord son circuit satellite.","other":"Résilie d’abord ses {n} circuits satellite."},
"satellites.choose":"Choisir",
"satellites.circuit_ordered":{"one":"<b>{cap} sur {bird} commandé.</b> {a} ⇄ {b} est en cours de pointage et de test : en service dans {n} jour.","other":"<b>{cap} sur {bird} commandé.</b> {a} ⇄ {b} est en cours de pointage et de test : en service dans {n} jours."},
"satellites.close_the_leo_gateway":"Fermer la passerelle LEO",
"satellites.close_the_teleport":"Fermer le téléport",
"satellites.costs_row":"Téléports et satellites",
"satellites.geo_dishes":"Paraboles GEO",
"satellites.geo_dishes_and_meo_tracking":"Paraboles GEO et antennes de poursuite MEO",
"satellites.geo_users_notice":"Depuis 36 000 km d’altitude, l’aller-retour prend environ 600 ms : visios et jeux saccadent, et les utilisateurs comptent {p} du service comme mauvais.",
"satellites.grow_to":"Passer à {cap}",
"satellites.host_leo_gateway_cost_mo":"Passerelle LEO <small>{cost} + {mo}/mois</small>",
"satellites.in_view_list":"En vue : {list}.",
"satellites.it_waits_on_standby":"Tu as déjà un lien entre ces deux villes : le satellite attend en réserve et ne porte du trafic que quand ce lien tombe.",
"satellites.its_blurb":"De bons vieux faisceaux en bande C et Ku qui couvrent tout un océan. Fiables, partout, et facturés en conséquence.",
"satellites.kac_blurb":"Des spots en bande Ka sur le Pacifique occidental : le Gbps le moins cher en orbite, si ton île est sous un spot.",
"satellites.leo_backhaul":"Fibre et câbles qui sortent de {city}",
"satellites.leo_bottleneck":"{city} est plein : chaque île derrière cette passerelle ralentit avec. Ajoute ici des routeurs, une wave plus grosse ou du transit.",
"satellites.leo_comes_at_level":"La capacité en orbite basse (environ 30 ms aller-retour) arrive au niveau {lv}.",
"satellites.leo_gateway":"Passerelle LEO",
"satellites.leo_gateway_closed":"La passerelle LEO de {city} est fermée.",
"satellites.leo_gateway_unwired":"Plus aucune fibre à toi ne sort de {city} : les îles derrière cette passerelle rejoignent le reste de ton réseau par un autre satellite.",
"satellites.leo_gateway_up":"<b>Passerelle {prov} en service à {city}.</b> Leurs antennes sur ton toit : loue d’ici de la capacité en orbite basse vers les îles à moins de {km} km.",
"satellites.leo_landing":"Arrive ici depuis l’orbite",
"satellites.leo_needs_fiber":"Une passerelle LEO doit être sur ta fibre : {city} ne rejoint le reste de ton réseau que par satellite. Amène-y d’abord un câble ou une wave, ou achète du transit.",
"satellites.leo_no_rivals":"{prov} ne vend pas de capacité à une constellation rivale, et la tienne vole déjà : mets plutôt une antenne-tarte sur l’île.",
"satellites.leo_out_of_reach":"{prov} est un bent pipe : un satellite doit voir ta passerelle et l’île en même temps, donc elles sont à {km} km au plus l’une de l’autre. De {a} à {b}, il y a {d} km.",
"satellites.leo_safe_mode_n_days":{"one":"Mode sans échec pendant une tempête solaire : de retour dans {n} jour.","other":"Mode sans échec pendant une tempête solaire : de retour dans {n} jours."},
"satellites.leo_shell_misses_city":"{prov} n’atteint pas {city} : ses couches couvrent {lat}° de part et d’autre de l’équateur.",
"satellites.leo_storm_msg":"Une tempête géomagnétique : {prov} met ses satellites en mode sans échec. Tes circuits LEO ne portent rien jusqu’à ce qu’elle passe ; les circuits en réserve et les câbles prennent ce qu’ils peuvent.",
"satellites.leo_transit":"Transit qui sort de {city}",
"satellites.leo_users_notice":"Bent pipe depuis 550 km d’altitude, environ 30 ms aller-retour : les utilisateurs le remarquent à peine ({p} du service compte comme mauvais), et les réseaux sélectifs font du peering avec toi comme par un câble. Il arrive à ta passerelle de {city} : quand les routeurs ou la fibre de ce POP sont pleins, chaque île derrière ralentit.",
"satellites.meo_comes_at_level":"L’anneau MEO (environ 130 ms aller-retour) arrive au niveau {lv}.",
"satellites.meo_ring_misses_city":"L’anneau MEO ne voit pas {city} : il couvre {lat}° de part et d’autre de l’équateur.",
"satellites.meo_users_notice":"Bien plus près du sol, environ 130 ms aller-retour : les utilisateurs le remarquent à peine ({p} du service compte comme mauvais).",
@ -4794,7 +4823,9 @@
"satellites.ms_round_trip":"{ms} ms aller-retour",
"satellites.n_birds_see_both":{"one":"{n} satellite voit les deux","other":"{n} satellites voient les deux"},
"satellites.n_circuits_go_on_standby":{"one":"Ton circuit satellite entre {a} et {b} passe en réserve à côté du nouveau lien : il ne porte du trafic que quand ce lien tombe.","other":"Tes {n} circuits satellite entre {a} et {b} passent en réserve à côté du nouveau lien : ils ne portent du trafic que quand ce lien tombe."},
"satellites.n_in_leo_reach":{"one":"{n} île ou ville isolée à moins de {km} km de cette passerelle.","other":"{n} îles et villes isolées à moins de {km} km de cette passerelle."},
"satellites.n_places_in_reach":{"one":"{n} île ou ville isolée à portée à ton niveau.","other":"{n} îles et villes isolées à portée à ton niveau."},
"satellites.needs_leo_gateway":"La capacité LEO a besoin d’une passerelle à ton téléport de {city}.",
"satellites.needs_tracking_antennas":"L’anneau MEO a besoin d’antennes de poursuite à ton téléport de {city}.",
"satellites.new_pop_cost":"nouveau POP {cost}",
"satellites.no_bird_sees_both":"Aucun satellite en vente ne voit à la fois {a} et {b}.",
@ -4818,9 +4849,11 @@
"satellites.rent_satellite_capacity":"Louer de la capacité satellite",
"satellites.satellite_capacity":"Capacité satellite",
"satellites.satellites":"Satellites",
"satellites.sbk_blurb":"Des milliers de petits satellites à 550 km d’altitude, environ 30 ms aller-retour : le premier satellite dont tes utilisateurs ne se plaindront pas. Ils clignent d’un satellite au suivant toutes les quelques secondes ; personne ne le remarque.",
"satellites.sea_americas":"Amériques",
"satellites.sea_atlantic":"Atlantique",
"satellites.sea_indian":"Océan Indien",
"satellites.sea_leo":"jusqu’à 56° de l’équateur, à 550 km d’altitude",
"satellites.sea_pacific":"Pacifique",
"satellites.sea_tropics":"jusqu’à 50° de l’équateur",
"satellites.sea_west_pacific":"Pacifique occidental",
@ -4833,6 +4866,7 @@
"satellites.tracking_antennas_up":"<b>Antennes de poursuite en service à {city}.</b> Elles suivent l’anneau MEO dans le ciel.",
"satellites.up_in_n_days":{"one":"en service dans {n} jour","other":"en service dans {n} jours"},
"satellites.users_notice_geo_meo":"Les utilisateurs sentent le délai : le haut débit par GEO compte pour la moitié du service, par MEO presque pour tout. Un câble gagne toujours, donc tes routeurs n’envoient du trafic là-haut que s’il n’y a pas d’autre chemin.",
"satellites.users_notice_leo":"Par LEO, environ 30 ms aller-retour, les utilisateurs le remarquent à peine, et les réseaux sélectifs font du peering comme par un câble. À côté d’un câble, il attend en réserve.",
"satellites.users_ride_a_satellite":"utilisateurs sur satellite",
"satellites.via_bird":"via {bird}",
"satellites.who_a_satellite_serves":"Les satellites desservent les petites îles et les villes isolées que voit le même satellite que ton téléport. Choisis la destination.",
@ -5237,6 +5271,60 @@
"utilities.title":"Utilitaires",
"utilities.two_routers":"Au moins deux routeurs",
"utilities.view_pop":"Voir le POP",
"wisp.backhaul":"Backhaul",
"wisp.close":"Fermer le Wi-Fi des îles",
"wisp.closed":"Le Wi-Fi des îles à {zone} est fermé.",
"wisp.costs_row":"Wi-Fi des îles : pylônes et câbles de dérivation",
"wisp.cut_anchor":"L’ancre d’un navire a raclé le câble de {zone} au large de {city}.",
"wisp.cut_dark":"Rien d’autre n’atteint les îles : elles restent hors ligne jusqu’à la réparation.",
"wisp.cut_sat":"Le circuit satellite porte les îles en attendant.",
"wisp.cut_slide":"Un glissement de terrain sous-marin a rompu le câble de {zone}.",
"wisp.cut_trawler":"Un chalutier a accroché le câble de {zone}.",
"wisp.cut_volcano":"Un volcan sous-marin est entré en éruption juste sur le câble de {zone}.",
"wisp.decom":"Le Wi-Fi des îles ferme avec : {list}.",
"wisp.double_hop":"Double saut : {city} ne rejoint le monde que par satellite, le trafic des îles monterait donc deux fois. Amène d’abord un câble à {city}.",
"wisp.full":"Le lien est plein : des foyers attendent.",
"wisp.homes_online":"Foyers en ligne",
"wisp.inc_title":"Câble coupé",
"wisp.ipv6":"Ses foyers sont en IPv6 seul (464XLAT) dès le premier jour : leur IPv4 partage le pool NAT64, les îles n’ont donc jamais besoin d’un bloc à elles.",
"wisp.kit":"La première commande apporte aussi le kit des îles : pylônes, panneaux solaires et radios pour les foyers, {cost}.",
"wisp.lay_spur":"Poser le câble {cost}",
"wisp.lead":"Aucun câble n’arrive aux foyers de ces îles, alors tu peux être leur internet : d’abord de la capacité satellite depuis un téléport ici, plus tard un câble de dérivation. Les insulaires paient des prix d’île : {rate} le Gbps par mois.",
"wisp.leo_no_rivals":"{prov} ne vend pas de capacité à une constellation rivale, et la tienne vole déjà : ces îles peuvent encore avoir de la capacité GEO ou MEO, ou un câble de dérivation.",
"wisp.move_note":"Commande sur un autre satellite pour y déménager les îles : l’ancien circuit les porte jusqu’à ce que le nouveau soit prêt.",
"wisp.moved":"{zone} passe maintenant par {bird}.",
"wisp.moving":{"one":"{cap} sur {bird} commandé pour {zone} : les îles déménagent dans {n} jour.","other":"{cap} sur {bird} commandé pour {zone} : les îles déménagent dans {n} jours."},
"wisp.n_zones":{"one":"{n} zone d’îles","other":"{n} zones d’îles"},
"wisp.no_pop":"Ouvre un POP ici pour apporter le Wi-Fi aux îles alentour : {list}.",
"wisp.no_teleport":"La capacité satellite des îles descend à un téléport à {city}. Construis-en d’abord un là-bas.",
"wisp.online":"{zone} est en ligne : les premiers insulaires s’abonnent.",
"wisp.online_in_n_days":{"one":"Les îles seront en ligne dans {n} jour : les premiers foyers s’abonneront alors.","other":"Les îles seront en ligne dans {n} jours : les premiers foyers s’abonneront alors."},
"wisp.ordered":{"one":"{cap} sur {bird} commandé pour {zone} : les insulaires se connectent dans {n} jour.","other":"{cap} sur {bird} commandé pour {zone} : les insulaires se connectent dans {n} jours."},
"wisp.pool":"{g} de foyers",
"wisp.rush":"Affréter un navire de réparation",
"wisp.section":"Wi-Fi des îles",
"wisp.served":"Servi sur les îles",
"wisp.spur":"Câble de dérivation",
"wisp.spur_cut":{"one":"Coupé : le navire de réparation est à {n} jour.","other":"Coupé : le navire de réparation est à {n} jours."},
"wisp.spur_laying":"Un câblier pose le câble",
"wisp.spur_lead":"{km} km de câble sous-marin depuis {city}. Les banques de développement en ont payé l’essentiel ; voici ta part. Une fois allumé, tout le monde sur les îles peut s’abonner, et rien n’est loué.",
"wisp.spur_level":"Les câbles de dérivation arrivent au niveau {lv}.",
"wisp.spur_lit":"Câble allumé, {cap}",
"wisp.spur_none":"Trop loin, ou trop de banquise, pour un câble : ces îles restent sur satellites.",
"wisp.spur_ordered":{"one":"Un câblier part poser le câble de {zone} : allumé dans {n} jour.","other":"Un câblier part poser le câble de {zone} : allumé dans {n} jours."},
"wisp.spur_ready":"Le câble de {zone} est allumé : tout le monde sur les îles peut s’abonner maintenant.",
"wisp.spur_trap":"Un seul câble, c’est un point de défaillance unique : quand il est coupé, le navire de réparation met des semaines. Un circuit satellite gardé en réserve porte les îles en attendant.",
"wisp.st_cut":"Câble coupé",
"wisp.st_none":"Pas encore de lien",
"wisp.st_soon":"Bientôt",
"wisp.st_spur":"Câble",
"wisp.take":"Les insulaires s’abonnent autant que le lien le permet : environ {geo} par GEO, {meo} par MEO, {leo} par LEO, et tous par câble.",
"wisp.tele_reaches":"Wi-Fi des îles depuis ce téléport :",
"wisp.upkeep":"Pylônes, solaire et équipes",
"wisp.why_moving":"Un déménagement vers un autre satellite est en cours.",
"wisp.why_no_pop":"Ouvre d’abord un POP à {city} : les équipes et la licence des îles travaillent depuis là.",
"wisp.why_same":"Les îles passent déjà par {bird} : change plutôt la taille de ce circuit.",
"wisp.why_spur_have":"Le câble est déjà posé.",
"wkscn.copy_my_result":"Copier mon résultat",
"wkscn.desc_a_g_event_comes_to":"Le jour {day}, un événement de {g} arrive à {city}. Construis le réseau qu'il lui faut, à partir de rien.",
"wkscn.desc_a_ship_dragged_its_anchor":"Un navire a traîné son ancre sur {cab}. Trouve un autre chemin de {a} à {b}.",

View file

@ -2833,6 +2833,17 @@
"keys.show_this_list":"Mostra questo elenco",
"keys.space":"Spazio",
"keys.zoom_the_map_out_or":"Zoom indietro o avanti sulla mappa",
"late.bank_note":"Perché sei entrato tardi in questa sessione. Viene raddoppiato quello che ti paga la banda larga domestica dopo l’eventuale quota all’ingrosso, non il Wi-Fi delle isole, e gli investitori non ne prendono una parte.",
"late.bb_pitch":{"one":"Sei arrivato tardi: per {n} altro giorno, quello che ti pagano le case qui viene raddoppiato.","other":"Sei arrivato tardi: per altri {n} giorni, quello che ti pagano le case qui viene raddoppiato."},
"late.card":{"one":"La banda larga domestica paga il doppio per {n} altro giorno: +{price}/mese adesso.","other":"La banda larga domestica paga il doppio per altri {n} giorni: +{price}/mese adesso."},
"late.hello":"<b>In ritardo alla festa, ma benvenuto.</b> Questa sessione ha {n} giorni e l’hardware costa il {p} in più che al suo primo giorno, quindi la banca aggiunge {cash} al tuo capitale iniziale. Per il tuo primo anno, la banda larga domestica paga il doppio: ogni dollaro che ti paga viene raddoppiato (il Wi-Fi delle isole no).",
"late.hello_flat":"<b>In ritardo alla festa, ma benvenuto.</b> Questa sessione ha {n} giorni. Per il tuo primo anno, la banda larga domestica paga il doppio: ogni dollaro che ti paga viene raddoppiato (il Wi-Fi delle isole no).",
"late.match":"Banda larga domestica raddoppiata",
"late.over":"Il tuo anno da ritardatario è finito: la banda larga domestica torna a pagare la tariffa normale.",
"late.this_month":"Raddoppio di questo mese",
"late.title":"Vantaggio del ritardatario",
"late.top_up":"Integrazione del capitale iniziale",
"late.until":"fino al {date}",
"latency_contracts.credits_paid":"{price} pagati in crediti SLA",
"latency_contracts.over_sla":"<b>{name}</b>: {a} ⇄ {b} viaggia a {ms} ms, oltre i {max} ms del contratto. Ogni giorno sopra ti costa un giorno di canone in crediti SLA ({price}).",
"latency_contracts.sla_terms":"SLA di latenza {ms} ms: un giorno di canone restituito per ogni giorno sopra · mai più di {max}",
@ -4776,16 +4787,34 @@
"satellites.cancel_n_circuits_first":{"one":"Prima disdici il suo circuito satellitare.","other":"Prima disdici i suoi {n} circuiti satellitari."},
"satellites.choose":"Scegli",
"satellites.circuit_ordered":{"one":"<b>{cap} su {bird} ordinati.</b> {a} ⇄ {b} si sta puntando e testando: attivo tra {n} giorno.","other":"<b>{cap} su {bird} ordinati.</b> {a} ⇄ {b} si sta puntando e testando: attivo tra {n} giorni."},
"satellites.close_the_leo_gateway":"Chiudi il gateway LEO",
"satellites.close_the_teleport":"Chiudi il teleport",
"satellites.costs_row":"Teleport e satelliti",
"satellites.geo_dishes":"Parabole GEO",
"satellites.geo_dishes_and_meo_tracking":"Parabole GEO e antenne a inseguimento MEO",
"satellites.geo_users_notice":"Da 36.000 km di quota il giro dura circa 600 ms: videochiamate e giochi scattano, e gli utenti contano {p} del servizio come pessimo.",
"satellites.grow_to":"Porta a {cap}",
"satellites.host_leo_gateway_cost_mo":"Gateway LEO <small>{cost} + {mo}/mese</small>",
"satellites.in_view_list":"In vista: {list}.",
"satellites.it_waits_on_standby":"Tra queste due hai già un link: il satellite aspetta in standby e porta traffico solo quando quel link cade.",
"satellites.its_blurb":"I classici fasci in banda C e Ku che coprono un oceano intero. Affidabili, ovunque, e con il prezzo che ne consegue.",
"satellites.kac_blurb":"Spot beam in banda Ka sul Pacifico occidentale: il Gbps più economico in orbita, se la tua isola sta sotto un fascio.",
"satellites.leo_backhaul":"Fibra e cavi in uscita da {city}",
"satellites.leo_bottleneck":"{city} è pieno: ogni isola dietro questo gateway rallenta con lui. Aggiungi qui router, una wave più grande o transit.",
"satellites.leo_comes_at_level":"La capacità in orbita bassa (circa 30 ms andata e ritorno) arriva al livello {lv}.",
"satellites.leo_gateway":"Gateway LEO",
"satellites.leo_gateway_closed":"Il gateway LEO di {city} è chiuso.",
"satellites.leo_gateway_unwired":"Nessuna tua fibra esce più da {city}: le isole dietro questo gateway raggiungono il resto della tua rete con un altro satellite.",
"satellites.leo_gateway_up":"<b>Gateway {prov} attivo a {city}.</b> Le loro antenne sul tuo tetto: noleggia da qui capacità in orbita bassa verso le isole entro {km} km.",
"satellites.leo_landing":"Atterra qui dall’orbita",
"satellites.leo_needs_fiber":"Un gateway LEO deve stare sulla tua fibra: {city} raggiunge il resto della tua rete solo via satellite. Prima porta lì un cavo o una wave, o compra transit.",
"satellites.leo_no_rivals":"{prov} non vende capacità a una costellazione rivale, e la tua vola già: metti piuttosto una parabola-torta sull’isola.",
"satellites.leo_out_of_reach":"{prov} è un bent pipe: un satellite deve vedere il tuo gateway e l’isola insieme, quindi possono distare al massimo {km} km. Da {a} a {b} ci sono {d} km.",
"satellites.leo_safe_mode_n_days":{"one":"Modalità sicura per una tempesta solare: torna tra {n} giorno.","other":"Modalità sicura per una tempesta solare: torna tra {n} giorni."},
"satellites.leo_shell_misses_city":"{prov} non arriva a {city}: i suoi gusci coprono {lat}° a nord e a sud dell’equatore.",
"satellites.leo_storm_msg":"Una tempesta geomagnetica: {prov} mette i suoi satelliti in modalità sicura. I tuoi circuiti LEO non portano niente finché non passa; i circuiti in standby e i cavi prendono quello che possono.",
"satellites.leo_transit":"Transit in uscita da {city}",
"satellites.leo_users_notice":"Bent pipe da 550 km di quota, circa 30 ms andata e ritorno: gli utenti se ne accorgono appena ({p} del servizio conta come pessimo), e le reti selettive fanno peering con te come su un cavo. Atterra al tuo gateway di {city}: quando i router o la fibra di quel POP si riempiono, ogni isola dietro rallenta.",
"satellites.meo_comes_at_level":"L’anello MEO (circa 130 ms andata e ritorno) arriva al livello {lv}.",
"satellites.meo_ring_misses_city":"L’anello MEO non vede {city}: copre {lat}° a nord e a sud dell’equatore.",
"satellites.meo_users_notice":"Molto più vicino a terra, circa 130 ms andata e ritorno: gli utenti se ne accorgono appena ({p} del servizio conta come pessimo).",
@ -4794,7 +4823,9 @@
"satellites.ms_round_trip":"{ms} ms andata e ritorno",
"satellites.n_birds_see_both":{"one":"{n} satellite vede entrambe","other":"{n} satelliti vedono entrambe"},
"satellites.n_circuits_go_on_standby":{"one":"Il tuo circuito satellitare tra {a} e {b} va in standby accanto al nuovo link: porta traffico solo quando quel link cade.","other":"I tuoi {n} circuiti satellitari tra {a} e {b} vanno in standby accanto al nuovo link: portano traffico solo quando quel link cade."},
"satellites.n_in_leo_reach":{"one":"{n} isola o città remota entro {km} km da questo gateway.","other":"{n} isole e città remote entro {km} km da questo gateway."},
"satellites.n_places_in_reach":{"one":"{n} isola o città remota a portata al tuo livello.","other":"{n} isole e città remote a portata al tuo livello."},
"satellites.needs_leo_gateway":"La capacità LEO vuole un gateway al tuo teleport di {city}.",
"satellites.needs_tracking_antennas":"L’anello MEO vuole antenne a inseguimento al tuo teleport di {city}.",
"satellites.new_pop_cost":"nuovo POP {cost}",
"satellites.no_bird_sees_both":"Nessun satellite in vendita vede insieme {a} e {b}.",
@ -4818,9 +4849,11 @@
"satellites.rent_satellite_capacity":"Noleggia capacità satellitare",
"satellites.satellite_capacity":"Capacità satellitare",
"satellites.satellites":"Satelliti",
"satellites.sbk_blurb":"Migliaia di piccoli satelliti a 550 km di quota, circa 30 ms andata e ritorno: il primo satellite di cui i tuoi utenti non si lamenteranno. Saltano da un satellite all’altro ogni pochi secondi; nessuno se ne accorge.",
"satellites.sea_americas":"Americhe",
"satellites.sea_atlantic":"Atlantico",
"satellites.sea_indian":"Oceano Indiano",
"satellites.sea_leo":"entro 56° dall’equatore, a 550 km di quota",
"satellites.sea_pacific":"Pacifico",
"satellites.sea_tropics":"entro 50° dall’equatore",
"satellites.sea_west_pacific":"Pacifico occidentale",
@ -4833,6 +4866,7 @@
"satellites.tracking_antennas_up":"<b>Antenne a inseguimento attive a {city}.</b> Seguono l’anello MEO nel cielo.",
"satellites.up_in_n_days":{"one":"attivo tra {n} giorno","other":"attivo tra {n} giorni"},
"satellites.users_notice_geo_meo":"Gli utenti sentono il ritardo: la banda larga via GEO conta come mezzo servizio, via MEO quasi come tutto. Un cavo vince sempre, quindi i tuoi router mandano traffico lassù solo se non c’è altra strada.",
"satellites.users_notice_leo":"Via LEO, circa 30 ms andata e ritorno, gli utenti se ne accorgono appena, e le reti selettive fanno peering come su un cavo. Accanto a un cavo aspetta in standby.",
"satellites.users_ride_a_satellite":"utenti via satellite",
"satellites.via_bird":"via {bird}",
"satellites.who_a_satellite_serves":"I satelliti servono piccole isole e città remote che lo stesso satellite vede insieme al tuo teleport. Scegli la destinazione.",
@ -5237,6 +5271,60 @@
"utilities.title":"Utilità",
"utilities.two_routers":"Almeno due router",
"utilities.view_pop":"Mostra POP",
"wisp.backhaul":"Backhaul",
"wisp.close":"Chiudi il Wi-Fi delle isole",
"wisp.closed":"Il Wi-Fi delle isole su {zone} è chiuso.",
"wisp.costs_row":"Wi-Fi delle isole: torri e cavi di diramazione",
"wisp.cut_anchor":"L’ancora di una nave ha trascinato via il cavo di {zone} al largo di {city}.",
"wisp.cut_dark":"Nient’altro raggiunge le isole: restano offline finché non lo riparano.",
"wisp.cut_sat":"Nel frattempo il circuito satellitare porta le isole.",
"wisp.cut_slide":"Una frana sottomarina ha spezzato il cavo di {zone}.",
"wisp.cut_trawler":"Un peschereccio a strascico si è impigliato nel cavo di {zone}.",
"wisp.cut_volcano":"Un vulcano sottomarino è eruttato proprio sopra il cavo di {zone}.",
"wisp.decom":"Con lui chiude il Wi-Fi delle isole: {list}.",
"wisp.double_hop":"Doppio salto: {city} raggiunge il mondo solo via satellite, quindi il traffico delle isole salirebbe due volte. Prima porta un cavo a {city}.",
"wisp.full":"Il link è pieno: ci sono case in attesa.",
"wisp.homes_online":"Case online",
"wisp.inc_title":"Cavo tranciato",
"wisp.ipv6":"Le sue case sono solo IPv6 (464XLAT) dal primo giorno: il loro IPv4 condivide il pool NAT64, quindi le isole non hanno mai bisogno di un blocco tutto loro.",
"wisp.kit":"Il primo ordine porta anche il kit per le isole: torri, pannelli solari e radio per le case, {cost}.",
"wisp.lay_spur":"Posa il cavo {cost}",
"wisp.lead":"Nessun cavo arriva alle case di queste isole, quindi puoi essere tu il loro internet: prima capacità satellitare da un teleport qui, poi un cavo di diramazione. Gli isolani pagano prezzi da isola: {rate} al Gbps al mese.",
"wisp.leo_no_rivals":"{prov} non vende capacità a una costellazione rivale, e la tua vola già: queste isole possono ancora avere capacità GEO o MEO, o un cavo di diramazione.",
"wisp.move_note":"Ordina su un altro satellite per spostarci le isole: il vecchio circuito le porta finché il nuovo non è pronto.",
"wisp.moved":"{zone} ora passa da {bird}.",
"wisp.moving":{"one":"{cap} su {bird} ordinato per {zone}: le isole si spostano tra {n} giorno.","other":"{cap} su {bird} ordinato per {zone}: le isole si spostano tra {n} giorni."},
"wisp.n_zones":{"one":"{n} zona di isole","other":"{n} zone di isole"},
"wisp.no_pop":"Apri un POP qui per portare il Wi-Fi alle isole intorno: {list}.",
"wisp.no_teleport":"La capacità satellitare per le isole scende a un teleport a {city}. Prima costruiscine uno lì.",
"wisp.online":"{zone} è online: i primi isolani si stanno abbonando.",
"wisp.online_in_n_days":{"one":"Le isole vanno online tra {n} giorno: allora si abbonano le prime case.","other":"Le isole vanno online tra {n} giorni: allora si abbonano le prime case."},
"wisp.ordered":{"one":"{cap} su {bird} ordinato per {zone}: gli isolani vanno online tra {n} giorno.","other":"{cap} su {bird} ordinato per {zone}: gli isolani vanno online tra {n} giorni."},
"wisp.pool":"{g} di case",
"wisp.rush":"Noleggia una nave riparatrice",
"wisp.section":"Wi-Fi delle isole",
"wisp.served":"Servito sulle isole",
"wisp.spur":"Cavo di diramazione",
"wisp.spur_cut":{"one":"Tranciato: la nave riparatrice è a {n} giorno.","other":"Tranciato: la nave riparatrice è a {n} giorni."},
"wisp.spur_laying":"Una nave posacavi sta posando il cavo",
"wisp.spur_lead":"{km} km di cavo sottomarino da {city}. Le banche di sviluppo ne hanno pagato quasi tutto; questa è la tua parte. Una volta acceso, tutti sulle isole possono abbonarsi, e non si affitta niente.",
"wisp.spur_level":"I cavi di diramazione arrivano al livello {lv}.",
"wisp.spur_lit":"Cavo acceso, {cap}",
"wisp.spur_none":"Troppo lontano, o troppo ghiaccio marino, per un cavo: queste isole restano sui satelliti.",
"wisp.spur_ordered":{"one":"Una nave posacavi salpa per posare il cavo di {zone}: acceso tra {n} giorno.","other":"Una nave posacavi salpa per posare il cavo di {zone}: acceso tra {n} giorni."},
"wisp.spur_ready":"Il cavo di {zone} è acceso: ora tutti sulle isole possono abbonarsi.",
"wisp.spur_trap":"Un solo cavo è un unico punto di guasto: quando lo tranciano, la nave riparatrice ci mette settimane. Un circuito satellitare tenuto in standby porta le isole nel frattempo.",
"wisp.st_cut":"Cavo tranciato",
"wisp.st_none":"Ancora nessun link",
"wisp.st_soon":"In arrivo",
"wisp.st_spur":"Cavo",
"wisp.take":"Gli isolani si abbonano fin dove il link lo permette: circa il {geo} via GEO, il {meo} via MEO, il {leo} via LEO, tutti via cavo.",
"wisp.tele_reaches":"Wi-Fi delle isole da questo teleport:",
"wisp.upkeep":"Torri, solare e squadre",
"wisp.why_moving":"Uno spostamento su un altro satellite è già in corso.",
"wisp.why_no_pop":"Prima apri un POP a {city}: le squadre e la licenza delle isole lavorano da lì.",
"wisp.why_same":"Le isole passano già da {bird}: cambia piuttosto la taglia di quel circuito.",
"wisp.why_spur_have":"Il cavo è già posato.",
"wkscn.copy_my_result":"Copia il mio risultato",
"wkscn.desc_a_g_event_comes_to":"Il giorno {day} arriva a {city} un evento da {g}. Costruisci la rete che serve, da zero.",
"wkscn.desc_a_ship_dragged_its_anchor":"Una nave ha trascinato l'ancora su {cab}. Trova un'altra strada da {a} a {b}.",

View file

@ -2833,6 +2833,17 @@
"keys.show_this_list":"Mostrar esta lista",
"keys.space":"Espaço",
"keys.zoom_the_map_out_or":"Afastar ou aproximar o mapa",
"late.bank_note":"Por entrar tarde nesta sessão. O que a banda larga residencial te paga depois de qualquer parte do atacado é dobrado, não o Wi-Fi das ilhas, e os investidores não levam parte disso.",
"late.bb_pitch":{"one":"Você chegou tarde: por mais {n} dia, o que as residências daqui te pagam é dobrado.","other":"Você chegou tarde: por mais {n} dias, o que as residências daqui te pagam é dobrado."},
"late.card":{"one":"A banda larga residencial paga em dobro por mais {n} dia: +{price}/mês agora.","other":"A banda larga residencial paga em dobro por mais {n} dias: +{price}/mês agora."},
"late.hello":"<b>Atrasado para a festa, mas boas-vindas.</b> Esta sessão tem {n} dias e o hardware custa {p} a mais do que no primeiro dia dela, então o banco acrescenta {cash} ao seu capital inicial. No seu primeiro ano, a banda larga residencial paga em dobro: cada dólar que ela te paga é dobrado (o Wi-Fi das ilhas não).",
"late.hello_flat":"<b>Atrasado para a festa, mas boas-vindas.</b> Esta sessão tem {n} dias. No seu primeiro ano, a banda larga residencial paga em dobro: cada dólar que ela te paga é dobrado (o Wi-Fi das ilhas não).",
"late.match":"Banda larga residencial dobrada",
"late.over":"Seu ano de retardatário acabou: a banda larga residencial volta a pagar a tarifa normal.",
"late.this_month":"Dobra deste mês",
"late.title":"Vantagem do retardatário",
"late.top_up":"Reforço do capital inicial",
"late.until":"até {date}",
"latency_contracts.credits_paid":"{price} pagos em créditos de SLA",
"latency_contracts.over_sla":"<b>{name}</b>: {a} ⇄ {b} roda a {ms} ms, acima dos {max} ms do contrato. Cada dia acima te custa um dia de mensalidade em créditos de SLA ({price}).",
"latency_contracts.sla_terms":"SLA de latência {ms} ms: um dia de mensalidade devolvido por cada dia acima · nunca mais que {max}",
@ -4776,16 +4787,34 @@
"satellites.cancel_n_circuits_first":{"one":"Cancele primeiro o circuito de satélite dele.","other":"Cancele primeiro os {n} circuitos de satélite dele."},
"satellites.choose":"Escolher",
"satellites.circuit_ordered":{"one":"<b>{cap} no {bird} encomendados.</b> {a} ⇄ {b} está sendo apontado e testado: no ar em {n} dia.","other":"<b>{cap} no {bird} encomendados.</b> {a} ⇄ {b} está sendo apontado e testado: no ar em {n} dias."},
"satellites.close_the_leo_gateway":"Fechar o gateway LEO",
"satellites.close_the_teleport":"Fechar o teleporto",
"satellites.costs_row":"Teleportos e satélites",
"satellites.geo_dishes":"Antenas GEO",
"satellites.geo_dishes_and_meo_tracking":"Antenas GEO e antenas de rastreamento MEO",
"satellites.geo_users_notice":"De 36.000 km de altura a ida e volta leva uns 600 ms: chamadas de vídeo e jogos travam, e os usuários contam {p} do serviço como ruim.",
"satellites.grow_to":"Aumentar para {cap}",
"satellites.host_leo_gateway_cost_mo":"Gateway LEO <small>{cost} + {mo}/mês</small>",
"satellites.in_view_list":"À vista: {list}.",
"satellites.it_waits_on_standby":"Você já tem um link entre as duas: o satélite espera de reserva e só leva tráfego quando esse link cai.",
"satellites.its_blurb":"Feixes clássicos em banda C e Ku que cobrem um oceano inteiro. Confiáveis, em todo lugar, e com preço à altura.",
"satellites.kac_blurb":"Feixes pontuais em banda Ka sobre o Pacífico ocidental: o Gbps mais barato em órbita, se a sua ilha estiver debaixo de um feixe.",
"satellites.leo_backhaul":"Fibra e cabos que saem de {city}",
"satellites.leo_bottleneck":"{city} está cheio: cada ilha atrás deste gateway fica lenta junto. Ponha aqui mais roteadores, uma wave maior ou trânsito.",
"satellites.leo_comes_at_level":"A capacidade em órbita baixa (uns 30 ms de ida e volta) chega no nível {lv}.",
"satellites.leo_gateway":"Gateway LEO",
"satellites.leo_gateway_closed":"O gateway LEO em {city} foi fechado.",
"satellites.leo_gateway_unwired":"Nenhuma fibra sua sai mais de {city}: as ilhas atrás deste gateway chegam ao resto da sua rede por outro satélite.",
"satellites.leo_gateway_up":"<b>Gateway da {prov} no ar em {city}.</b> As antenas deles no seu telhado: alugue daqui capacidade em órbita baixa para ilhas a até {km} km.",
"satellites.leo_landing":"Pousando aqui vindo da órbita",
"satellites.leo_needs_fiber":"Um gateway LEO precisa ficar na sua fibra: {city} só chega ao resto da sua rede por satélite. Leve primeiro um cabo ou uma wave até lá, ou compre trânsito.",
"satellites.leo_no_rivals":"A {prov} não vende capacidade para uma constelação rival, e a sua já está voando: ponha uma antena-torta na ilha.",
"satellites.leo_out_of_reach":"A {prov} é um bent pipe: um satélite precisa ver o seu gateway e a ilha ao mesmo tempo, então eles podem estar a no máximo {km} km. De {a} a {b} são {d} km.",
"satellites.leo_safe_mode_n_days":{"one":"Modo seguro por uma tempestade solar: volta em {n} dia.","other":"Modo seguro por uma tempestade solar: volta em {n} dias."},
"satellites.leo_shell_misses_city":"A {prov} não alcança {city}: as camadas dela cobrem {lat}° de cada lado do equador.",
"satellites.leo_storm_msg":"Uma tempestade geomagnética: a {prov} põe os satélites em modo seguro. Seus circuitos LEO não levam nada até ela passar; os circuitos de reserva e os cabos levam o que podem.",
"satellites.leo_transit":"Trânsito que sai de {city}",
"satellites.leo_users_notice":"Bent pipe a 550 km de altura, uns 30 ms de ida e volta: os usuários mal percebem ({p} do serviço conta como ruim), e as redes seletivas fazem peering com você como por um cabo. Ele pousa no seu gateway em {city}: quando os roteadores ou a fibra desse POP enchem, cada ilha atrás dele fica lenta.",
"satellites.meo_comes_at_level":"O anel MEO (uns 130 ms de ida e volta) chega no nível {lv}.",
"satellites.meo_ring_misses_city":"O anel MEO não vê {city}: ele cobre {lat}° de cada lado do equador.",
"satellites.meo_users_notice":"Muito mais perto do chão, uns 130 ms de ida e volta: os usuários mal percebem ({p} do serviço conta como ruim).",
@ -4794,7 +4823,9 @@
"satellites.ms_round_trip":"{ms} ms de ida e volta",
"satellites.n_birds_see_both":{"one":"{n} satélite vê as duas","other":"{n} satélites veem as duas"},
"satellites.n_circuits_go_on_standby":{"one":"Seu circuito de satélite entre {a} e {b} fica de reserva ao lado do novo link: só leva tráfego quando esse link cai.","other":"Seus {n} circuitos de satélite entre {a} e {b} ficam de reserva ao lado do novo link: só levam tráfego quando esse link cai."},
"satellites.n_in_leo_reach":{"one":"{n} ilha ou cidade remota a até {km} km deste gateway.","other":"{n} ilhas e cidades remotas a até {km} km deste gateway."},
"satellites.n_places_in_reach":{"one":"{n} ilha ou cidade remota ao alcance no seu nível.","other":"{n} ilhas e cidades remotas ao alcance no seu nível."},
"satellites.needs_leo_gateway":"A capacidade LEO precisa de um gateway no seu teleporto em {city}.",
"satellites.needs_tracking_antennas":"O anel MEO precisa de antenas de rastreamento no seu teleporto em {city}.",
"satellites.new_pop_cost":"POP novo {cost}",
"satellites.no_bird_sees_both":"Nenhum satélite à venda vê {a} e {b} ao mesmo tempo.",
@ -4818,9 +4849,11 @@
"satellites.rent_satellite_capacity":"Alugar capacidade de satélite",
"satellites.satellite_capacity":"Capacidade de satélite",
"satellites.satellites":"Satélites",
"satellites.sbk_blurb":"Milhares de satélites pequenos a 550 km de altura, uns 30 ms de ida e volta: o primeiro satélite do qual seus usuários não vão reclamar. Eles piscam de um satélite para o próximo a cada poucos segundos; ninguém percebe.",
"satellites.sea_americas":"Américas",
"satellites.sea_atlantic":"Atlântico",
"satellites.sea_indian":"Oceano Índico",
"satellites.sea_leo":"até 56° do equador, a 550 km de altura",
"satellites.sea_pacific":"Pacífico",
"satellites.sea_tropics":"até 50° do equador",
"satellites.sea_west_pacific":"Pacífico ocidental",
@ -4833,6 +4866,7 @@
"satellites.tracking_antennas_up":"<b>Antenas de rastreamento no ar em {city}.</b> Elas seguem o anel MEO pelo céu.",
"satellites.up_in_n_days":{"one":"no ar em {n} dia","other":"no ar em {n} dias"},
"satellites.users_notice_geo_meo":"Os usuários sentem o atraso: banda larga por GEO conta como meio serviço, por MEO quase como o serviço inteiro. Um cabo sempre ganha, então seus roteadores só mandam tráfego para cima quando não há outro caminho.",
"satellites.users_notice_leo":"Por LEO, uns 30 ms de ida e volta, os usuários mal percebem, e as redes seletivas fazem peering como por um cabo. Ao lado de um cabo, ele espera de reserva.",
"satellites.users_ride_a_satellite":"usuários via satélite",
"satellites.via_bird":"via {bird}",
"satellites.who_a_satellite_serves":"Satélites atendem ilhas pequenas e cidades remotas que o mesmo satélite vê junto com o seu teleporto. Escolha o destino.",
@ -5237,6 +5271,60 @@
"utilities.title":"Utilitários",
"utilities.two_routers":"Pelo menos dois routers",
"utilities.view_pop":"Ver POP",
"wisp.backhaul":"Backhaul",
"wisp.close":"Fechar o Wi-Fi das ilhas",
"wisp.closed":"O Wi-Fi das ilhas em {zone} foi fechado.",
"wisp.costs_row":"Wi-Fi das ilhas: torres e ramais",
"wisp.cut_anchor":"A âncora de um navio arrastou o ramal de {zone} ao largo de {city}.",
"wisp.cut_dark":"Nada mais chega às ilhas: elas ficam fora do ar até o conserto.",
"wisp.cut_sat":"Enquanto isso, o circuito por satélite leva as ilhas.",
"wisp.cut_slide":"Um deslizamento submarino partiu o ramal de {zone}.",
"wisp.cut_trawler":"Uma traineira enganchou o ramal de {zone}.",
"wisp.cut_volcano":"Um vulcão submarino entrou em erupção bem em cima do ramal de {zone}.",
"wisp.decom":"O Wi-Fi das ilhas fecha junto: {list}.",
"wisp.double_hop":"Salto duplo: {city} só chega ao mundo por satélite, então o tráfego das ilhas subiria duas vezes. Leve primeiro um cabo até {city}.",
"wisp.full":"O link está cheio: há casas esperando.",
"wisp.homes_online":"Casas conectadas",
"wisp.inc_title":"Ramal cortado",
"wisp.ipv6":"As casas são só IPv6 (464XLAT) desde o primeiro dia: o IPv4 delas divide o pool NAT64, então as ilhas nunca precisam de um bloco próprio.",
"wisp.kit":"O primeiro pedido traz também o kit das ilhas: torres, painéis solares e rádios para as casas, {cost}.",
"wisp.lay_spur":"Lançar o ramal {cost}",
"wisp.lead":"Nenhum cabo chega às casas destas ilhas, então você pode ser a internet delas: primeiro capacidade por satélite de um teleporto aqui, depois um cabo ramal. Os ilhéus pagam preços de ilha: {rate} por Gbps ao mês.",
"wisp.leo_no_rivals":"A {prov} não vende capacidade para uma constelação rival, e a sua já está voando: estas ilhas ainda podem ter capacidade GEO ou MEO, ou um cabo ramal.",
"wisp.move_note":"Peça em outro satélite para mudar as ilhas para lá: o circuito antigo leva até o novo ficar pronto.",
"wisp.moved":"{zone} agora vai por {bird}.",
"wisp.moving":{"one":"{cap} no {bird} pedido para {zone}: as ilhas mudam em {n} dia.","other":"{cap} no {bird} pedido para {zone}: as ilhas mudam em {n} dias."},
"wisp.n_zones":{"one":"{n} zona de ilhas","other":"{n} zonas de ilhas"},
"wisp.no_pop":"Abra um POP aqui para levar Wi-Fi às ilhas em volta: {list}.",
"wisp.no_teleport":"A capacidade por satélite para as ilhas desce num teleporto em {city}. Construa um lá primeiro.",
"wisp.online":"{zone} está no ar: os primeiros ilhéus estão assinando.",
"wisp.online_in_n_days":{"one":"As ilhas ficam online em {n} dia: as primeiras casas assinam a partir daí.","other":"As ilhas ficam online em {n} dias: as primeiras casas assinam a partir daí."},
"wisp.ordered":{"one":"{cap} no {bird} pedido para {zone}: os ilhéus ficam on-line em {n} dia.","other":"{cap} no {bird} pedido para {zone}: os ilhéus ficam on-line em {n} dias."},
"wisp.pool":"{g} de casas",
"wisp.rush":"Fretar um navio de reparo",
"wisp.section":"Wi-Fi das ilhas",
"wisp.served":"Servido nas ilhas",
"wisp.spur":"Cabo ramal",
"wisp.spur_cut":{"one":"Cortado: o navio de reparo está a {n} dia.","other":"Cortado: o navio de reparo está a {n} dias."},
"wisp.spur_laying":"Navio cabeiro lançando o ramal",
"wisp.spur_lead":"{km} km de cabo submarino desde {city}. Os bancos de desenvolvimento pagaram a maior parte; esta é a sua parte. Quando estiver aceso, todos nas ilhas podem assinar, e nada é alugado.",
"wisp.spur_level":"Os ramais chegam no nível {lv}.",
"wisp.spur_lit":"Ramal aceso, {cap}",
"wisp.spur_none":"Longe demais, ou gelo marinho demais, para um ramal: estas ilhas ficam nos satélites.",
"wisp.spur_ordered":{"one":"Um navio cabeiro zarpa para lançar o ramal de {zone}: aceso em {n} dia.","other":"Um navio cabeiro zarpa para lançar o ramal de {zone}: aceso em {n} dias."},
"wisp.spur_ready":"O ramal de {zone} está aceso: agora todos nas ilhas podem assinar.",
"wisp.spur_trap":"Um só cabo é um ponto único de falha: quando é cortado, o navio de reparo leva semanas. Um circuito por satélite de reserva leva as ilhas enquanto isso.",
"wisp.st_cut":"Ramal cortado",
"wisp.st_none":"Ainda sem link",
"wisp.st_soon":"A caminho",
"wisp.st_spur":"Ramal",
"wisp.take":"Os ilhéus assinam até onde o link deixa: cerca de {geo} por GEO, {meo} por MEO, {leo} por LEO, e todos por cabo.",
"wisp.tele_reaches":"Wi-Fi das ilhas deste teleporto:",
"wisp.upkeep":"Torres, solar e equipes",
"wisp.why_moving":"Uma mudança para outro satélite já está em andamento.",
"wisp.why_no_pop":"Abra primeiro um POP em {city}: as equipes e a licença das ilhas trabalham de lá.",
"wisp.why_same":"As ilhas já vão pelo {bird}: mude o tamanho desse circuito.",
"wisp.why_spur_have":"O ramal já está lançado.",
"wkscn.copy_my_result":"Copiar meu resultado",
"wkscn.desc_a_g_event_comes_to":"No dia {day} chega a {city} um evento de {g}. Construa a rede de que ele precisa, do zero.",
"wkscn.desc_a_ship_dragged_its_anchor":"Um navio arrastou a âncora sobre o {cab}. Encontre outro caminho de {a} a {b}.",

View file

@ -23,6 +23,7 @@ const API_DOMAINS={
routerModel:{table:'RG',kind:'index'},
scrubTier:{table:'SCRUB_TIERS',kind:'index'},
satBird:{table:'SATS',kind:'key'},
wispZone:{table:'WISP',kind:'key'},
satG:{kind:'enum',values:()=>[...new Set(Object.values(SAT_ORB).flatMap(o=>o.g))].sort((a,b)=>a-b)},
// Small fixed vocabularies the game itself checks by list membership.
// The link metric presets, plus "custom" for a hand-tuned number (ACT.setMetric).

View file

@ -175,14 +175,33 @@ const API_CMD={
quote:a=>({setup:TRK_COST,monthly:TRK_MO,blocked:[teleOf(a.city)===2?'this teleport has tracking antennas already':trkWhy(a.city)].filter(Boolean)}),
doc:'Add tracking antennas to a teleport, so it can work the MEO ring (about 130 ms round trip instead of GEO\'s 600). Only within 50 degrees of the equator, where the ring is in view.'},
teleRm:{args:[['city','cityId']],confirm:'double',watch:['pops.#city'],
doc:'Close a teleport. Refused while circuits still start there.'},
doc:'Close a teleport (and its LEO gateway). Refused while circuits still start there.'},
teleLeo:{args:[['city','cityId']],watch:['pops.#city'],
quote:a=>({setup:LEO_GW_COST,monthly:LEO_GW_MO,blocked:[leoGw(a.city)?'there is a LEO gateway here already':leoGwWhy(a.city)].filter(Boolean)}),
doc:'Host a Starblink LEO gateway at your teleport (level 5, a POP on your fiber or with transit, within 56 degrees of the equator): LEO circuits from it reach small islands and remote towns within 1,200 km, about 30 ms round trip. Refused once your own constellation carries traffic.'},
teleLeoRm:{args:[['city','cityId']],confirm:'double',watch:['pops.#city'],
doc:'Close a LEO gateway. Refused while LEO circuits still start there.'},
buySat:{args:[['a','cityId'],['b','cityId'],['bird','satBird'],['g','satG']],
quote:a=>{const ok=own(SATS,a.bird),mo=ok?satMo(a.bird,+a.g):0;return {setup:mo+(S.pops[a.b]||!CITY[a.b]?0:popCost(a.b)),monthly:mo,days:ok?leadDays(SAT_ORB[SATS[a.bird].orb].days):0,blocked:[satWhy(a.a,a.b,a.bird,+a.g)].filter(Boolean)};},
doc:'Rent a satellite circuit from your teleport in a to b (a small island or a remote town) on a bird that sees both: GEO 1-10 Gbps, MEO 2-20 with tracking antennas. The first month up front; builds a POP at b if there is none. Next to an existing link between the two it goes on standby, as backup; a link built later between the two puts it on standby too. Cancel with rmLink.'},
doc:'Rent a satellite circuit from your teleport in a to b (a small island or a remote town) on a bird that sees both: GEO 1-10 Gbps, MEO 2-20 with tracking antennas, LEO 5-50 from a LEO gateway within 1,200 km (about 30 ms round trip; it puts GEO and MEO circuits on the same pair on standby, and one ordered beside it waits on standby). The first month up front; builds a POP at b if there is none. Next to an existing link between the two it goes on standby, as backup; a link built later between the two puts it on standby too. Cancel with rmLink.'},
satSize:{args:[['id','entityId'],['g','satG']],watch:['links.#id'],
quote:a=>{const l=S.links.find(x=>x.id===a.id&&x.kind==='sat'),g=+a.g,ok=!!l&&g!==l.g&&SAT_ORB[SATS[l.bird].orb].g.includes(g),mo=ok?satMo(l.bird,g):0;
return {setup:ok&&g>l.g?mo:0,monthly:mo,blocked:!l?['not a satellite circuit']:ok?[]:[tr('satellites.no_such_circuit')]};},
doc:'Resize a satellite circuit on the same bird. A bigger one pays its new month up front.'},
return {setup:ok&&g>l.g?mo:0,monthly:mo,blocked:!l?['not a satellite circuit']:ok?[g>l.g&&leoLink(l)?leoGrowWhy(l):''].filter(Boolean):[tr('satellites.no_such_circuit')]};},
doc:'Resize a satellite circuit on the same bird. A bigger one pays its new month up front; a LEO circuit grows only while its gateway is on your fiber and your own constellation carries nothing.'},
wispSat:{args:[['z','wispZone'],['bird','satBird'],['g','satG']],watch:['pops'],
quote:a=>{const ok=own(WISP,a.z)&&own(SATS,a.bird),mo=ok?wispSatMo(a.bird,+a.g):0;return {setup:ok?mo+(wispZ(a.z)?0:wispKit(a.z)):0,monthly:mo,days:ok?leadDays(SAT_ORB[SATS[a.bird].orb].days):0,blocked:[wispSatWhy(a.z,a.bird,+a.g)].filter(Boolean)};},
doc:'Island Wi-Fi: rent satellite capacity for an island zone (catalog WISP; its city is c) from your teleport in that city, on a bird that sees both: GEO 1-10 Gbps, MEO 2-20 with tracking antennas, LEO 5-50 from a Starblink gateway there. A contended share, 60% of a circuit\'s price. The first order of a zone also pays the island kit (towers, solar, home radios). How many homes sign up follows the link: about 35% of the pool over GEO, 75% over MEO, 90% over LEO, all over a spur. With a circuit running, one on another bird is a move: the old one carries until the new one is commissioned. The zone\'s homes join the city\'s demand.'},
wispSatSize:{args:[['z','wispZone'],['g','satG']],watch:['pops'],
quote:a=>{const Z=own(WISP,a.z)?wispZ(a.z):null,o=Z&&Z.sat,g=+a.g,ok=!!o&&g!==o.g&&SAT_ORB[wispOrb(o)].g.includes(g),mo=ok?wispSatMo(o.bird,g):0;
return {setup:ok&&g>o.g?mo:0,monthly:mo,blocked:!o?['no circuit for that zone']:ok?[g>o.g&&wispOrb(o)==='leo'?leoGrowWhy({a:WISP[a.z].c}):''].filter(Boolean):[tr('satellites.no_such_circuit')]};},
doc:'Resize an island zone\'s satellite circuit on the same bird. A bigger one pays its new month up front.'},
wispSatRm:{args:[['z','wispZone']],confirm:'double',watch:['pops'],
doc:'Cancel an island zone\'s satellite circuit (and a move being commissioned). With no spur lit, its homes go offline and leave.'},
wispSpur:{args:[['z','wispZone']],watch:['pops'],
quote:a=>{const ok=own(WISP,a.z);return {setup:ok?wispSpurCost(a.z)+(wispZ(a.z)?0:wispKit(a.z)):0,monthly:ok?wispSpurMo(a.z):0,days:ok?wispSpurDays(a.z):0,blocked:[wispSpurWhy(a.z)].filter(Boolean)};},
doc:'Island Wi-Fi: lay a spur cable from the zone\'s city (level 3; not every zone can have one). Every home there may sign up once it is lit, and nothing is rented. A spur can be cut (weeks to mend, or a $250k repair ship): a satellite circuit kept beside it carries the islands meanwhile. A zone may start with a spur alone (with the island kit).'},
wispRm:{args:[['z','wispZone']],confirm:'double',watch:['pops'],
doc:'Close an island Wi-Fi zone: its circuits, spur and homes go.'},
/* ---------- dark fiber and own cable ---------- */
orderDf:{args:[['a','cityId'],['b','cityId'],['source','dfSource'],['system','systemId']],
bindsUI:['pending','dfSrc','dfSys'],bind:a=>{UI.pending={a:a.a,b:a.b};UI.dfSrc=a.source;UI.dfSys=a.system;},
@ -343,7 +362,7 @@ const API_CMD={
ip4Nat64:{args:[['v','ip4Ratio64']],watch:['ip4'],
doc:'Set how many IPv6-only homes share one IPv4 address in the NAT64 pool (64, 128 or 256). Their refunds are well under CGNAT\'s at the same ratio and shrink as the world moves to IPv6; fewer is refused when the customers signed would not fit.'},
ip6Go:{args:[['city','cityId']],watch:['pops.#city'],
quote:a=>({setup:ip6Cost(a.city),days:ip6Days(a.city),monthly:Math.round(ip6Mo(a.city,(R.rev&&R.rev.eyeballs)||0)),blocked:[ip6Why(a.city)].filter(Boolean)}),
quote:a=>({setup:ip6Cost(a.city),days:ip6Days(a.city),monthly:Math.round(ip6Mo(a.city,ip4Eye())),blocked:[ip6Why(a.city)].filter(Boolean)}),
doc:'Take a broadband city IPv6-only (464XLAT): swap its dual-stack home routers for ones with a CLAT over the quoted days, paid day by day as they go in (setup is the whole swap; starting needs only the first day\'s share on hand, and it waits while cash is short). Those homes then need no IPv4 of their own, only a share of the NAT64 pool; new homes there get the new router too, at the swap\'s price a router, paid the day they join (even short of cash: a new home needs it). monthly is what it does to the IPv4 bill (NAT64 gateways and refunds against the CGNAT it saves; negative saves). Frees what the city panel says for new customers.'},
ip6Stop:{args:[['city','cityId']],watch:['pops.#city'],
doc:'Stop a city\'s swap to IPv6-only. The homes already swapped stay IPv6-only (their routers are paid for, nothing comes back); new homes come dual stack again. ip6Go resumes it for the rest.'},
@ -644,6 +663,7 @@ const API_BOUND={
trace:{command:'traceRun',arg:'from'},
decomToggle:{command:'decomGo',arg:'cities'},
satOpen:{command:'buySat',note:'opens the satellite order sheet from a teleport (a) or for a city (b); buySat takes a, b, bird and g itself'},
wispOpen:{command:'wispSat',note:'opens an island Wi-Fi zone in its city\'s Customers tab; wispSat, wispSpur and the rest take z themselves'},
openVxc:{command:'buyVxc',note:'opens the circuit picker from a fabric port ({from, prov}); buyVxc takes a, b, prov and t itself'},
connCancel:{command:'cancelTransit',note:'the connections list\'s cancel button: it arms, then dispatches cancelTransit, cancelPni, cancelIx, rmCache or rmNni'},
cnPrem:{command:'buildLink',arg:'premiumCrossing'},

View file

@ -5,7 +5,8 @@ const API_STATE_DOC={
name:{type:'string',doc:'Your network\'s name.'},
asn:{type:'integer',doc:'Your AS number.'},
home:{type:'string',doc:'The city you started in.'},
day:{type:'integer',doc:'Days since the company was founded.'},
day:{type:'integer',doc:'The calendar day (shared by every network of a server session); day − day0 is the network\'s age.'},
day0:{type:'integer',doc:'The calendar day this network began: 0, or the session\'s date for a network that joined a server session late.'},
cash:{type:'number',doc:'Cash on hand. Goes negative into the red; -100k is bankruptcy.'},
priceMul:{type:'number',doc:'Multiplier on transit prices (weekly modifier).'},
mode:{type:'string',doc:'normal | sandbox | scenario | puzzle.'},
@ -19,7 +20,7 @@ const API_STATE_DOC={
t1v:{type:'integer',doc:'Level at which Tier 1 transit was offered.'},
auV:{type:'integer',doc:'Australia content level gate.'},
seen:{type:'array',doc:'Network ids the deals panel has already shown. Vestigial: written by newGame, read nowhere.'},
pops:{type:'map',doc:'Your POPs by city id: day opened, broadband (bb: d, its demand in Gbps; v6, the share of its homes that are IPv6-only behind NAT64, absent for dual stack; v6e, the day a swap to IPv6-only finishes, while it runs), ad boost, downtime, routers, generator, second site, teleport (tele: 1 GEO dishes, 2 with MEO tracking antennas).'},
pops:{type:'map',doc:'Your POPs by city id: day opened, broadband (bb: d, its demand in Gbps; v6, the share of its homes that are IPv6-only behind NAT64, absent for dual stack; v6e, the day a swap to IPv6-only finishes, while it runs), ad boost, downtime, routers, generator, second site, teleport (tele: 1 GEO dishes, 2 with MEO tracking antennas), a Starblink LEO gateway on it (leo: 1), island Wi-Fi zones (wisp: by zone id, {day, d: the homes\' Gbps signed up, sat: the circuit {bird, g, mo, day, ready}, nxt: a move to another bird being commissioned, sp: the spur cable {day, ready}}).'},
links:{type:'array',doc:'Your links: waves, dark fiber (df), own cables, fabric circuits (vxc), express lightpaths (xp: via lists the dark fibers it rides from a, ch its optics) and rented satellite circuits (sat: bird, g Gbps, km of radio path, ready day), each with an entity id.'},
transit:{type:'array',doc:'Transit ports: city, net, tier, LAG members, port history for 95th-percentile billing.'},
ixp:{type:'map',doc:'IX ports by exchange city; tier per port (may exceed 1 with LAG members in ixn).'},
@ -42,7 +43,7 @@ const API_STATE_DOC={
ach:{type:'map',doc:'Badges earned this game, by badge id → day.'},
inc:{type:'array',doc:'Open incidents: type, what they hit, until when, optional rush-repair price.'},
ddosStarts:{type:'array',doc:'The days the attacks of the last week started; at most 14 a week.'},
ev:{type:'map',doc:'Live world events: the running DDoS, route leaks, fabric failures, price shocks.'},
ev:{type:'map',doc:'Live world events: the running DDoS, route leaks, fabric failures, price shocks, a solar storm (sky: the day LEO circuits leave safe mode).'},
stats:{type:'map',doc:'Counters: incidents survived, loans taken, sharks, conferences attended, peak traffic…'},
log:{type:'array',doc:'The NOC notification feed, newest first, capped at 60; identical notices within a minute fold with a count.'},
nextFail:{type:'integer',doc:'The day the next failure fires.'},
@ -131,6 +132,9 @@ const API_RESULTS_DOC={
cityDem:{type:'map',doc:'Eyeball + customer demand per city.'},
citySrv:{type:'map',doc:'Traffic served per city.'},
cityEye:{type:'map',doc:'Eyeballs online per city.'},
cityWisp:{type:'map',doc:'Island Wi-Fi: the Gbps of island homes each city carries for its zones (already in cityDem; never in cityEye). Only there while you run a zone.'},
wisp:{type:'map',doc:'Island Wi-Fi zones by zone id (catalog WISP): d, the homes\' Gbps wanted; car, what their backhaul carried; sf, how well they were served (0..1); k, how many may sign up over today\'s link (the take-up cap). Only there while you run a zone.'},
wispL:{type:'array',doc:'Island Wi-Fi zones in this compute: z, its city c, zd wanted and car carried, in Gbps. Only there while you run a zone.'},
latF:{type:'map',doc:'Fraction of each city\'s traffic that goes far (over a threshold latency).'},
latFar:{type:'map',doc:'The far exit each slow city sends traffic through.'},
satU:{type:'map',doc:'Of each city\'s served traffic, the Gbps that rode a rented satellite circuit (its users notice the orbit\'s latency on that share). Only there while you have a satellite circuit up.'},
@ -142,7 +146,7 @@ const API_RESULTS_DOC={
revMo:{type:'number',doc:'Revenue per month.'},
costMo:{type:'number',doc:'Cost per month.'},
cost:{type:'map',doc:'Monthly cost by category (transit, pni, ix, links…).'},
rev:{type:'map',doc:'Monthly revenue by source.'},
rev:{type:'map',doc:'Monthly revenue by source (late: a late joiner\'s first-year match of what its homes pay).'},
reachable:{type:'map',doc:'Networks reachable per net id.'},
cone:{type:'map',doc:'Which peer\'s customer cone carries each network you reach without transit of your own, by net id.'},
ddos:{type:'array',doc:'Per live attack: the target, its size, which ports it fills, what Flowspec and each scrubbing centre cleaned, and what reaches the target.'},

View file

@ -26,7 +26,7 @@ function apiJson(v){
carries the keys confGo/confSponsor need, which exist in no field of S; TE_RECIPES renders
each recipe's script, because the source is a function and some read the live network. The
recipes' relevance score is not exposed: judging which one fits is the agent's job. */
const API_TABLES={ROCKETS,CRUSTS,PIE_RD,PIE_SPAT_DEF,SATS,SAT_ORB,SAT_PROV,SALES,CITIES,NETS,CABLES,XIX,PORT,LT,NNI,VXC,RG,OPT,DF_SYS,FAB,SCRUB_TIERS,BIZ_T,LEVELS,GOALS,BROKER_GOALS,SCN,BANKS,REQS,NSH,MET,PREF,RT,PPOL,CONFS,LAG_MAX,PNI_LAG_MAX,PNI_LAG_RT,RMAX,REGEN_MAX,START_CASH,CONF_COST,CONF_SP,CAP_COST,CAP_LV,CONF_DAYS,SUB_UPGRADES,SEA_DESIGNS,TE_COST,TE_MO,MYIX_COST,CN_LIC,SITE2_COST,MYIX_FAB,INTERNS,OPSK,CHARTERS,SEAT_N,CORE_LV,CORE_COST,CORE_REQ,CORE_LAB,INTERN_MO,PZ_TIERS,AR_TIERS,PZ_RG};
const API_TABLES={ROCKETS,CRUSTS,PIE_RD,PIE_SPAT_DEF,SATS,SAT_ORB,SAT_PROV,WISP,SALES,CITIES,NETS,CABLES,XIX,PORT,LT,NNI,VXC,RG,OPT,DF_SYS,FAB,SCRUB_TIERS,BIZ_T,LEVELS,GOALS,BROKER_GOALS,SCN,BANKS,REQS,NSH,MET,PREF,RT,PPOL,CONFS,LAG_MAX,PNI_LAG_MAX,PNI_LAG_RT,RMAX,REGEN_MAX,START_CASH,CONF_COST,CONF_SP,CAP_COST,CAP_LV,CONF_DAYS,SUB_UPGRADES,SEA_DESIGNS,TE_COST,TE_MO,MYIX_COST,CN_LIC,SITE2_COST,MYIX_FAB,INTERNS,OPSK,CHARTERS,SEAT_N,CORE_LV,CORE_COST,CORE_REQ,CORE_LAB,INTERN_MO,PZ_TIERS,AR_TIERS,PZ_RG};
const API_MADE={
BADGES:()=>!S?[]:BADGES.map(b=>{const on=S.ach&&S.ach[b.id]!==undefined,ever=!!hof()[b.id];
return b.secret&&!on&&!ever?{id:b.id,i:'❔',t:'???',d:tr('badges.a_secret_badge'),r:b.r,secret:true}:{...b,ever};}),
@ -81,7 +81,7 @@ function apiStatus(){
const goal=goals().find(g=>S.done[g.id]===undefined),t1=isTier1(),k=o=>Object.fromEntries(Object.entries(o||{}).map(([a,v])=>[a,Math.round(v)]).filter(([,v])=>v));
return {
name:S.name,asn:S.asn,home:apiCityName(S.home),mode:S.mode,rules:S.rules&&S.rules.preset,
day:S.day,date:dateStr(S.day),cash:Math.round(S.cash),level:S.lvl||0,
day:S.day,age:netAge(),date:dateStr(S.day),cash:Math.round(S.cash),level:S.lvl||0,
tier:tierLabel(),whyNotTier1:t1?null:apiText(t1Why()),
goal:goal?{title:apiText(goal.t),what:apiText(goal.d)}:null,
monthly:{revenue:Math.round(R.revMo),cost:Math.round(R.costMo),profit:Math.round(R.revMo-R.costMo),revenueBy:k(R.rev),costBy:k(R.cost)},

View file

@ -14,7 +14,7 @@ function hwMul(k){if(!S||!rule('market'))return 1;const l=hwLock();if(l)return l
const hwLockCost=()=>Math.round((80000+30000*Object.keys(S.pops).length)*(hwShock()?2:1)/1000)*1000;
function hwShockStart(){const k=pick(Object.keys(HW_SHOCK)),n=45+Math.floor(Math.random()*31);S.hw=S.hw||{};S.hw.shock={k,until:S.day+n,mul:HW_SHOCK[k].mul};
toast(tr(HW_SHOCK[k].msg,{n})+(hwLock()?'<br>'+tr('supply_chain.your_price_lock_covers_you_until',{date:dateStr(hwLock().until)}):''),hwLock()?'':'bad');sfx('alert');}
function hwCard(){if(!S||!rule('market')||(S.day<=HW_FREE&&!hwShock()&&!hwLock()))return '';const t=hwTrend(S.day),s=hwShock(),l=hwLock();
function hwCard(){if(!S||!rule('market')||(S.day<=HW_FREE&&!hwShock()&&!hwLock()))return '';const t=hwTrend(S.day)/hwTrend(S.day0|0),s=hwShock(),l=hwLock();
return `<div class="ibx"><div class="nm">📦 ${tr('common.supply_chain')}</div>
<div class="kv"><span>${tr('common.hardware_prices')}</span><b>${t>1.005?tr('supply_chain.p_since_you_started',{p:pct(t-1)}):tr('supply_chain.as_when_you_started')}</b></div>
<div class="kv"><span>${tr('lifecycle.bandwidth_prices')}</span><b>${mktTxt()}</b></div>

View file

@ -3,21 +3,28 @@
the early answer to "no cable lands there", and the warm backup for an island hanging on one cable. Geostationary
birds (GEO, 35,786 km up) see a whole ocean from one dish: no build, dear per Gbps, about 600 ms there and back. A
medium-orbit ring over the equator (MEO, 8,062 km up) gets that down to about 130 ms, but a teleport needs tracking
antennas to follow its satellites across the sky. Your own constellation (LEO, Pie in the Sky) comes much later.
antennas to follow its satellites across the sky. A rented low-orbit constellation (LEO, 550 km up, from level 5) is
a bent pipe: one satellite sees a gateway at your teleport and an island at once, so it reaches only the region round
the gateway, at about 30 ms. Your own constellation (Pie in the Sky) comes later still.
The providers are vendors, like the fabrics: they sell you capacity, they are not networks you route to. */
// h: km up; proc: ms of modems and error correction each way; loss: the share of a city's service its users stop counting
// once their traffic rides it (half for GEO, like any haul past 50 ms; MEO feels almost like fiber); days: to point and
// commission a new circuit; lv: the level it unlocks at; g: the sizes sold (Gbps). A MEO ring covers |lat| <= lat, and a
// circuit's two ends must see the same satellite at once: at most km apart, and at least el degrees above both horizons
// (what a ground terminal needs to clear the trees; far north, two ends 7,000 km apart lose it below the horizon).
// commission a new circuit; lv: the level it unlocks at; g: the sizes sold (Gbps). A MEO ring or LEO shell covers
// |lat| <= lat (LEO's 53 degree shell reaches a few degrees past its inclination, as pieCovers does), and a circuit's two
// ends must see the same satellite at once: at most km apart (LEO: a bent pipe, no lasers on a rented tier), and at least
// el degrees above both horizons (what a ground terminal needs to clear the trees; far north, two ends 7,000 km apart lose
// a MEO satellite below the horizon). loss is also how satEdges/satAfter tell the orbits apart, so no two may share one.
// wisp: how many of an island zone's homes sign up when this orbit is their only link (46-wisp-zones.js).
const SAT_ORB={
geo:{n:'GEO',h:35786,proc:25,loss:0.5,days:10,lv:2,g:[1,2,5,10]},
meo:{n:'MEO',h:8062,proc:7,loss:0.08,days:21,lv:3,g:[2,5,10,20],lat:50,km:7500,el:5},
geo:{n:'GEO',h:35786,proc:25,loss:0.5,days:10,lv:2,g:[1,2,5,10],wisp:0.35},
meo:{n:'MEO',h:8062,proc:7,loss:0.08,days:21,lv:3,g:[2,5,10,20],lat:50,km:7500,el:5,wisp:0.75},
leo:{n:'LEO',h:550,proc:10,loss:0.03,days:14,lv:5,g:[5,10,20,50],lat:56,km:1200,el:25,wisp:0.9},
};
// pg: dollars a month for the first Gbps; bigger circuits cost less per Gbps (satMo).
const SAT_PROV={
its:{n:'Intelsplat',col:'#2F8CFF',pg:2500,blurb:tr('satellites.its_blurb')},
kac:{n:'Kacophony',col:'#FF8A3D',pg:1400,blurb:tr('satellites.kac_blurb')},
sbk:{n:'Starblink',col:'#7C5CFF',pg:1000,blurb:tr('satellites.sbk_blurb')},
sesa:{n:'SESame',col:'#16A866',pg:2000,blurb:tr('satellites.sesa_blurb')},
};
// The birds. A GEO sits over the equator at lon; r is how far its beams reach, in degrees of arc from the point under it
@ -29,9 +36,13 @@ const SATS={
kac1:{n:'Kacophony-1',p:'kac',orb:'geo',lon:150,r:50,sea:N_('satellites.sea_west_pacific')},
gx19:{n:'Intelsplat 19',p:'its',orb:'geo',lon:-97,r:72,sea:N_('satellites.sea_americas')},
o3b:{n:'O3bservant',p:'sesa',orb:'meo',sea:N_('satellites.sea_tropics')},
sb53:{n:'Starblink Shell 53',p:'sbk',orb:'leo',sea:N_('satellites.sea_leo')},
};
// The teleport itself (dishes, a building, the licences), and the MEO tracking antennas it may add.
const TPORT_COST=90000,TPORT_MO=2500,TRK_COST=250000,TRK_MO=3000;
// The rented LEO tier: its one bird, the gateway Starblink puts on your teleport's roof, and its solar storms (a weight
// among the failures, and the most days one may last).
const LEO_BIRD='sb53',LEO_GW_COST=400000,LEO_GW_MO=8000,LEO_STORM_W=1,LEO_STORM_MAX=3;
// Who a satellite serves: a small island off the big continents, or a remote town anywhere, never a big city's market.
const SAT_MAIN=['af','am','eu','oc','sa'],SAT_ISLE_P=150,SAT_TOWN_P=5;
const SAT_RE=6371,SAT_C=300;
@ -41,17 +52,35 @@ function satArc(la1,lo1,la2,lo2){const r=Math.PI/180,c=Math.sin(la1*r)*Math.sin(
function satSlant(arc,h){const Q=SAT_RE+h,a=arc*Math.PI/180;return Math.sqrt(SAT_RE*SAT_RE+Q*Q-2*SAT_RE*Q*Math.cos(a));}
// How high above a dish's horizon that satellite stands, in degrees (negative: below it, behind the Earth).
function satElev(arc,h){const a=arc*Math.PI/180;return Math.atan2(Math.cos(a)-SAT_RE/(SAT_RE+h),Math.sin(a))*180/Math.PI;}
// The longitude the bird sits over for a circuit: a GEO's slot; a MEO ring's satellite halfway between the two ends.
function satLon(id,a,b){const B=SATS[id];if(B.orb==='geo')return B.lon;const r=Math.PI/180,A=CITY[a],C=CITY[b];
return Math.atan2(Math.sin(A.lon*r)+Math.sin(C.lon*r),Math.cos(A.lon*r)+Math.cos(C.lon*r))/r;}
// Whether bird id sees city c.
function satSees(id,c){const B=SATS[id],C=CITY[c];if(!B||!C)return false;return B.orb==='meo'?Math.abs(C.lat)<=SAT_ORB.meo.lat:satArc(0,B.lon,C.lat,C.lon)<=B.r;}
function satPairOk(id,a,b){if(a===b||!satSees(id,a)||!satSees(id,b))return false;if(SATS[id].orb!=='meo')return true;const O=SAT_ORB.meo;
if(kmBetween(a,b)>O.km)return false;const lon=satLon(id,a,b);return [a,b].every(c=>satElev(satArc(0,lon,CITY[c].lat,CITY[c].lon),O.h)>=O.el);}
/* The geometry works on points ({lat, lon}: a city, or an island zone that is no city), and the city versions wrap it.
The longitude the bird sits over for a circuit between P and Q: a GEO's slot; a MEO ring's satellite halfway between
the two ends. LEO does not use it: its satellite flies over the midpoint of the two ends, not over the equator. */
function satLonAt(id,P,Q){const B=SATS[id];if(B.orb==='geo')return B.lon;const r=Math.PI/180;
return Math.atan2(Math.sin(P.lon*r)+Math.sin(Q.lon*r),Math.cos(P.lon*r)+Math.cos(Q.lon*r))/r;}
function satLon(id,a,b){return satLonAt(id,CITY[a],CITY[b]);}
// Whether bird id sees point P, and city c.
function satSeesAt(id,P){const B=SATS[id];if(!B||!P)return false;return B.orb==='geo'?satArc(0,B.lon,P.lat,P.lon)<=B.r:Math.abs(P.lat)<=SAT_ORB[B.orb].lat;}
function satSees(id,c){return satSeesAt(id,CITY[c]);}
// Whether one satellite of bird id sees both ends at once: a GEO sees them from its slot; a MEO or LEO satellite has to
// be within km of both and high enough above both horizons (LEO's flies over the midpoint). km as kmBetween counts it.
function satPairAt(id,P,Q){if(!satSeesAt(id,P)||!satSeesAt(id,Q))return false;const B=SATS[id];if(B.orb==='geo')return true;const O=SAT_ORB[B.orb];
if(Math.max(20,Math.round(hav(P.lon,P.lat,Q.lon,Q.lat)))>O.km)return false;
if(B.orb==='leo')return satElev(satArc(P.lat,P.lon,Q.lat,Q.lon)/2,O.h)>=O.el;
const lon=satLonAt(id,P,Q);return [P,Q].every(X=>satElev(satArc(0,lon,X.lat,X.lon),O.h)>=O.el);}
function satPairOk(id,a,b){return a!==b&&satPairAt(id,CITY[a],CITY[b]);}
// The radio path: up from one dish and down to the other, the km the signal really travels. It is the link's km, so the
// routers' metric (pairW) sees a satellite as the long way round it is, and a cable wins whenever there is one.
function satKm(id,a,b){const h=SAT_ORB[SATS[id].orb].h,lon=satLon(id,a,b),A=CITY[a],C=CITY[b];
return Math.round(satSlant(satArc(0,lon,A.lat,A.lon),h)+satSlant(satArc(0,lon,C.lat,C.lon),h));}
function satKmAt(id,P,Q){const h=SAT_ORB[SATS[id].orb].h;
if(SATS[id].orb==='leo')return Math.round(2*satSlant(satArc(P.lat,P.lon,Q.lat,Q.lon)/2,h));
const lon=satLonAt(id,P,Q);return Math.round(satSlant(satArc(0,lon,P.lat,P.lon),h)+satSlant(satArc(0,lon,Q.lat,Q.lon),h));}
function satKm(id,a,b){return satKmAt(id,CITY[a],CITY[b]);}
/* LEO from a gateway to any point on the globe (a zone of islands, not a city): pure, they read only the catalog and
CITY. c: the gateway's city id; lat, lon: the far end in degrees. leoArcLL: the arc between them in degrees; leoKmLL:
the radio path in km (up to the satellite over the midpoint and down again); leoMsLL: one way in ms, the modems
included. Whether a gateway may serve that point today is leoReachLL (60-features/45-teleports.js). */
const leoArcLL=(c,lat,lon)=>satArc(CITY[c].lat,CITY[c].lon,lat,lon);
const leoKmLL=(c,lat,lon)=>Math.round(2*satSlant(leoArcLL(c,lat,lon)/2,SAT_ORB.leo.h));
const leoMsLL=(c,lat,lon)=>leoKmLL(c,lat,lon)/SAT_C+SAT_ORB.leo.proc;
// One way: the radio path at the speed of light in vacuum, plus the modems at both ends.
const satLat=l=>l.km/SAT_C+SAT_ORB[SATS[l.bird].orb].proc;
const satMo=(id,g)=>Math.round(SAT_PROV[SATS[id].p].pg*Math.pow(g,0.85)/10)*10;

View file

@ -0,0 +1,38 @@
/* ---------- Island Wi-Fi zones (#83): the outer islands no cable reaches ----------
Each zone is a pool of island homes looking to one island city (c, always one a satellite serves), at the point lat,
lon: no city on the map and no link, only homes your POP in c brings online (60-features/46-wisp-zones.js).
n: real place names, as in CITIES, joined by "&". P: Gbps of homes at full take-up in era 1 (about the islands' share
of their country, half again for being the only internet there; scaled by eraMul() like eyeP). km: the spur cable from
c, 0 where none can be laid (too far, or sea ice). v: volcanic, so an eruption can cut the spur. Zones under 3 G are
left out: pie terminals and a satellite circuit to the island itself serve those.
The zones beyond 56 degrees (Nunavut, Southeast Alaska) are past Starblink's shell and MEO's ring: GEO only there. */
const WISP={
anjouan:{n:'Anjouan & Mohéli',c:'hah',lat:-12.25,lon:44.1,P:6,km:200},
capeverde:{n:'Sal, Boa Vista & São Vicente',c:'rai',lat:16.6,lon:-23.8,P:6,km:450},
chuuk:{n:'Chuuk, Yap & Kosrae',c:'pni',lat:7.4,lon:151.85,P:5,km:800},
leeward:{n:'Bora Bora & Raiatea',c:'ppt',lat:-16.8,lon:-151.45,P:4,km:250},
malaita:{n:'Malaita & Gizo',c:'hir',lat:-8.5,lon:159.5,P:8,km:350},
marianas:{n:'Saipan, Tinian & Rota',c:'gum',lat:15.2,lon:145.75,P:6,km:230,v:1},
ngi:{n:'New Britain, New Ireland & Bougainville',c:'pom',lat:-5,lon:152.5,P:12,km:900,v:1},
nunavut:{n:'Rankin Inlet, Cambridge Bay & Pond Inlet',c:'yfb',lat:66.5,lon:-88,P:5,km:0},
outislands:{n:'Abaco, Eleuthera & Exuma',c:'nas',lat:25.1,lon:-76.4,P:8,km:400},
rangiroa:{n:'Rangiroa & Nuku Hiva',c:'ppt',lat:-12,lon:-144,P:3,km:1400},
santo:{n:'Espiritu Santo & Tanna',c:'vli',lat:-16.5,lon:167.8,P:8,km:400,v:1},
savaii:{n:'Savai’i',c:'apw',lat:-13.6,lon:-172.4,P:3,km:80},
seak:{n:'Sitka, Ketchikan & Petersburg',c:'jnu',lat:56.4,lon:-133.3,P:5,km:450},
southatolls:{n:'Addu, Fuvahmulah & Huvadhoo',c:'mle',lat:0,lon:73.3,P:6,km:500},
tobago:{n:'Tobago',c:'pos',lat:11.25,lon:-60.7,P:3,km:120},
vanualevu:{n:'Vanua Levu & Taveuni',c:'suv',lat:-16.6,lon:179.2,P:10,km:220},
vavau:{n:'Vava’u & Ha’apai',c:'tbu',lat:-19.2,lon:-174.2,P:3,km:300,v:1},
vi:{n:'St Thomas, St Croix & Tortola',c:'sju',lat:18.2,lon:-64.8,P:6,km:160},
};
/* The money. ARPU: islanders pay island prices (times EYE_RATE). SHARE: a zone's satellite capacity is a contended share
of a high-throughput beam, cheaper than a trunk circuit of the same size. KIT(+G per Gbps of pool): towers, solar
panels and home radios, with the first order; MO(+G): their upkeep. SPUR: a subsea branch cable with small beach
landings (repeatered past a few hundred km, as real ones are), mostly paid by development banks (this is your share),
plus KM a km; MO + MO_KM a km to run; G: what it carries; D0 + DKM a km: days to lay it. LV: the level spurs come at.
GROW: daily take-up growth; START: the pool share that signs up at once and never leaves. RUSH: chartering a repair
ship for a cut spur; CUT_W: a lit spur's weight among the failures. */
const WISP_ARPU=14,WISP_SHARE=0.6,WISP_KIT=30000,WISP_KIT_G=4000,WISP_MO=500,WISP_MO_G=50,
WISP_SPUR=150000,WISP_SPUR_KM=600,WISP_SPUR_MO=400,WISP_SPUR_MO_KM=1.5,WISP_SPUR_G=100,WISP_SPUR_D0=90,WISP_SPUR_DKM=0.15,
WISP_SPUR_LV=3,WISP_GROW=0.02,WISP_START=0.05,WISP_RUSH=250000,WISP_CUT_W=1.5;

View file

@ -50,7 +50,7 @@ function stretchInc(i){if(rule('chaos')!=='spicy'||!i||!(i.until>S.day)||i.start
else if(['crash','power','oops','cleaner','maint','shutdown'].includes(T))f(S.pops[r],'down');
else if(T==='ring')f(S.pops[r],'ringcut');else if(T==='ac')f(S.pops[r],'hot');
else if(T==='transit'||T==='prepend')f(S.transit.find(t=>t.id===r),'down');
else if(T==='ixloop'&&E.ixdown)f(E.ixdown,r);else if(T==='fabric'&&E.fab)f(E.fab,r);
else if(T==='ixloop'&&E.ixdown)f(E.ixdown,r);else if(T==='fabric'&&E.fab)f(E.fab,r);else if(T==='leostorm')f(E,'sky');
else if(T==='lacp'){const [k,...x]=String(r).split(':'),id=x.join(':');f(k==='ix'?E.ixlacp&&E.ixlacp[id]:(k==='t'?S.transit:S.pni).find(o=>o.id===id)?.lacp,'until');}
else if(T==='rpki'||T==='hijack')f(E.rpki,'until');else if(T==='leak'||T==='pmtud')f(E[T],'until');else if(T==='krroute'||T==='depeer')f(E,T);
else if(T==='ddos')f(ddosAll(S,false).find(a=>a.id===i.atk),'until');}

View file

@ -130,6 +130,6 @@ function loanTick(d){
const broke=S.cash<0;
// With half a billion in the vault, loan offers are just noise (#52): banks stop calling, open offers lapse.
if(S.cash>=RICH_NO_LOANS){if(S.loanOffers.length||!S.richTold){S.loanOffers=[];if(!S.richTold&&S.mode!=='sandbox'){S.richTold=1;toast(tr('banks.the_banks_have_stopped_calling_you',{cash:fmt$(RICH_NO_LOANS)}),'good');}}return;}
if(S.loanOffers.length<4&&(broke?Math.random()<0.25:(d>20&&Math.random()<1/40)))spawnLoanOffer(broke);
if(S.loanOffers.length<4&&(broke?Math.random()<0.25:(d-S.day0>20&&Math.random()<1/40)))spawnLoanOffer(broke);
}
const RICH_NO_LOANS=5e8;

View file

@ -58,9 +58,12 @@ function beginState(nm,city,o={}){newGame(nm,city);if(asnOk(o.asn))S.asn=o.asn;S
if(S.mode==='sandbox'){S.cash=1e9;S.lvl=LEVELS.length;if(!chaosMul()){S.nextFail=1e9;S.nextEvent=1e9;}}
if(o.scn){const sc=o.scn;S.scn={id:sc.id,rules:sc.rules||{},days:sc.days,name:sc.n||tr('features.weekly_challenge_key',{key:sc.key}),key:sc.key||null,mods:(sc.mods||[]).map(m=>m.id)};S.rng=(o.seed||hstr(sc.id))|0;S.mode='scenario';S.asn=200000+Math.floor(Math.random()*15000);
if(sc.cash)S.cash=sc.cash;if(sc.setup)sc.setup();
for(const m of S.scn.mods){if(m==='pricey')S.priceMul=1.3;if(m==='poor')S.cash=100000;if(m==='chaos')S.scn.rules.chaos=true;if(m==='boom')S.scn.rules.boom=true;if(m==='dk')S.scn.rules.dkAll=true;if(m==='sharks')S.scn.rules.sharks=true;}}}
for(const m of S.scn.mods){if(m==='pricey')S.priceMul=1.3;if(m==='poor')S.cash=100000;if(m==='chaos')S.scn.rules.chaos=true;if(m==='boom')S.scn.rules.boom=true;if(m==='dk')S.scn.rules.dkAll=true;if(m==='sharks')S.scn.rules.sharks=true;}}
// o.day: a network of a server session begins on the session's date (81-late-joiners.js), after its rules are locked.
if(S.mp&&S.mode==='normal'&&Number.isInteger(o.day)&&o.day>0)lateStart(Math.min(o.day,1e7));}
// The welcome line: in the log, and on screen.
function beginHello(o={}){toast(S.scn?`<b>${esc(S.scn.name)}</b><br>${o.scn.goal?esc(o.scn.goal)+'.':tr('common.serve_as_much_traffic_as_you')} ${tr('scenarios.you_have_n_days',{n:S.scn.days})}`:S.mode==='sandbox'?(chaosMul()?tr('scenarios.sandbox_mode_a_billion_dollars_chaos',{chaos:CHAOS[rule('chaos')].n}):tr('scenarios.sandbox_mode_a_billion_dollars_every')):tr('scenarios.welcome_name_the_ripe_ncc_assigned',{name:esc(S.name),asn:S.asn,city:CITY[S.home].name}),'goal');}
function beginHello(o={}){toast(S.scn?`<b>${esc(S.scn.name)}</b><br>${o.scn.goal?esc(o.scn.goal)+'.':tr('common.serve_as_much_traffic_as_you')} ${tr('scenarios.you_have_n_days',{n:S.scn.days})}`:S.mode==='sandbox'?(chaosMul()?tr('scenarios.sandbox_mode_a_billion_dollars_chaos',{chaos:CHAOS[rule('chaos')].n}):tr('scenarios.sandbox_mode_a_billion_dollars_every')):tr('scenarios.welcome_name_the_ripe_ncc_assigned',{name:esc(S.name),asn:S.asn,city:CITY[S.home].name}),'goal');
if(lateIs())lateHello();}
function beginShow(city,o={}){
// Every new network starts at ½ speed (#186), whatever the last one ran at: slow enough to look around, but things happen.
UI.lastSpeed=rule('clock')?0.5:0;setSpeed(UI.lastSpeed);UI.resumeSpeed=null;

View file

@ -22,7 +22,8 @@ const IP4_BB=10,IP4_V4=0.55,IP4_V4_YR=0.02,IP4_V4_MIN=0.2,IP4_CGN=2;
// under CGNAT's at the same ratio, and shrinking as the world goes IPv6.
const IP4_N64=[64,128,256],IP4_N640=128,IP4_ANNOY64={64:0.006,128:0.01,256:0.016};
// The market: dollars per address, flat for half a year, then +3% a year on a slow four-year swing. Leases are by the
// month (a broker keeps a cut of what yours earn), sales pay 92% of the price after the broker's fee.
// month (a broker keeps a cut of what yours earn, and investors on a revenue share take theirs: computeMoney), sales pay
// 92% of the price after the broker's fee.
const IP4_PX=38,IP4_FREE=180,IP4_YR=0.03,IP4_IN=0.5,IP4_OUT=0.4,IP4_SELL=0.92;
// Of the bill of a home behind CGNAT, the share that comes back as refunds (gamers, mostly): more homes per address, more
// grumbling. Homes squeezed past the ratio (port exhaustion) are worse.
@ -43,7 +44,8 @@ function ip4Need(b){const k=b&&IP4_BIZ[b.type];if(!k||!(b.bw>0))return 0;return
function ip4Use(s=S){const I=s.ip4,r=I.nat,r6=I.n64||IP4_N640;let own=0,inn=0,out=0,B=0,H=0,H6=0;
for(const b of I.b){const n=ip4Sz(b.len);if(b.k==='in')inn+=n;else if(b.out)out+=n;else own+=n;}
for(const b of s.biz)B+=ip4Need(b);
for(const c in s.pops){const p=s.pops[c];if(p.bb){const h=p.bb.d*IP4_BB;H+=h;if(p.bb.v6)H6+=h*p.bb.v6;}}
// Island Wi-Fi homes (46-wisp-zones.js) are IPv6-only from day one: their IPv4 shares the NAT64 pool.
for(const c in s.pops){const p=s.pops[c];if(p.bb){const h=p.bb.d*IP4_BB;H+=h;if(p.bb.v6)H6+=h*p.bb.v6;}if(p.wisp)for(const z in p.wisp){const h=p.wisp[z].d*IP4_BB;H+=h;H6+=h;}}
H=Math.ceil(H);H6=Math.min(H,Math.ceil(H6));const Hd=H-H6,T=own+inn,A=Math.max(0,T-B),p6=Math.ceil(H6/r6),min=Math.ceil(Hd/r),need=p6+min,A2=A-p6;let cg=0,over=0;
if(A2<Hd){if(A2>=min)cg=Math.min(Hd,Math.ceil((Hd-A2)*r/(r-1)));else{cg=Hd;over=need?1-A/need:0;}}
return {T,own,inn,out,B,H,H6,Hd,p6,cg,over,need,free:T-B-need,r,r6};}
@ -73,15 +75,17 @@ const ip4V4=(d=S.day)=>Math.max(IP4_V4_MIN,IP4_V4-IP4_V4_YR*Math.max(0,d)/365.24
function ip4Bill(eye,s=S){const u=ip4Use(s),v4=ip4V4();let lin=0,lout=0;for(const b of s.ip4.b){if(b.k==='in')lin+=b.mo||0;else if(b.out)lout+=b.mo||0;}
const cgS=u.H?u.cg/u.H:0,v6S=u.H?u.H6/u.H:0;
return {u,lin,lout,v4,box:u.cg/IP4_BB*v4*IP4_CGN,box64:u.H6/IP4_BB*v4*IP4_CGN,refund:eye*(cgS*IP4_ANNOY[u.r]+v6S*IP4_ANNOY64[u.r6]*v4/IP4_V4+u.over*IP4_SQZ)};}
// What homes pay a month (broadband and island Wi-Fi), which the refunds scale with: from computeMoney's V, or R.
const ip4Eye=(V=R&&R.rev)=>V?(V.eyeballs||0)+(V.wisp||0):0;
// computeMoney: only what is there, so a network with nothing to pay keeps its money rows as they were.
function ip4Money(C,V){if(!ip4On())return;const b=ip4Bill(V.eyeballs||0),c=Math.round(b.lin+b.box+b.box64+b.refund);if(c>0)C.ip4=c;if(b.lout>0)V.ip4=b.lout;}
function ip4Money(C,V){if(!ip4On())return;const b=ip4Bill(ip4Eye(V)),c=Math.round(b.lin+b.box+b.box64+b.refund);if(c>0)C.ip4=c;if(b.lout>0)V.ip4=b.lout;}
/* A new network gets its /21 from the RIR. An older save gets what it already uses registered to it and a quarter more to
grow into (about a month for a big, fast-growing network), rounded up to /24s in real CIDR blocks (a /21 at the
least), so nothing changes on load; those blocks move like any other two years on.
Their ids are fixed (rir0, rir1…), not uid(): a new game draws no id, so every id after it stays as it was. */
function ip4Grant(s){const d=s.day||0,b=[],add=len=>b.push({id:'rir'+b.length,len,k:'rir',d});let need=0;
for(const x of s.biz||[])need+=ip4Need(x);
for(const c in s.pops||{}){const p=s.pops[c];if(p&&p.bb&&p.bb.d>0)need+=p.bb.d*IP4_BB;}
for(const c in s.pops||{}){const p=s.pops[c];if(p&&p.bb&&p.bb.d>0)need+=p.bb.d*IP4_BB;if(p&&p.wisp&&typeof p.wisp==='object')for(const z in p.wisp)need+=Math.max(0,num(p.wisp[z]&&p.wisp[z].d,0))*IP4_BB;}
need=Math.max(ip4Sz(IP4_START),Math.ceil(need*1.25/256)*256);
while(need>=ip4Sz(IP4_MIN)&&b.length<200){add(IP4_MIN);need-=ip4Sz(IP4_MIN);}
for(let len=IP4_MIN+1;len<=IP4_MAX;len++)if(need>=ip4Sz(len)){add(len);need-=ip4Sz(len);}

View file

@ -56,7 +56,7 @@ function ip6Html(c){if(!ip4On())return '';const p=ip6Pop(c),b=p&&p.bb;if(!b)retu
if(b.v6e){const wait=ip6Slice(b,S.day+1)>Math.max(0,S.cash);
h+=`<div class="bar me"><i style="width:${Math.min(100,v*100)}%"></i></div><p class="note">${tr('ip6.swapping_home_routers_paid',{cost:fmt$(IP6_CPE),date:dateStr(b.v6e)})}</p>${wait?`<p class="why">${tr('ip6.waiting')}</p>`:''}<div class="btns">${btn(tr('ip6.stop'),'ip6Stop',{city:c},'ghost sm')}</div>`;}
else if(v>=1)h+=`<p class="note">${tr('ip6.new_homes_get_a_clat',{cost:fmt$(IP6_CPE),r})}</p>`;
else{const n=Math.ceil(ip6Homes(p)),cost=ip6Cost(c),f=Math.max(0,ip6Free(c)),mo=Math.round(ip6Mo(c,(R.rev&&R.rev.eyeballs)||0));
else{const n=Math.ceil(ip6Homes(p)),cost=ip6Cost(c),f=Math.max(0,ip6Free(c)),mo=Math.round(ip6Mo(c,ip4Eye()));
// Before the player commits: what the month costs after it too, and that it buys nothing yet while IPv4 still fits.
const bill=mo>0?tr('ip6.your_ipv4_bill_goes_up',{price:fmt$(mo)})+(ip4Use().cg?'':' '+tr('ip6.no_home_is_behind_cgnat')):mo<0?tr('ip6.your_ipv4_bill_goes_down',{price:fmt$(-mo)}):'';
h+=`<p class="note">${v>0?tr('ip6.part_note',{p:pct(v)}):tr('ip6.pitch',{r})} ${tr('ip6.what',{routers:trn('ip6.n_routers',n,{n:ip4N(n)}),days:ip6Days(c),addr:trn('ip4.n_addresses',f,{n:ip4N(f)})})} ${tr('ip6.homes_that_join_later',{cost:fmt$(IP6_CPE)})}${bill?' '+bill:''}</p>

View file

@ -105,7 +105,7 @@ function specDay(d){if(broker())brokerDay(d);if(S.seatOff&&S.seatOff.exp<=d)S.se
if(charter()==='boutique'&&!S.solWon&&solRoutes().length>=SOL_ROUTES&&solCust()>=SOL_CUST){S.solWon=Math.max(1,d);track('win_sol');toast(`<b>⚡ ${tr('specialist.speed_of_light')}</b><br>${tr('specialist.your_own_glass_beats_every_leased')}`,'goal');sfx('coin');checkBadges();}}
// Saves: the charter, demo orders, a seat on offer and the boutique's and the broker's wins. Old saves are Global
// backbone, picked; one still in its first month that never picked is asked again.
function specSanitize(s){s.charter=(s.charter==='boutique'||s.charter==='broker')&&s.mode==='normal'&&!s.scn?s.charter:'global';s.chartSet=s.chartSet===false&&s.day<=CHARTER_DAYS?false:true;
function specSanitize(s){s.charter=(s.charter==='boutique'||s.charter==='broker')&&s.mode==='normal'&&!s.scn?s.charter:'global';s.chartSet=s.chartSet===false&&s.day-(s.day0|0)<=CHARTER_DAYS?false:true;
const dm={};if(s.demo&&typeof s.demo==='object'&&!Array.isArray(s.demo))for(const key of Object.keys(s.demo).slice(0,64)){const [k,id]=key.split(':');if(demoItem(k,id)&&Number.isFinite(+s.demo[key]))dm[key]=Math.round(+s.demo[key]);}s.demo=dm;
const o=s.seatOff;s.seatOff=o&&typeof o==='object'&&typeof o.name==='string'&&seatRoute(o.name)&&seatRoute(o.name)[0]===o.a&&seatRoute(o.name)[1]===o.b?{a:o.a,b:o.b,name:o.name,km:seatKm(o.a,o.b),exp:num(o.exp,0)}:null;
s.solWon=Number.isFinite(+s.solWon)&&+s.solWon>0?Math.round(+s.solWon):0;s.baronWon=Number.isFinite(+s.baronWon)&&+s.baronWon>0?Math.round(+s.baronWon):0;

View file

@ -22,11 +22,11 @@ const baronOk=()=>cableConts()>=BARON_CONT&&capSalesMo()>=BARON_MO;
// On the goals tab, under the charter: how far Glass Baron is.
function baronCard(){if(S.baronWon)return `<div class="inc" style="background:var(--tint-g,#EAF7EE)"><div class="nm">🌊 ${tr('broker.glass_baron')}</div><div class="meta">${tr('broker.won_on_date',{date:dateStr(S.baronWon)})}</div></div>`;
return `<div class="inc" style="background:var(--tint-b,#E6F4FF)"><div class="nm">🌊 ${tr('broker.glass_baron')}</div><div class="meta">${tr('broker.progress',{c:Math.min(cableConts(),BARON_CONT),n:BARON_CONT,mo:fmt$(capSalesMo()),m:fmt$(BARON_MO)})}</div></div>`;}
function showBaronWin(){openModal(`<h1 style="font-family:var(--display);font-size:40px;margin:0">🌊 ${tr('broker.glass_baron')}</h1><p class="tagline">${tr('broker.win_text',{name:esc(S.name),asn:S.asn,days:S.day,n:BARON_CONT,mo:fmt$(capSalesMo())})}</p><div class="btns">${btn(tr('help.share_my_network'),'share',{},'pink')}${btn(tr('common.keep_playing'),'closeModal',{},'ghost')}</div>`);}
function showBaronWin(){openModal(`<h1 style="font-family:var(--display);font-size:40px;margin:0">🌊 ${tr('broker.glass_baron')}</h1><p class="tagline">${tr('broker.win_text',{name:esc(S.name),asn:S.asn,days:netAge(),n:BARON_CONT,mo:fmt$(capSalesMo())})}</p><div class="btns">${btn(tr('help.share_my_network'),'share',{},'pink')}${btn(tr('common.keep_playing'),'closeModal',{},'ghost')}</div>`);}
/* Carriers call the broker now and then (about three times a year, from day 60) with a capacity deal on a route the
capacity conferences trade: the same deals at the same terms, without the trip. Picked by a hash of the day, so a
broker's other dice roll as they would. */
function brokerDay(d){if(d<BROKER_CALL_FROM||S.scn||hstr(S.asn+'|capcall|'+d)%BROKER_CALL!==0)return;
function brokerDay(d){if(d-S.day0<BROKER_CALL_FROM||S.scn||hstr(S.asn+'|capcall|'+d)%BROKER_CALL!==0)return;
const pool=Object.values(CAP_ROUTES).flat().filter(r=>isCity(r[0])&&isCity(r[1])&&!S.offers.some(o=>o.city===r[0]&&o.city2===r[1]&&o.type===r[2]));if(!pool.length)return;
const [a,b,t]=pool[hstr(S.asn+'|caproute|'+d)%pool.length],T=BIZ_T[t];
const nm=()=>{const list=T.names.filter(n=>!S.usedNames.includes(n)),n=list.length?pick(list):pick(T.names);useName(n);return n;};

View file

@ -3,7 +3,7 @@ const TUT=[
{t:tr('tutorial.your_router_is_live_press_launch'),sel:'[data-act="launchBB"]',ok:()=>S.pops[S.home]&&S.pops[S.home].bb},
{t:tr('tutorial.your_customers_want_the_whole'),sel:'[data-act="tab"][data-args*=\'"up"\'],[data-act="buyTransit"]',ok:()=>S.transit.length>0,skip:()=>!NETS.some(n=>sellsAt(n,S.home))},
{t:tr('tutorial.transit_costs_money_per_gigabit'),sel:'[data-act="tab"][data-args*=\'"peer"\'],[data-act="buyIx"],[data-act="rs"]',ok:()=>Object.keys(S.rs).length>0,skip:()=>!ixName(S.home)},
{t:tr('tutorial.start_the_clock_with_1_and'),sel:'#sp1',ok:()=>S.day>=5},
{t:tr('tutorial.start_the_clock_with_1_and'),sel:'#sp1',ok:()=>netAge()>=5},
{t:tr('tutorial.grow_drag_from_your_pink_router'),sel:null,ok:()=>S.links.length>0},
{t:tr('tutorial.businesses_pop_up_as_bubbles_on'),sel:'[data-act="leftTab"][data-args*=\'"deals"\']',ok:()=>S.biz.length>0},
];

View file

@ -18,15 +18,18 @@ function trkWhy(c){const O=SAT_ORB.meo;if(lvl()<O.lv)return tr('satellites.orbit
if(!isCity(c)||!teleOf(c))return tr('satellites.no_teleport_in_city',{city:isCity(c)?CITY[c].name:'?'});
if(!teleSees(c).some(id=>SATS[id].orb==='meo'))return tr('satellites.meo_ring_misses_city',{city:CITY[c].name,lat:O.lat});
return '';}
// The birds that see both ends of a circuit: GEO first, then the cheapest.
function satBirds(a,b){return Object.keys(SATS).filter(id=>satPairOk(id,a,b)).sort((x,y)=>(SATS[x].orb>SATS[y].orb)-(SATS[x].orb<SATS[y].orb)||SAT_PROV[SATS[x].p].pg-SAT_PROV[SATS[y].p].pg);}
// The birds that see both ends of a circuit, by orbit (GEO, MEO, LEO: SAT_ORB's order), then the cheapest.
const SAT_ORD=Object.keys(SAT_ORB);
function satBirds(a,b){return Object.keys(SATS).filter(id=>satPairOk(id,a,b)).sort((x,y)=>SAT_ORD.indexOf(SATS[x].orb)-SAT_ORD.indexOf(SATS[y].orb)||SAT_PROV[SATS[x].p].pg-SAT_PROV[SATS[y].p].pg);}
// Why a circuit from teleport a to b over bird id (g Gbps, when given) cannot be ordered; '' when it can.
function satWhy(a,b,id,g){const B=own(SATS,id)?SATS[id]:null;if(!B||!isCity(a)||!isCity(b)||a===b)return tr('satellites.no_such_circuit');const O=SAT_ORB[B.orb];
if(lvl()<O.lv)return tr('satellites.orbit_unlocks_at_level',{orb:O.n,lv:O.lv});
if(!teleOf(a))return tr('satellites.no_teleport_in_city',{city:CITY[a].name});
if(B.orb==='meo'&&teleOf(a)<2)return tr('satellites.needs_tracking_antennas',{city:CITY[a].name});
if(B.orb==='leo'){if(!leoGw(a))return tr('satellites.needs_leo_gateway',{city:CITY[a].name});if(!satWired(a))return tr('satellites.leo_needs_fiber',{city:CITY[a].name});if(leoRival())return tr('satellites.leo_no_rivals',{prov:SAT_PROV[B.p].n});}
if(!satRemote(b))return tr('satellites.not_remote',{city:CITY[b].name});
if(!satPairOk(id,a,b))return tr('satellites.out_of_footprint',{bird:B.n,a:CITY[a].name,b:CITY[b].name});
if(!satPairOk(id,a,b))return B.orb==='leo'&&satSees(id,a)&&satSees(id,b)?tr('satellites.leo_out_of_reach',{prov:SAT_PROV[B.p].n,km:O.km.toLocaleString(),a:CITY[a].name,b:CITY[b].name,d:kmBetween(a,b).toLocaleString()})
:tr('satellites.out_of_footprint',{bird:B.n,a:CITY[a].name,b:CITY[b].name});
if(g!==undefined&&!O.g.includes(g))return tr('satellites.no_such_circuit');
const nt=noTalk(a,b);if(nt)return tr(nt);
if(!S.pops[b]){if(!cityOn(b))return popOffWhy(b);if(cnCity(b)&&!cnOk())return tr('pops_transit_ix.you_need_a_license_first_foreign');}
@ -40,16 +43,56 @@ const satFrom=b=>satRemote(b)?teleCities().filter(a=>a!==b&&satBirds(a,b).length
// it, as one ordered next to a link does, and the player hears about it. Without this the pair's load is shared with orbit.
function satBeside(a,b){const ls=pairLinks(a,b).filter(l=>l.kind==='sat'&&!l.standby);for(const l of ls)l.standby=true;
if(ls.length)toast(trn('satellites.n_circuits_go_on_standby',ls.length,{a:CITY[a].name,b:CITY[b].name}));return ls.length;}
/* An island or remote town that only satellites join to the rest of your network: its fastest circuit (null when a wave,
a lit fiber, a cable or a pie dish reaches it too). What is built and lit counts, never today's cuts: a selective peer
judges what you built, not this week's repair (50-peering-policy.js). A fiber or cable with no optics of its own yet
carries nothing (an express only passes through a city's ROADM, and is a link of its own where it ends). */
function satOnly(c){if(!satRemote(c)||!S.pops[c]||S.pie&&(S.pie.dishes||[]).some(x=>x.city===c))return null;let best=null;
/* A wired link that is built and lit: a wave, a lit fiber, a cable, a fabric circuit. What is built counts, never today's
cuts. A fiber or cable with no optics of its own yet carries nothing (an express only passes through a city's ROADM,
and is a link of its own where it ends). */
const wiredLink=l=>l.kind!=='sat'&&!(l.ready>S.day)&&(l.kind!=='df'||(l.ch||[]).length>0);
/* An island or remote town that only satellites join to the rest of your network: its fastest commissioned circuit, or
its fastest one being pointed when none is up yet (null when a wired link or a pie dish reaches it too). A selective
peer judges what you built, not this week's repair (50-peering-policy.js), and a circuit still being pointed does not
change its verdict while another is up. */
function satOnly(c){if(!satRemote(c)||!S.pops[c]||S.pie&&(S.pie.dishes||[]).some(x=>x.city===c))return null;let best=null,up=null;
for(const l of S.links){if(l.a!==c&&l.b!==c)continue;
if(l.kind!=='sat'){if(!(l.ready>S.day)&&(l.kind!=='df'||(l.ch||[]).length))return null;continue;}if(!best||satLat(l)<satLat(best))best=l;}
return best;}
// What the teleports and their circuits cost a month (R.cost.sat).
function satMoAll(){let m=0;for(const c in S.pops){const t=teleOf(c);if(t)m+=TPORT_MO+(t>1?TRK_MO:0);}for(const l of S.links)if(l.kind==='sat')m+=l.mo||0;return m;}
if(l.kind!=='sat'){if(wiredLink(l))return null;continue;}if(!best||satLat(l)<satLat(best))best=l;if(!(l.ready>S.day)&&(!up||satLat(l)<satLat(up)))up=l;}
return up||best;}
/* Whether the POP at c reaches the internet without another satellite: a mainland city always does; an island or remote
town with a lit wired link of yours, or a transit port (someone's cable). An exchange port or a PNI alone does not. */
function satWired(c){if(!own(S.pops,c))return false;if(!satRemote(c))return true;if(S.transit.some(t=>t.city===c))return true;
for(const l of S.links)if((l.a===c||l.b===c)&&wiredLink(l))return true;return false;}
// A Starblink gateway at the teleport in c (S.pops[c].leo).
const leoGw=c=>own(S.pops,c)&&S.pops[c].leo===1&&teleOf(c)>0;
// Your own constellation carries traffic (Pie in the Sky, at least 40% coverage, safe mode or not): Starblink sells a
// rival nothing new. Circuits already rented keep running.
const leoRival=()=>!!(S&&S.pie)&&Object.keys(CRUSTS).some(id=>pieCarry(id)>0);
// Why no LEO gateway can go up at c; '' when it can.
function leoGwWhy(c){const O=SAT_ORB.leo;if(!isCity(c)||!own(S.pops,c))return tr('satellites.no_pop_in_city',{city:isCity(c)?CITY[c].name:'?'});
if(lvl()<O.lv)return tr('satellites.orbit_unlocks_at_level',{orb:O.n,lv:O.lv});
if(!teleOf(c))return tr('satellites.no_teleport_in_city',{city:CITY[c].name});
if(Math.abs(CITY[c].lat)>O.lat)return tr('satellites.leo_shell_misses_city',{prov:SAT_PROV.sbk.n,city:CITY[c].name,lat:O.lat});
if(!satWired(c))return tr('satellites.leo_needs_fiber',{city:CITY[c].name});
if(leoRival())return tr('satellites.leo_no_rivals',{prov:SAT_PROV.sbk.n});
return '';}
// Why LEO circuit l cannot get bigger; '' when it can (shrinking always works).
function leoGrowWhy(l){const a=l.a;if(!leoGw(a))return tr('satellites.needs_leo_gateway',{city:CITY[a].name});
if(!satWired(a))return tr('satellites.leo_needs_fiber',{city:CITY[a].name});
if(leoRival())return tr('satellites.leo_no_rivals',{prov:SAT_PROV.sbk.n});return '';}
// A LEO circuit, and one a solar storm holds in safe mode (S.ev.sky: the day it passes).
const leoLink=l=>l.kind==='sat'&&own(SATS,l.bird)&&SATS[l.bird].orb==='leo';
const leoStorm=()=>S.ev.sky>S.day;
const leoDown=l=>leoStorm()&&leoLink(l);
// A storm can only find circuits in the sky: a commissioned LEO circuit, an island zone's too (failureRun, and Pie's own storms).
const leoLive=()=>S.links.some(l=>leoLink(l)&&!(l.ready>S.day))||wispLeoLive();
// A solar storm: Starblink puts its satellites in safe mode for 1 or 2 days (days: how many, when the caller knows).
function leoStormGo(days){S.ev.sky=S.day+(days||1+Math.floor(Math.random()*2));
addInc({type:'leostorm',ref:'sbk',until:S.ev.sky,msg:tr('satellites.leo_storm_msg',{prov:SAT_PROV.sbk.n}),cost:0});}
/* WISP hook: whether the gateway at city c may carry LEO to the point lat, lon (a zone, not a city id) today. It reads S
and changes nothing: a gateway on your fiber, your level, no flying constellation of yours, both ends under the shell
and at most SAT_ORB.leo.km apart. Pair it with leoKmLL/leoMsLL (10-catalog/75-satellites.js), satMo(LEO_BIRD,g) for
the rent, SAT_ORB.leo.loss for what users notice, and leoStorm() for the storm. */
function leoReachLL(c,lat,lon){const O=SAT_ORB.leo;if(!leoGw(c)||lvl()<O.lv||!satWired(c)||leoRival())return false;
if(Math.abs(CITY[c].lat)>O.lat||!(Math.abs(lat)<=O.lat))return false;return leoArcLL(c,lat,lon)*Math.PI/180*SAT_RE<=O.km;}
// What the teleports and their circuits cost a month (R.cost.sat), the island zones' circuits too.
function satMoAll(){let m=0;for(const c in S.pops){const t=teleOf(c);if(t)m+=TPORT_MO+(t>1?TRK_MO:0)+(S.pops[c].leo===1?LEO_GW_MO:0);}for(const l of S.links)if(l.kind==='sat')m+=l.mo||0;return m+wispSatMoAll();}
/* compute(): what users notice on the edges a satellite circuit is on. sv: the losses of the orbits there; sx: the edge's
latency is the satellite's (no cable carries ahead of it), so it is no haul to transit on the ground. Returns how many
edges there were, for compute() to know a satellite is in the picture at all. */
@ -72,10 +115,12 @@ function satAfter(SE,LATP,SATU){for(const e of SE){const ld=e.ld||0;if(!e.sa||ld
for(const [ci,x] of e.sa){let p=0;for(let j=0;j<v.length;j++)p+=sh[j]*x[1+j];LATP[ci]+=p;SATU[ci]+=all*x[0];}}}
// The share of city c's served traffic that rode a satellite in r (0 to 1).
const satShare=(r,c)=>r&&r.satU&&r.citySrv&&r.citySrv[c]>0?Math.min(1,(r.satU[c]||0)/r.citySrv[c]):0;
// Saves: a teleport is 1 or 2; a circuit needs a known bird that sees both POPs, a teleport able to work it, a size it sells.
// Saves: a teleport is 1 or 2, a LEO gateway 1 on a teleport; a circuit needs a known bird that sees both POPs, a teleport
// able to work it (MEO: tracking antennas; LEO: the gateway), a size it sells. The storm's day stays a key once it is one.
function satSanitize(s){
for(const c of Object.keys(s.pops)){const p=s.pops[c];if(p.tele!==undefined&&p.tele!==1&&p.tele!==2)delete p.tele;}
for(const c of Object.keys(s.pops)){const p=s.pops[c];if(p.tele!==undefined&&p.tele!==1&&p.tele!==2)delete p.tele;if(p.leo!==undefined&&(p.leo!==1||!p.tele))delete p.leo;}
if(s.ev&&s.ev.sky!==undefined)s.ev.sky=int(s.ev.sky,0,s.day+LEO_STORM_MAX,0);
s.links=s.links.filter(l=>{if(l.kind!=='sat')return true;const B=typeof l.bird==='string'&&own(SATS,l.bird)?SATS[l.bird]:null,p=s.pops[l.a];
if(!B||!p||!p.tele||B.orb==='meo'&&p.tele<2||!s.pops[l.b]||!satPairOk(l.bird,l.a,l.b))return false;
if(!B||!p||!p.tele||B.orb==='meo'&&p.tele<2||B.orb==='leo'&&p.leo!==1||!s.pops[l.b]||!satPairOk(l.bird,l.a,l.b))return false;
const G=SAT_ORB[B.orb].g;if(!G.includes(l.g))l.g=G.reduce((x,v)=>v<=num(l.g,0)?v:x,G[0]);
l.km=satKm(l.bird,l.a,l.b);l.sub=true;l.ready=num(l.ready,0);l.day=Math.min(s.day,Math.max(0,num(l.day,s.day)));for(const k of ['tier','cable','trench','mult','border','premium','vt','prov','own','sys','ch'])delete l[k];return true;});}

View file

@ -0,0 +1,112 @@
/* ---------- Island Wi-Fi (#83): the outer islands, served from a POP in the city they look to ----------
A zone (WISP, 10-catalog/76-wisp-zones.js) is a pool of island homes hanging off your POP in its city: no node and no
link on the map. Its backhaul lands in that city: satellite capacity from the teleport there (GEO, then MEO with
tracking antennas, then Starblink LEO from a gateway there) or a spur cable laid from it. What reaches the islands
caps how many sign up (SAT_ORB[orb].wisp; all of them over a cable). Their Gbps join the city's demand (compute()), so
they ride its routers, links and transit, and they are IPv6-only homes in your NAT64 pool from day one. A spur can be
cut (failure 'wspur', a weeks-long repair): a satellite circuit kept beside it carries the islands meanwhile.
State: S.pops[c].wisp[z]={day, d: Gbps of homes signed up, sat?, nxt?: a move being commissioned, sp?: the spur};
a cut is only ever an incident. Actions: 90-actions/87-wisp-zones.js; panels: 93-ui/73-wisp-panels.js. */
// Normal and sandbox games from the level teleports come at; never puzzles, the Architect or scenarios (weekly too).
const wispOn=()=>!!S&&!pzOn()&&!S.ar&&!S.scn&&(S.mode==='normal'||S.mode==='sandbox')&&lvl()>=SAT_ORB.geo.lv;
// The zones of city c, and zone z's state (null without it).
const WISP_AT=(()=>{const m={};for(const z of Object.keys(WISP))(m[WISP[z].c]||(m[WISP[z].c]=[])).push(z);return m;})();
const wispAt=c=>own(WISP_AT,c)?WISP_AT[c]:[];
function wispZ(z){if(!own(WISP,z))return null;const c=WISP[z].c,W=own(S.pops,c)&&S.pops[c].wisp;return W&&own(W,z)?W[z]:null;}
// Every zone you run: [z, its state].
function wispAll(){const o=[];for(const c in S.pops){const W=S.pops[c].wisp;if(W)for(const z in W)o.push([z,W[z]]);}return o;}
const wispPool=z=>WISP[z].P*eraMul();
const wispRate=z=>EYE_RATE*arpuOf(WISP[z].c)*WISP_ARPU;
const wispStart=z=>wispPool(z)*WISP_START;
const wispOrb=o=>SATS[o.bird].orb;
// Lit (cut or not); and a lit spur a cut holds down, until that day (0: none).
const wispLit=Z=>!!Z.sp&&!(Z.sp.ready>S.day);
function wispCut(z){let u=0;for(const i of S.inc)if(i.type==='wspur'&&i.z===z&&i.until>S.day)u=Math.max(u,i.until);return u;}
// How many islanders may sign up over what reaches them (a cut lasts weeks; they wait for it), and how many that is.
const wispTake=Z=>wispLit(Z)?1:Z.sat&&!(Z.sat.ready>S.day)?SAT_ORB[wispOrb(Z.sat)].wisp:0;
const wispK=(z,Z)=>wispPool(z)*wispTake(Z);
// What carries the islands today: the spur, unless it is cut; else the circuit, unless a solar storm holds LEO in safe mode.
function wispLink(z,Z){if(wispLit(Z)&&!wispCut(z))return {g:WISP_SPUR_G,sp:true};const o=Z.sat;
return o&&!(o.ready>S.day)&&!(leoStorm()&&wispOrb(o)==='leo')?o:null;}
// Prices: a contended share of a beam, the island kit with the first order, its upkeep, the spur at today's prices.
const wispSatMo=(bird,g)=>Math.round(satMo(bird,g)*WISP_SHARE/10)*10;
const wispKit=z=>WISP_KIT+WISP_KIT_G*WISP[z].P;
const wispUpMo=z=>WISP_MO+WISP_MO_G*WISP[z].P;
const wispSpurCost=z=>Math.round((WISP_SPUR+WISP_SPUR_KM*WISP[z].km)*hwMul('build')/1000)*1000;
const wispSpurMo=z=>Math.round(WISP_SPUR_MO+WISP_SPUR_MO_KM*WISP[z].km);
const wispSpurDays=z=>leadDays(Math.round(WISP_SPUR_D0+WISP_SPUR_DKM*WISP[z].km));
// The birds that see both the city and the zone, by orbit (GEO, MEO, LEO), then the cheapest (as satBirds).
function wispBirds(z){const W=WISP[z],C=CITY[W.c];return Object.keys(SATS).filter(id=>satPairAt(id,C,W)).sort((x,y)=>SAT_ORD.indexOf(SATS[x].orb)-SAT_ORD.indexOf(SATS[y].orb)||SAT_PROV[SATS[x].p].pg-SAT_PROV[SATS[y].p].pg);}
// One way over bird id from the city to the zone, in ms (LEO: Starblink's own bent pipe, leoMsLL).
function wispMs(z,id){const W=WISP[z];return SATS[id].orb==='leo'?leoMsLL(W.c,W.lat,W.lon):satKmAt(id,CITY[W.c],W)/SAT_C+SAT_ORB[SATS[id].orb].proc;}
/* Why zone z cannot take a circuit on bird id (g Gbps, when given); '' when it can. Its capacity comes down at the teleport
in the zone's own city: tracking antennas for MEO, a Starblink gateway on your fiber for LEO (and none once your own
constellation carries traffic, leoReachLL: said first, with what the islands have left, as a zone takes no pie dish).
One circuit and one move at a time. */
function wispSatWhy(z,id,g){if(!own(WISP,z))return tr('satellites.no_such_circuit');const W=WISP[z],c=W.c,C=CITY[c].name;
if(lvl()<SAT_ORB.geo.lv)return tr('satellites.teleports_unlock_at_level',{lv:SAT_ORB.geo.lv});
const B=own(SATS,id)?SATS[id]:null;if(!B||!wispOn())return tr('satellites.no_such_circuit');const O=SAT_ORB[B.orb];
if(!own(S.pops,c))return tr('wisp.why_no_pop',{city:C});
if(lvl()<O.lv)return tr('satellites.orbit_unlocks_at_level',{orb:O.n,lv:O.lv});
if(!teleOf(c))return tr('satellites.no_teleport_in_city',{city:C});
const far=tr('satellites.out_of_footprint',{bird:B.n,a:C,b:W.n});if(!satPairAt(id,CITY[c],W))return far;
if(B.orb==='meo'&&teleOf(c)<2)return tr('satellites.needs_tracking_antennas',{city:C});
if(B.orb==='leo'){if(leoRival())return tr('wisp.leo_no_rivals',{prov:SAT_PROV[B.p].n});if(!leoGw(c))return tr('satellites.needs_leo_gateway',{city:C});if(!satWired(c))return tr('satellites.leo_needs_fiber',{city:C});
if(!leoReachLL(c,W.lat,W.lon))return far;}
if(g!==undefined&&!O.g.includes(g))return tr('satellites.no_such_circuit');
const Z=wispZ(z);if(Z&&Z.nxt)return tr('wisp.why_moving');if(Z&&Z.sat&&Z.sat.bird===id)return tr('wisp.why_same',{bird:B.n});
return '';}
// Why zone z cannot get a spur; '' when it can.
function wispSpurWhy(z){if(!own(WISP,z)||!wispOn())return tr('satellites.no_such_circuit');const W=WISP[z];
if(!own(S.pops,W.c))return tr('wisp.why_no_pop',{city:CITY[W.c].name});
if(!W.km)return tr('wisp.spur_none');if(lvl()<WISP_SPUR_LV)return tr('wisp.spur_level',{lv:WISP_SPUR_LV});
const Z=wispZ(z);if(Z&&Z.sp)return tr('wisp.why_spur_have');return '';}
// The zones whose circuits (running or being commissioned) start at the teleport in c; orb: only that orbit's.
const wispSats=(c,orb)=>wispAt(c).filter(z=>{const Z=wispZ(z);return !!Z&&[Z.sat,Z.nxt].some(o=>o&&(!orb||wispOrb(o)===orb));});
// The lit spurs no cut holds down: what a failure can find.
const wispSpurs=()=>wispAll().filter(([z,Z])=>wispLit(Z)&&!wispCut(z)).map(([z])=>z);
// A commissioned LEO circuit for a zone: a solar storm can find it too (leoLive).
const wispLeoLive=()=>!!S&&wispOn()&&wispAll().some(([,Z])=>!!Z.sat&&!(Z.sat.ready>S.day)&&wispOrb(Z.sat)==='leo');
/* compute(): each zone's homes (Gbps, with the day's viral factor) and what reaches them, added to its city's demand.
null when you run none. by: Gbps carried, by city; L: [{z, c, zd: wanted, car: carried}]. */
function wispIn(viral){let L=null;const by={};
for(const [z,Z] of wispAll()){const c=WISP[z].c,k=wispLink(z,Z),zd=Z.d*viral,car=k?Math.min(zd,k.g):0;(L||(L=[])).push({z,c,zd,car});if(car>0)by[c]=(by[c]||0)+car;}
return L?{by,L}:null;}
/* computeMoney(): what the islanders pay for what reached them, served as well as their city (sfOf), and the towers and
lit spurs' upkeep. R.wisp[z]: d wanted, car carried, sf served, k the take-up cap today. Circuit rent is the
satellite row (satMoAll). */
function wispMoney(R2,C,V){const L=R2.wispL;if(!L)return;let v=0,up=0;
for(const x of L){const Z=wispZ(x.z),sf=x.zd>0?sfOf(R2,x.c)*x.car/x.zd:0;R2.wisp[x.z]={d:x.zd,car:x.car,sf,k:wispK(x.z,Z)};v+=x.zd*sf*wispRate(x.z);
up+=wispUpMo(x.z)+(wispLit(Z)?wispSpurMo(x.z):0);}
V.wisp=v;if(up>0)C.wisp=up;}
// The rent of the zones' circuits, from the order on (satMoAll).
const wispSatMoAll=()=>wispAll().reduce((a,[,Z])=>a+(Z.sat?Z.sat.mo||0:0)+(Z.nxt?Z.nxt.mo||0:0),0);
/* The day's take-up, after broadband's (10-day-tick.js), on the last routing: served well, more islanders sign up toward
the cap; served badly, they leave down to the floor; above a cap that dropped, they drift down to it. */
function wispGrow(){if(!wispOn())return;for(const [z,Z] of wispAll()){const r=R&&R.wisp&&R.wisp[z],sf=r?r.sf:0,K=wispK(z,Z),fl=wispStart(z);
if(sf<0.9)Z.d=Math.max(fl,Z.d*(1-(0.9-sf)*0.04));else if(Z.d<K)Z.d+=WISP_GROW*sf*Z.d*(1-Z.d/K);else if(Z.d>K)Z.d-=(Z.d-K)*0.01;}}
// The day's news: a move done, the first islanders online, a spur lit.
function wispDay(d){if(!wispOn())return;for(const [z,Z] of wispAll()){const zone=esc(WISP[z].n),go=[{l:tr('common.open'),act:'wispOpen',args:{z}}];
const mv=!!Z.nxt&&!(Z.nxt.ready>d);if(mv){Z.sat=Z.nxt;delete Z.nxt;toast(tr('wisp.moved',{zone,bird:esc(SATS[Z.sat.bird].n)}),'good',go);}
else if(Z.sat&&Z.sat.ready===d&&!(Z.sp&&Z.sp.ready<d))toast(tr('wisp.online',{zone}),'good',go);
if(Z.sp&&Z.sp.ready===d){toast(tr('wisp.spur_ready',{zone}),'goal',go);sfx('coin');}}}
/* Saves: a zone sits at its own city's POP, a circuit on a bird that sees both ends from a teleport able to work it (MEO:
tracking antennas; LEO: a Starblink gateway), at a size its orbit sells; a spur only where one can be laid. Runs after
satSanitize (the teleports first), and repairs in place, so live state is what a reload makes of it. */
function wispSanitize(s){
for(const c of Object.keys(s.pops)){const p=s.pops[c];if(p.wisp===undefined)continue;
if(!p.wisp||typeof p.wisp!=='object'||Array.isArray(p.wisp)){delete p.wisp;continue;}
for(const z of Object.keys(p.wisp)){const Z=p.wisp[z];if(!own(WISP,z)||WISP[z].c!==c||!Z||typeof Z!=='object'||Array.isArray(Z)){delete p.wisp[z];continue;}const W=WISP[z];
Z.day=int(Z.day,0,s.day,s.day);Z.d=Math.min(W.P*20,Math.max(0,num(Z.d,0)));
const ok=o=>{const B=o&&typeof o==='object'&&typeof o.bird==='string'&&own(SATS,o.bird)?SATS[o.bird]:null;
if(!B||!p.tele||B.orb==='meo'&&p.tele<2||B.orb==='leo'&&p.leo!==1||!satPairAt(o.bird,CITY[c],W))return false;
const G=SAT_ORB[B.orb].g;if(!G.includes(o.g))o.g=G.reduce((x,v)=>v<=num(o.g,0)?v:x,G[0]);
o.mo=Math.max(0,Math.round(num(o.mo,0)));o.day=int(o.day,0,s.day,s.day);o.ready=int(o.ready,0,1e7,o.day);return true;};
for(const k of ['sat','nxt'])if(Z[k]!==undefined&&!ok(Z[k]))delete Z[k];
if(Z.nxt&&!Z.sat){Z.sat=Z.nxt;delete Z.nxt;}
if(Z.sp!==undefined){const o=Z.sp;if(!W.km||!o||typeof o!=='object')delete Z.sp;else{o.day=int(o.day,0,s.day,s.day);o.ready=int(o.ready,o.day,o.day+3650,o.day);}}}
if(!Object.keys(p.wisp).length)delete p.wisp;}
// A cut holds down a spur that is there, at the zone's own city.
s.inc=s.inc.filter(i=>i.type!=='wspur'||typeof i.z==='string'&&own(WISP,i.z)&&i.ref===WISP[i.z].c&&!!(s.pops[i.ref]&&s.pops[i.ref].wisp&&own(s.pops[i.ref].wisp,i.z)&&s.pops[i.ref].wisp[i.z].sp));}
// An incident for a zone that is gone (closed, or its POP decommissioned): purgeInc() drops it.
const wispIncOk=i=>typeof i.z==='string'&&own(WISP,i.z)&&!!wispZ(i.z)&&!!wispZ(i.z).sp;

View file

@ -1,7 +1,7 @@
// Every field a reload gives a game is here from the start (sanitize() would add the rest), so a new game is what a
// reload makes of it: a server checks every action against that (tests/canonical-state.test.js).
function newGame(name,home){
S={v:1,name,asn:200000+Math.floor(_rand()*15000),home,day:0,cash:START_CASH,
S={v:1,name,asn:200000+Math.floor(_rand()*15000),home,day:0,day0:0,cash:START_CASH,
ltv:2,t1v:4,auV:1,calV:1,pieV:1,pie:null,ip4:ip4New(),ops:opsNew(),slAuto:slAutoNew(),achP:{},seen:NETS.map(n=>n.id),spares:{},pops:{[home]:{day:0,bb:null,boost:0,down:0,routers:1,gen:false,rgen:0}},links:[],nni:[],transit:[],ixp:{},rs:{},peers:{},pni:[],caches:[],biz:[],offers:[],myIx:{},pairMet:{},
done:{},inc:[],fleet:{},ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},vol:0,cnLic:{state:'none'},scrubs:[],scrubMode:'always',ddosAuto:{rtbh:false,scrub:true},capDeal:null,core:{lv:0,run:0},popStd:null,popTiers:ptNew(),won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,ppol:'open',pdesk:null,pdeskRep:null,hw:{},rules:makeRules('oncall'),charter:'global',cm:cmNew(),chartSet:false,demo:{},seatOff:null,solWon:0,monkey:{next:null,on:0},mp:null,
lvl:1,hist:[],ach:{},ixn:{},ixPref:{},ixSite:{},confReg:{},cl:{odd:-1e9,mo:[]},sales:{p:null,hired:0,vp:null,golf:null,say:null},baronWon:0};

View file

@ -0,0 +1,27 @@
/* ---------- Late joiners (server sessions, docs/plans/server-run.md "What Q1 changes") ----------
A network that joins a session after its market started moving starts on the session's date (S.day0), with its
first-days rules counted from there (netAge()), a top-up as large as the rise in hardware prices, and its first year
of home broadband income matched: what its homes pay after any wholesale cut, outside investors' share (they funded
the business, not a subsidy). Only S.day0 is stored; being late, the year and the top-up follow from it. The market
and the calendar stay on the session's date: one market for everyone (gameplay rule F11). */
// Until day 180 the shared market has not moved (HW_FREE, MK_FREE, IP4_FREE): a joiner then gets nothing extra.
const LATE_FROM=180,LATE_DAYS=365;
const lateIs=()=>!!S&&(S.day0|0)>LATE_FROM;
const lateOn=()=>lateIs()&&S.day<=S.day0+LATE_DAYS;
const lateLeft=()=>lateIs()?Math.max(0,S.day0+LATE_DAYS-S.day):0;
// The top-up buys what START_CASH bought on day 0 (hardware only: customer prices are what the match makes up for).
const lateCash=d=>d>LATE_FROM&&rule('market')?Math.round(START_CASH*(hwTrend(d)-1)/1000)*1000:0;
// beginState's last step: the network begins on day D, its schedules and its first block stamped with that day (a block
// stamped 0 could be sold on the first day at the session's price).
function lateStart(D){S.day=S.day0=D;S.nextFail+=D;S.nextEvent+=D;S.pops[S.home].day=D;for(const b of S.ip4.b)b.d=D;S.cash+=lateCash(D);}
// computeMoney: the match, once more what homes pay after the Australian wholesale cut or levy.
function lateMoney(V,C){if(!lateOn())return;const v=V.eyeballs-(C.wholesale||0)-(C.levy||0);if(v>0)V.late=v;}
function lateHello(){const n=S.day0,g=lateCash(n),t=hwTrend(n)-1;
toast(g>0?tr('late.hello',{n,p:pct(t),cash:fmt$(g)}):tr('late.hello_flat',{n}),'goal',[{l:tr('common.bank'),act:'bank',args:{}}]);}
function lateDay(d){if(lateIs()&&d===S.day0+LATE_DAYS+1)toast(tr('late.over'),'');}
function lateCard(){const n=lateLeft();if(!n)return '';
return `<div class="inc" style="background:var(--tint-g,#EAF7EE)"><div class="nm">🎟️ ${tr('late.title')}</div><div class="meta">${trn('late.card',n,{price:fmt$((R&&R.rev&&R.rev.late)||0)})}</div></div>`;}
function lateBank(){if(!lateLeft())return '';const g=lateCash(S.day0),kv=(l,v)=>`<div class="kv"><span>${l}</span><b>${v}</b></div>`;
return `<section class="bank-gov"><h3 style="font-size:18px;margin-top:14px">🎟️ ${tr('late.title')}</h3><div class="ops-o">${g>0?kv(tr('late.top_up'),fmt$(g)):''}`
+kv(tr('late.match'),tr('late.until',{date:dateStr(S.day0+LATE_DAYS)}))+kv(tr('late.this_month'),tr('common.price_mo',{price:fmt$((R&&R.rev&&R.rev.late)||0)}))
+`<p class="meta">${tr('late.bank_note')}</p></div></section>`;}

View file

@ -110,7 +110,7 @@ function bstdPlan(intern){const J=[];J.held=[];J.wv=[];if(!S||!S.popStd||pzOn())
// the floor for every job after it.
// mo: what it does to the month's IPv4 bill, counted one city after another on a copy, so the sum is all of them done.
if(D.v6&&ip4On()){const v6=cs.filter(ip6Todo).sort((a,b)=>ip6Homes(S.pops[b])-ip6Homes(S.pops[a])||(a<b?-1:1));
const eye=(R.rev&&R.rev.eyeballs)||0,m=b=>b.box+b.box64+b.refund,s={ip4:S.ip4,biz:S.biz,pops:{...S.pops}};let b0=v6.length?m(ip4Bill(eye,s)):0;
const eye=ip4Eye(),m=b=>b.box+b.box64+b.refund,s={ip4:S.ip4,biz:S.biz,pops:{...S.pops}};let b0=v6.length?m(ip4Bill(eye,s)):0;
for(const c of v6){const p=S.pops[c];s.pops[c]={...p,bb:{...p.bb,v6:1}};const b1=m(ip4Bill(eye,s)),mo=b1-b0;b0=b1;
job('pop','v6','6:'+c,c+' IPv6',ip6Cost(c),mo,()=>{if(!ip6Todo(c))return false;ACT.ip6Go({city:c});return !!S.pops[c].bb.v6e;},{c,later:true,price:()=>ip6Cost(c)});}}
// Ports: LAG members up to the standard, then the members split over both buildings.

View file

@ -22,6 +22,8 @@ const monthIdx=d=>{const c=cal(d);return (c.y-1)*12+c.m;},monLen=d=>{const c=cal
// A monthly date that started on day s: the same day of the month, or the month's last day when it is shorter.
const monthiversary=(s,d)=>{if(d<=s)return false;const a=cal(s),b=cal(d);return b.d===Math.min(a.d,monDays(b.y,b.m));};
function dateStr(d){const c=cal(d);return tr('helpers.y_y_mon_d',{y:c.y,mon:MONTHS[c.m],d:c.d});}
// The network's age in days: S.day is the calendar (a server session's, shared), S.day0 the day this network began.
const netAge=()=>S?S.day-(S.day0|0):0;
function wrapDx(a,b){let dx=b-a;if(dx>W/2)dx-=W;if(dx<-W/2)dx+=W;return dx;}
function kmBetween(a,b){const A=CITY[a],B=CITY[b];return Math.max(20,Math.round(hav(A.lon,A.lat,B.lon,B.lat)));}
// Cities on a land bridge belong to two landmasses: Cairo reaches Asia overland across the Sinai, the way

View file

@ -3,7 +3,7 @@
const SOLD_WIN=90,SOLD_WHY=[N_('sold_out.a_hyperscaler_bought_every_wave_of'),N_('sold_out.the_carrier_is_out_of_spectrum'),N_('sold_out.the_transponders_for_this_route_are'),N_('sold_out.the_capacity_is_available_in_the'),N_('sold_out.their_capacity_planner_is_on_holiday'),N_('sold_out.the_upgrade_is_planned_for_q3')];
const soldP=tier=>Math.min(0.1,0.02+0.012*tier);
// Never in the first 90 days: a new network has enough on its plate. Never in the tutorial or a scenario's first quarter either.
function soldOut(a,b,tier,via){if(!S||S.day<SOLD_WIN||S.tut||!rule('market'))return null;const k=(a<b?a+b:b+a)+'|'+(via||'')+'|'+tier,off=hstr(k)%SOLD_WIN,ep=Math.floor((S.day+off)/SOLD_WIN),h=hstr(S.asn+'|'+k+'|'+ep);
function soldOut(a,b,tier,via){if(!S||netAge()<SOLD_WIN||S.tut||!rule('market'))return null;const k=(a<b?a+b:b+a)+'|'+(via||'')+'|'+tier,off=hstr(k)%SOLD_WIN,ep=Math.floor((S.day+off)/SOLD_WIN),h=hstr(S.asn+'|'+k+'|'+ep);
if(h%1000>=soldP(tier)*1000)return null;return {why:SOLD_WHY[(h>>>10)%SOLD_WHY.length],until:(ep+1)*SOLD_WIN-off};}
function snubWhy(sn){const d=Math.max(1,sn.until-S.day);return sn.why+' '+trn('sold_out.they_will_reconsider_in_n_day',d);}
// Paid-peering giants drop the fee for networks too big to ignore (freeLv: the customer level that does it).

View file

@ -99,8 +99,12 @@ function compute(){RW.gen++;
const bizBw={};for(const b of S.biz){const T=BIZ_T[b.type];if(!T.l2&&!T.fiber&&(!T.event||eventLive(b))){if(T.orbit){const g=PX&&PX.gs[b.id];if(g)bizBw[g]=(bizBw[g]||0)+PX.term[b.id];continue;}const v=bizBw[b.city];bizBw[b.city]=(v===undefined?0:v)+b.bw;}}
// Traffic shares by network index, and their sums, for each share table (and with Russia's throttle).
const shArr=new Map(),shSum=new Map(),DEMTO=new Float64Array(NN),loc=scnRule('local');
// Island Wi-Fi (46-wisp-zones.js): a zone's homes are its city's demand, as far as its backhaul reaches them. Its
// fields are only in R while you run a zone, so every other game routes to the same R as before.
const WZI=wispOn()?wispIn(viral):null;if(WZI){R2.wispL=WZI.L;R2.cityWisp={};R2.wisp={};}
(()=>{for(const c of Object.keys(S.pops)){
const p=S.pops[c],ci=CIDX[c],cn=cnCity(c),SH=cn?NSH_CN:ruCity(c)?NSH_RU:CITY[c].kr&&S.krExit?NSH_KRX:NSH;const eye=(p.bb?p.bb.d:0)*viral*(cn&&ev.golden>day?1.4:1);const biz=bizBw[c]??0;const d0=eye+biz;
const p=S.pops[c],ci=CIDX[c],cn=cnCity(c),SH=cn?NSH_CN:ruCity(c)?NSH_RU:CITY[c].kr&&S.krExit?NSH_KRX:NSH;const eye=(p.bb?p.bb.d:0)*viral*(cn&&ev.golden>day?1.4:1);const biz=bizBw[c]??0;
const wz=WZI?WZI.by[c]||0:0;if(wz)R2.cityWisp[c]=wz;const d0=eye+wz+biz;
// Goggle video is throttled in Russia (#70): people there get half of it, so they ask for half. It is not
// traffic you failed to deliver, and it does not cross your links only to be thrown away.
const ru=ruCity(c),thr=n=>n==='ggl'&&ru?0.5:1;let sa=shArr.get(SH),sm=shSum.get(SH);if(!sa){shArr.set(SH,sa=NETS.map(n=>SH[n.id]||0));shSum.set(SH,sm=[]);}
@ -266,11 +270,16 @@ function computeMoney(R2,PX=null){
C.wholesale=0;C.levy=0;const lev=scnRule('levy');for(const c in S.pops){const sf=sfOf(R2,c)*(R2.bbF[c]??1),v=R2.cityEye[c]*sf*EYE_RATE*arpuOf(c);V.eyeballs+=v;if(CITY[c].au){if(lev)C.levy+=v*AU_LEVY;else C.wholesale+=v*AU_WHOLESALE;}}
const ids=linkIds();for(const b of S.biz){if(capPend(b)||BIZ_T[b.type].orbit)continue;const sf=BIZ_T[b.type].fiber?(fiberOk(b,ids)?1:0):BIZ_T[b.type].l2?clamp((R2.l2[b.id]||0)/b.bw,0,1):sfOf(R2,b.city)*(R2.tgtF[b.id]??1);V.business+=b.bw*b.rate*Math.min(1,sf/0.95);}
for(const c in S.myIx)V.ix+=S.myIx[c].members.length*MYIX_FEE;
wispMoney(R2,C,V);
ip4Money(C,V);
if(PX)pieMoney(PX,R2,V);
// The UK grant for Pitcairn, its satellite tier once orbit is known; the Rural Digital Pie Fund (99-pie-subsidies.js).
{const on=grantOn(R2),sky=!on&&!!PX&&grantSky(R2);V.grant=on?GRANT_MO:sky?GRANT_SKY_MO:0;if(PX)V.gov=pieGovMo();if(PX)R2.pie.gov={rdf:V.gov||0,sky:sky?GRANT_SKY_MO:0};}
C.revshare=(S.loans||[]).reduce((a,l)=>a+(BANKS[l.bank].equity||l.bal>0?l.share||0:0),0)*(V.eyeballs+V.business+V.ix+(V.orbit||0));
// A late joiner's first year: home broadband matched (81-late-joiners.js), outside the investors' share like a grant.
lateMoney(V,C);
// Investors take their share of what customers and tenants pay (an IPv4 block leased out too, as a leased fiber pair),
// not of grants or one-off sales.
C.revshare=(S.loans||[]).reduce((a,l)=>a+(BANKS[l.bank].equity||l.bal>0?l.share||0:0),0)*(V.eyeballs+V.business+V.ix+(V.orbit||0)+(V.ip4||0)+(V.wisp||0));
R2.costMo=Object.values(C).reduce((a,b)=>a+b,0);
R2.revMo=V.eyeballs+V.business+V.ix+V.grant+(V.gov||0)+(V.orbit||0)+(V.ip4||0);
R2.revMo=V.eyeballs+V.business+V.ix+V.grant+(V.gov||0)+(V.orbit||0)+(V.ip4||0)+(V.wisp||0)+(V.late||0);
}

View file

@ -7,7 +7,7 @@ const gulfPair=(a,b)=>!!((CITY[a].qa&&(CITY[b].gcc||CITY[b].uae))||(CITY[b].qa&&
const borderShut=l=>S.ev.runet>S.day&&ruCity(l.a)!==ruCity(l.b)?'runet':S.ev.gulf>S.day&&gulfPair(l.a,l.b)?'gulf':'';
// Cut, or cut off by an event between its two countries, whatever runs on it (an express asks this of each fiber it rides).
function linkCut(l){return l.cut>S.day||!!borderShut(l);}
function linkDown(l){return linkCut(l)||(l.kind==='vxc'&&!!S.ev.fab&&S.ev.fab[l.prov]>S.day)||(l.kind==='df'&&!dfOn(l))||(l.kind==='xp'&&xpDown(l))||(l.kind==='sat'&&l.ready>S.day);}
function linkDown(l){return linkCut(l)||(l.kind==='vxc'&&!!S.ev.fab&&S.ev.fab[l.prov]>S.day)||(l.kind==='df'&&!dfOn(l))||(l.kind==='xp'&&xpDown(l))||(l.kind==='sat'&&(l.ready>S.day||leoDown(l)));}
function remoteCities(){return [...new Set(S.links.filter(l=>l.kind==='vxc').flatMap(l=>[l.a,l.b]))].filter(c=>!S.pops[c]);}
function nniUsed(c,prov){return S.links.filter(l=>l.kind==='vxc'&&l.prov===prov&&(l.a===c||l.b===c)).reduce((a,l)=>a+VXC[l.vt].g,0)+S.biz.filter(b=>BIZ_T[b.type].nni&&b.prov===prov&&b.city===c).reduce((a,b)=>a+b.bw,0);}
// Monthly price of one connection; compute() sums these, the connections overview lists them.

View file

@ -9,7 +9,7 @@ function sanitize(s){
const arr=k=>{if(!Array.isArray(s[k]))s[k]=[];},obj=k=>{if(!s[k]||typeof s[k]!=='object'||Array.isArray(s[k]))s[k]={};};
['links','nni','transit','pni','caches','biz','offers','inc','usedNames','loans','loanOffers','hist','log'].forEach(arr);
['pops','ixp','rs','peers','myIx','done','ev','stats','ixn','ixPref','ixSite','confReg','ach','pairMet'].forEach(obj);
s.v=1;s.name=String(s.name==null?'Packet Pals':s.name).slice(0,24);s.day=int(s.day,0,1e7,0);s.cash=num(s.cash,0);s.asn=int(s.asn,1,4294967294,200000);
s.v=1;s.name=String(s.name==null?'Packet Pals':s.name).slice(0,24);s.day=int(s.day,0,1e7,0);s.day0=int(s.day0,0,s.day,0);s.cash=num(s.cash,0);s.asn=int(s.asn,1,4294967294,200000);
s.priceMul=num(s.priceMul,1);s.nextFail=num(s.nextFail,s.day+45);s.nextEvent=num(s.nextEvent,s.day+40);s.lvl=int(s.lvl,1,LEVELS.length,1);s.neg=int(s.neg,0,1e7,0);s.loanStrikes=int(s.loanStrikes,0,1e3,0);
for(const k of Object.keys(s.stats)){const v=s.stats[k];if(k==='by'||k==='f'||k==='ddT'){if(!v||typeof v!=='object')s.stats[k]={};else for(const j of Object.keys(v))v[j]=num(v[j],0);}else if(typeof v!=='boolean')s.stats[k]=num(v,0);}
for(const k of ['survived','incidents','peak'])s.stats[k]=num(s.stats[k],0);
@ -121,7 +121,7 @@ function sanitize(s){
cmFix(s);
pieSanitize(s);pieIncFix(s);volFix(s);
ip4Fix(s);
satSanitize(s);
satSanitize(s);wispSanitize(s);
if(s.te){if(typeof s.te!=='object')s.te=null;else{s.te.on=!!s.te.on;s.te.script=typeof s.te.script==='string'?s.te.script.slice(0,4000):'';}}
return s;}
function migrate(s){sanitize(s);
@ -136,7 +136,7 @@ function migrate(s){sanitize(s);
for(const l of s.links||[])if((l.a===c||l.b===c)&&l.kind==='wave')need(l.tier,'maxLT');
for(const t of s.transit||[])if(t.city===c)need(t.tier,'maxP');for(const x of s.pni||[])if(x.city===c)need(x.tier,'maxP');if(s.ixp&&s.ixp[c]!==undefined)need(s.ixp[c],'maxP');p.rgen=g;}}for(const b of s.biz||[])if(!b.reqs)b.reqs=BIZ_T[b.type]&&BIZ_T[b.type].div?['diverse']:[];for(const o of s.offers||[])if(!o.reqs)o.reqs=[];if(!s.lvl)s.lvl=1;s.nni=(Array.isArray(s.nni)?s.nni:[]).filter(x=>x&&own(FAB,x.prov)&&isCity(x.city)&&Number.isInteger(x.tier)&&!!NNI[x.tier]);for(const x of s.nni){const n=Math.floor(+x.n||1);if(n>1)x.n=Math.min(LAG_MAX,n);else delete x.n;}s.cnLic=s.cnLic||{state:'none'};s.ev=s.ev||{};for(const l of s.links){if(!l.kind)l.kind='wave';if(l.mo===undefined)l.mo=Math.round(waveMo(l.km,l.sub,l.tier)*(l.mult||1));}for(const c in s.pops){if(!s.pops[c].routers)s.pops[c].routers=1;}
{const all=NETS.map(n=>n.id),seen=Array.isArray(s.seen)?s.seen.filter(x=>typeof x==='string'):null,fresh=seen?all.filter(id=>!seen.includes(id)):all;
if(fresh.length&&(s.day||0)>0){const g=s.grace&&s.grace.until>s.day?s.grace:{nets:[]};s.grace={until:s.day+GRACE_DAYS,nets:[...new Set(g.nets.concat(fresh))],fresh:seen?fresh.length:0};}
if(fresh.length&&s.day>s.day0){const g=s.grace&&s.grace.until>s.day?s.grace:{nets:[]};s.grace={until:s.day+GRACE_DAYS,nets:[...new Set(g.nets.concat(fresh))],fresh:seen?fresh.length:0};}
s.seen=all;}
// Australian pricing and peering changed in place (#148): a save that was already there gets told once.
if(s.auV!==1){if((s.day||0)>0&&Object.keys(s.pops).some(c=>CITY[c].au))s.auNews=true;s.auV=1;}

View file

@ -11,6 +11,8 @@ const MK_YR=0.10,MK_FREE=180,MK_FLOOR=0.3,MK_SHOCK={opt:1.15,rt:1.1,build:1.08};
function mktBase(d){if(d<=MK_FREE)return 1;const y=(d-MK_FREE)/365;
return Math.max(MK_FLOOR,Math.pow(1-MK_YR,y)*Math.sqrt(hwTrend(d))*(1+0.06*Math.sin(2*Math.PI*y/3)));}
function mkt(){if(!S||!rule('market'))return 1;const s=hwShock();return mktBase(S.day)*(s?MK_SHOCK[s.k]||1:1);}
// The market against the network's own first day (a late joiner's start), as the "since you started" lines say it.
const mktRel=()=>S&&rule('market')?mkt()/mktBase(S.day0|0):mkt();
// Terms in months: enterprise and hosting 1–3 years, wholesale and circuits 2–5, IRUs and fiber pairs 10–20.
const CL_TERMS={ip:[12,24,36],whole:[24,36,48,60],iru:[120,180,240]};
@ -99,7 +101,7 @@ function clNews(out){
const few=(list,kind)=>{for(const t of list.slice(0,3))toast(t,kind);if(list.length>3)toast(trn('lifecycle.n_more',list.length-3),kind);};
few(out.ok,'good');ip4News(out.v4);few(out.lost,'');
if(out.ren)toast(trn('lifecycle.n_renewed',out.ren,{p:mktTxt()}),'');}
const mktTxt=()=>{const m=mkt();return Math.abs(m-1)<0.005?tr('lifecycle.market_as_start'):m<1?tr('lifecycle.market_below',{p:pct(1-m)}):tr('lifecycle.market_above',{p:pct(m-1)});};
const mktTxt=()=>{const m=mktRel();return Math.abs(m-1)<0.005?tr('lifecycle.market_as_start'):m<1?tr('lifecycle.market_below',{p:pct(1-m)}):tr('lifecycle.market_above',{p:pct(m-1)});};
/* Growth by word of mouth: about every six weeks the happiest long-standing customer (a year or more, 90%+ happy)
tells someone like them, who shows up in Deals asking for the smallest size at today's price. */
@ -142,7 +144,7 @@ function clPanel(){const C=S.cl||{mo:[]},mo=C.mo.slice(-12);const soon=S.biz.fil
<div class="dgrid" style="margin:0 0 8px"><div class="tile"><div class="lbl">${tr('lifecycle.won')}</div><div class="val">${sum('won')}</div><div class="sub">${tr('lifecycle.last_12_months')}</div></div>
<div class="tile"><div class="lbl">${tr('lifecycle.lost')}</div><div class="val" style="color:${sum('lost')>sum('won')?'var(--tx-red,var(--bad))':'inherit'}">${sum('lost')}</div><div class="sub">${trn('lifecycle.n_grew',sum('grew'))}</div></div>
<div class="tile"><div class="lbl">${tr('lifecycle.renewals_soon')}</div><div class="val">${soon}</div><div class="sub">${tr('lifecycle.next_30_days')}</div></div>
<div class="tile"><div class="lbl">${tr('lifecycle.bandwidth_market')}</div><div class="val">${Math.round(mkt()*100)}</div><div class="sub">${mktTxt()}</div></div></div>`;
<div class="tile"><div class="lbl">${tr('lifecycle.bandwidth_market')}</div><div class="val">${Math.round(mktRel()*100)}</div><div class="sub">${mktTxt()}</div></div></div>`;
if(mo.length){const max=Math.max(1,...mo.map(e=>Math.max(e.won,Object.values(e.lost).reduce((x,y)=>x+y,0)))),W=600,H=120,mid=H/2,bw=W/12;
let g=`<line x1="0" x2="${W}" y1="${mid}" y2="${mid}" stroke="#D5DEEC"/>`;
mo.forEach((e,i)=>{const lost=Object.values(e.lost).reduce((x,y)=>x+y,0),x=(i+12-mo.length)*bw+bw*0.2,w=bw*0.6,hw=(mid-12)*e.won/max,hl=(mid-12)*lost/max;

View file

@ -37,13 +37,15 @@ function linkLat(l){if(l.kind==='xp')return xpLat(l);if(l.kind==='sat')return sa
Each route also gets its own market mood, and new leases get cheaper every year (~8%). */
const WAVE_LAND={EU:0.65,AM:1,SA:1.6,AS:1.4,OC:1.2,AF:2.2},WAVE_SUB={EU:0.8,AM:1,SA:2,AS:1.5,OC:1.5,AF:4.5};
const WAVE_NAME={EU:tr('common.europe'),AM:tr('common.north_america'),SA:tr('common.south_america'),AS:tr('common.asia'),OC:tr('common.oceania'),AF:tr('common.africa')};
// New leases on day d against day 0: 8% cheaper each year, down to 55%.
const waveEro=d=>Math.max(0.55,Math.pow(0.92,Math.floor(d/360)));
function waveMarket(a,b,sub){const ra=CITY[a].reg,rb=CITY[b].reg,T=sub?WAVE_SUB:WAVE_LAND,au=sub?AU_WAVE.sub:AU_WAVE.land;
const fa=CITY[a].au?au:(T[ra]||1),fb=CITY[b].au?au:(T[rb]||1),reg=sub&&nullPair(a,b)?AU_WAVE.ew:sub&&CITY[a].ph&&CITY[b].ph?PH_WAVE:sub?Math.max(fa,fb):(fa+fb)/2;
const key=a<b?a+b:b+a,mood=0.85+(hstr(key+'|mood')%31)/100;
const ero=Math.max(0.55,Math.pow(0.92,Math.floor((S?S.day:0)/360)));
const ero=waveEro(S?S.day:0);
return {m:reg*mood*ero,reg,mood,ero};}
function marketNote(a,b,sub){const k=waveMarket(a,b,sub),ra=CITY[a].reg,rb=CITY[b].reg;const where=ra===rb?WAVE_NAME[ra]:tr('geography_and_latency.a_to_b',{a:WAVE_NAME[ra],b:WAVE_NAME[rb]});
const lvl=k.reg<0.9?tr('geography_and_latency.cheap_lots_of_competing_fiber'):k.reg<=1.05?tr('common.about_average'):k.reg<2?tr('geography_and_latency.pricey_fewer_carriers'):tr('geography_and_latency.expensive_scarce_capacity');const since=k.ero<1?tr('geography_and_latency.and_prices_have_fallen_p_since',{p:Math.round((1-k.ero)*100)}):'';
const lvl=k.reg<0.9?tr('geography_and_latency.cheap_lots_of_competing_fiber'):k.reg<=1.05?tr('common.about_average'):k.reg<2?tr('geography_and_latency.pricey_fewer_carriers'):tr('geography_and_latency.expensive_scarce_capacity');const fell=k.ero/waveEro(S?S.day0|0:0),since=fell<1?tr('geography_and_latency.and_prices_have_fallen_p_since',{p:Math.round((1-fell)*100)}):'';
return k.mood<0.97?tr('geography_and_latency.where_lvl_this_route_is_p',{where,lvl,p:Math.round((1-k.mood)*100),since}):k.mood>1.03?tr('geography_and_latency.where_lvl_this_route_is_p_0196',{where,lvl,p:Math.round((k.mood-1)*100),since}):tr('geography_and_latency.where_lvl_this_route_is_right',{where,lvl,since});}
function waveRoute(a,b,mult,border){const cabs=cablesOk(a,b),sub=isSub(a,b);let via=UI.via;
if(!cabs.find(c=>c.cid===via))via=sub?(cabs[0]?cabs[0].cid:null):(via==='land'||!via?'land':'land');

View file

@ -69,7 +69,7 @@ const ddEraMax=()=>LEVELS.reduce((a,L)=>a*(L.era||1),1);
function ddosSize(a){const fl=scnRule('ddos'),r=Math.random(),cap=DD_REC*eraMul()/ddEraMax();
if(fl&&r<1/3)return Math.round(Math.min(cap,(800+7800*r)*(1+S.day/365)));
const u=fl?(r-1/3)*1.5:r,base=4*eraMul()*(ddGame(a.tgt)?2:1)*(fl?8:1);let g=Math.min(cap,base*Math.pow(Math.max(u,1e-9),-1/0.9));
if(!fl&&(S.day<180||Object.keys(S.pops).length<2))g=Math.min(g,2*ddMaxPort());
if(!fl&&(netAge()<180||Object.keys(S.pops).length<2))g=Math.min(g,2*ddMaxPort());
return Math.max(0.1,Math.round(g*10)/10);}
// Flood Season: 3 to 7 days apart, shrinking with age, level and gamers when attacks are spicy.
const floodGap=()=>!ddosSpicy()&&!ddAttract()?3+Math.floor(Math.random()*5):Math.max(0.05,(3+Math.random()*5)/(Math.sqrt(1+S.day/180)*(1+ddAttract()/10+Math.max(0,(S.lvl||1)-1)/12)));
@ -77,7 +77,7 @@ function ddosTick(){if(scnRule('ddos')){if(S.mode==='sandbox')return;let next=+S
// Unless spicy, floods take turns: the next one waits until the last is over.
if(!ddosSpicy()&&ddosAll().length)return;
while(S.day>=next&&n++<2){ddosAttack(false);next+=floodGap();}S.scn.nextDdos=next<S.day?S.day+floodGap():next;return;}
if(ddosOff()||S.day<=40)return;if(ddosAll().length>=(ddosSpicy()?3:2))return;if(Math.random()<ddosRate())ddosAttack(false);}
if(ddosOff()||netAge()<=40)return;if(ddosAll().length>=(ddosSpicy()?3:2))return;if(Math.random()<ddosRate())ddosAttack(false);}
// A start older than a week no longer counts toward the cap: forgotten the morning it ages out, as sanitize() forgets it.
function ddosForget(d){const s=S.ddosStarts;if(Array.isArray(s)&&s.length&&s[0]<=d-7)S.ddosStarts=s.filter(x=>x>d-7);}
// A new attack. With recompute, its outcome is worked out and announced now; otherwise after the day's routing.

View file

@ -17,8 +17,12 @@ function* failureRun(only){
if(Object.values(S.pops).some(p=>p.site2))opts.push(['ring',1.2]);
if(S.transit.some(t=>!(t.down>S.day)))opts.push(['transit',3]);
if(Object.keys(S.ixp).length)opts.push(['ixloop',2]);
if(S.transit.length&&S.day>60)opts.push(['leak',2]);
if(S.transit.length&&netAge()>60)opts.push(['leak',2]);
if(fabsUsed.length)opts.push(['fabric',1.5]);
// A geomagnetic storm: rare, and only while a LEO circuit of yours is in the sky.
if(!leoStorm()&&leoLive())opts.push(['leostorm',LEO_STORM_W]);
// An island zone's spur cable (46-wisp-zones.js): only while one is lit and whole, so other games draw as before.
const wsp=wispOn()?wispSpurs():[];if(wsp.length)opts.push(['wspur',WISP_CUT_W*wsp.length]);
// Amp huts and ROADMs carry every channel in the glass, the expresses' too; an optic of its own needs a channel of its own.
const lit=S.links.filter(l=>l.kind==='df'&&dfCap(l)>0&&!linkDown(l)),amps=lit.concat(bare);if(amps.length)opts.push(['amp',1.5+amps.length*0.3]);if(lit.length)opts.push(['optic',1.5+lit.length*0.3]);
// Two vendors' idea of the same protocol: the higher the backbone runs, the more often they disagree.
@ -28,7 +32,7 @@ function* failureRun(only){
let tot=opts.reduce((a,o)=>a+o[1],0),r=Math.random()*tot,type=opts[0][0];
for(const o of opts){r-=o[1];if(r<=0){type=o[0];break;}}
if(only)type=only;
if(type==='funny'){const f=['oops','cleaner','harmless','harmless','harmless','ac'];if(live.length)f.push('fatwave','fatwave','mtu','label','loss','loss');else if(bare.length)f.push('loss','loss');if(lagsN().length)f.push('lacp','lacp');if(R.demand>1)f.push('pmtud');if(S.transit.length)f.push('prepend');if(S.day>30)f.push('rpki');if(amps.length)f.push('roadmff');type=pick(f);}
if(type==='funny'){const f=['oops','cleaner','harmless','harmless','harmless','ac'];if(live.length)f.push('fatwave','fatwave','mtu','label','loss','loss');else if(bare.length)f.push('loss','loss');if(lagsN().length)f.push('lacp','lacp');if(R.demand>1)f.push('pmtud');if(S.transit.length)f.push('prepend');if(netAge()>30)f.push('rpki');if(amps.length)f.push('roadmff');type=pick(f);}
const before=R.served;
if(type==='harmless'){const m=pick(HARMLESS);S.stats.incidents++;S.stats.survived++;toast(`<b>${m[0]}</b><br>${m[1]}`,'goal');sfx('alert');return;}
if(type==='ring'){const cs=Object.keys(S.pops).filter(c=>S.pops[c].site2),c=pick(cs),pp=S.pops[c],dur=2+Math.floor(Math.random()*3);pp.ringcut=S.day+dur;
@ -121,6 +125,12 @@ function* failureRun(only){
}else if(type==='fabric'){
const f=pick(fabsUsed);S.ev.fab=S.ev.fab||{};S.ev.fab[f]=S.day+2+Math.floor(Math.random()*3);
addInc({type,ref:f,until:S.ev.fab[f],msg:tr('failures.fabric_is_having_a_bad_day',{fabric:FAB[f].name}),cost:0});
}else if(type==='leostorm'){leoStormGo();
}else if(type==='wspur'){
// The repair ship comes from far away: weeks, unless cuts mend on a timer (Best Effort).
if(!wsp.length)return;const z=pick(wsp),Z=wispZ(z),c=WISP[z].c,dur=rule('sea')==='timer'?3+Math.floor(Math.random()*5):14+Math.floor(Math.random()*22),
en=pick([N_('wisp.cut_anchor'),N_('wisp.cut_trawler'),N_('wisp.cut_slide'),...(WISP[z].v?[N_('wisp.cut_volcano')]:[])]),up=!!Z.sat&&!(Z.sat.ready>S.day);
addInc({type,ref:c,z,until:S.day+dur,msg:tr(en,{zone:WISP[z].n,city:CITY[c].name})+' '+(up?tr('wisp.cut_sat'):tr('wisp.cut_dark')),cost:WISP_RUSH,fix:tr('wisp.rush')},en);
}else if(type==='ddos'){ddosAttack(false);yield;yield* ddosNewsRun();return;
}
// This failure's incident, kept before the routing: the player may repair it (or another) while the worker routes.
@ -128,13 +138,13 @@ function* failureRun(only){
yield;
if(!last)return;
last.impact=Math.max(0,before-R.served);
if(before>1&&last.impact<before*0.03&&type!=='ddos'){S.stats.survived++;toast(`<b>${incTitle(type)}</b><br>${esc(last.msg)} ${tr('failures.traffic_rerouted_customers_barely')}`,'good',[],incOpen(last));}
else{const paused=pref('pauseIncident')&&autoPause();toast(`<b>${incTitle(type)}</b><br>${esc(last.msg)}${paused?`<br><b>${tr('common.game_paused')}</b>`:''}`,'bad',(last.cost&&S.inc.includes(last)?[{l:`${last.fix||tr('common.rush_repair')} ${fmt$(last.cost)}`,act:'fixInc',args:{id:last.id}}]:[]).concat(paused?[resumeAct()]:[]),incOpen(last));}
if(before>1&&last.impact<before*0.03&&type!=='ddos'&&type!=='wspur'){S.stats.survived++;toast(`<b>${incTitle(type)}</b><br>${esc(last.msg)} ${tr('failures.traffic_rerouted_customers_barely')}`,'good',[],incOpen(last));}
else{const paused=pref('pauseIncident')&&autoPause();toast(`<b>${incTitle(type)}</b><br>${esc(last.msg)}${paused?`<br><b>${tr('common.game_paused')}</b>`:''}`,'bad',(last.cost&&S.inc.includes(last)?[{l:`${last.fix||tr('common.rush_repair')} ${fmt$(last.cost)}`,act:'fixInc',args:{id:last.id}}]:[]).concat(type==='wspur'?[{l:tr('common.open'),act:'wispOpen',args:{z:last.z}}]:[]).concat(paused?[resumeAct()]:[]),incOpen(last));}
sfx('alert');
}
const gamingCount=()=>S.biz.reduce((n,b)=>n+(BIZ_T[b.type]?.gaming?1:0),0);
const FLOOD_WHO=[N_('failures.a_botnet_of_40_000_smart'),N_('failures.every_unpatched_baby_monitor_in'),N_('failures.a_gaming_clan_that_lost_one'),N_('failures.a_fridge_that_achieved_sentience_and'),N_('failures.a_crypto_bro_shorting_your_stock'),N_('failures.a_teenager_with_a_stolen_credit'),N_('failures.a_rival_isp_s_stress_test'),N_('failures.ten_thousand_smart_light_bulbs'),N_('failures.a_printer_just_one_printer_nobody'),N_('failures.a_botnet_run_from_a_cloud'),N_('failures.somebody_who_did_not_like_your'),N_('failures.the_internet_connected_kettles_of_a')];
function incTitle(t){return {ring:tr('failures.metro_ring_cut'),site:tr('common.site_outage'),cut:tr('common.fiber_cut'),crash:tr('common.router_crash'),power:tr('common.power_outage'),transit:tr('common.upstream_outage'),ixloop:tr('common.ix_meltdown'),leak:tr('common.route_leak'),ddos:tr('common.ddos_attack'),fabric:tr('common.fabric_outage'),depeer:tr('common.peering_spat'),fatwave:tr('failures.fat_fingered_wave'),label:tr('failures.patch_panel_mishap'),interop:tr('core.interop_failure'),mtu:tr('common.mtu_mismatch'),krroute:tr('failures.rerouted_via_hong_kong'),ctrlplane:tr('failures.control_plane_meltdown'),lacp:tr('common.lacp_trouble'),loss:tr('common.packet_loss'),pmtud:tr('failures.pmtud_black_hole'),oops:tr('common.oops'),cleaner:tr('common.vacuum_incident'),prepend:tr('common.prepend_ageddon'),rpki:tr('common.rpki_invalid'),amp:tr('common.amplifier_failure'),roadmff:tr('failures.fat_fingered_roadm'),optic:tr('common.dead_optic'),maint:tr('common.maintenance_window_3a92'),ac:tr('common.cooling_failure'),hijack:tr('common.bgp_hijack'),shutdown:tr('common.government_shutdown'),redsea:tr('failures.geopolitical_cable_cut')}[t]||pieIncTitle(t)||tr('common.incident');}
function incTitle(t){return {ring:tr('failures.metro_ring_cut'),site:tr('common.site_outage'),cut:tr('common.fiber_cut'),crash:tr('common.router_crash'),power:tr('common.power_outage'),transit:tr('common.upstream_outage'),ixloop:tr('common.ix_meltdown'),leak:tr('common.route_leak'),ddos:tr('common.ddos_attack'),fabric:tr('common.fabric_outage'),depeer:tr('common.peering_spat'),fatwave:tr('failures.fat_fingered_wave'),label:tr('failures.patch_panel_mishap'),interop:tr('core.interop_failure'),mtu:tr('common.mtu_mismatch'),krroute:tr('failures.rerouted_via_hong_kong'),ctrlplane:tr('failures.control_plane_meltdown'),lacp:tr('common.lacp_trouble'),loss:tr('common.packet_loss'),pmtud:tr('failures.pmtud_black_hole'),oops:tr('common.oops'),cleaner:tr('common.vacuum_incident'),prepend:tr('common.prepend_ageddon'),rpki:tr('common.rpki_invalid'),amp:tr('common.amplifier_failure'),roadmff:tr('failures.fat_fingered_roadm'),optic:tr('common.dead_optic'),maint:tr('common.maintenance_window_3a92'),ac:tr('common.cooling_failure'),hijack:tr('common.bgp_hijack'),shutdown:tr('common.government_shutdown'),redsea:tr('failures.geopolitical_cable_cut'),leostorm:tr('pie_inc.t_storm'),wspur:tr('wisp.inc_title')}[t]||pieIncTitle(t)||tr('common.incident');}
const LINKCUT_TR=['cut','redsea'],LINKCUT_ID=['fatwave','label','interop'],POPDOWN=['crash','power','oops','cleaner','maint','shutdown'],IXDOWN=['ixloop'],TDOWN=['transit','prepend'],LINKEQ=['mtu','amp','roadmff','optic'];
function remainUntil(pred){let u=0;for(const x of S.inc)if(pred(x))u=Math.max(u,x.until);return u;}
// Remove an incident, then restore each affected thing to whatever other incidents still hold it down.
@ -149,6 +159,7 @@ function clearInc(i){
else if(T==='leak'){S.ev.leak=null;}
else if(T==='ddos'){const a=ddosAll(S,false).find(a=>i.atk?a.id===i.atk:a.city===i.ref&&(a.start===undefined||a.start===i.start));if(a){ddosDone(a);ddosDrop(a);}}
else if(T==='fabric'){if(S.ev.fab)S.ev.fab[i.ref]=remainUntil(x=>x.type==='fabric'&&x.ref===i.ref);}
else if(T==='leostorm'){S.ev.sky=remainUntil(x=>x.type==='leostorm');}
else if(T==='mtu'){const l=S.links.find(x=>x.id===i.ref);if(l)l.deg=remainUntil(x=>x.type==='mtu'&&x.ref===i.ref);}
else if(T==='loss'){const l=S.links.find(x=>x.id===i.ref);if(l&&!S.inc.some(x=>x.type==='loss'&&x.ref===i.ref))l.loss=null;}
else if(T==='lacp'){if(!S.inc.some(x=>x.type==='lacp'&&x.ref===i.ref)){const [k,...r]=String(i.ref).split(':'),id=r.join(':');if(k==='ix'){if(S.ev.ixlacp)delete S.ev.ixlacp[id];}else{const o=(k==='t'?S.transit:S.pni).find(x=>x.id===id);if(o)o.lacp=null;}}}
@ -160,4 +171,4 @@ function clearInc(i){
else if(T.startsWith('pie'))pieIncClear(i);
else if(T==='optic'){const l=S.links.find(x=>x.id===i.ref);if(l&&!S.inc.some(x=>x.type==='optic'&&x.ref===i.ref))l.chFail=null;}
}
function purgeInc(){S.inc=S.inc.filter(i=>{const T=i.type;if(LINKCUT_TR.includes(T))return S.links.some(l=>(l.trench||l.id)===i.ref);if(LINKCUT_ID.includes(T)||LINKEQ.includes(T))return S.links.some(l=>l.id===i.ref);if(TDOWN.includes(T))return S.transit.some(t=>t.id===i.ref);if(IXDOWN.includes(T))return S.ixp[i.ref]!==undefined;if(POPDOWN.includes(T)||T==='ac')return !!S.pops[i.ref];return true;});}
function purgeInc(){S.inc=S.inc.filter(i=>{const T=i.type;if(LINKCUT_TR.includes(T))return S.links.some(l=>(l.trench||l.id)===i.ref);if(LINKCUT_ID.includes(T)||LINKEQ.includes(T))return S.links.some(l=>l.id===i.ref);if(TDOWN.includes(T))return S.transit.some(t=>t.id===i.ref);if(IXDOWN.includes(T))return S.ixp[i.ref]!==undefined;if(POPDOWN.includes(T)||T==='ac')return !!S.pops[i.ref];if(T==='wspur')return wispIncOk(i);return true;});}

View file

@ -5,11 +5,11 @@ const evRoute=()=>{if(EV_DEFER)EV_DEFER.n++;else compute();};
function* eventRun(){const k={n:0};EV_DEFER=k;try{fireEvent();}finally{EV_DEFER=null;}for(let i=0;i<k.n;i++)yield;}
function fireEvent(){
const opts=['viral','price','grant'];
if(S.day>50)opts.push('sanction','tariff','hijack','landban','shutdown','redsea','baltic');
if(netAge()>50)opts.push('sanction','tariff','hijack','landban','shutdown','redsea','baltic');
// Without a market (Change Freeze), no shortages and no trade war on optics.
if(!rule('market')&&opts.includes('tariff'))opts.splice(opts.indexOf('tariff'),1);
if(S.day>HW_FREE&&!hwShock()&&rule('market'))opts.push('hwshock');
if(S.day>90&&S.links.filter(l=>l.kind==='wave'&&!l.sub).length>=3)opts.push('ctrlplane');
if(netAge()>HW_FREE&&!hwShock()&&rule('market'))opts.push('hwshock');
if(netAge()>90&&S.links.filter(l=>l.kind==='wave'&&!l.sub).length>=3)opts.push('ctrlplane');
if(Object.keys(S.pops).some(ruCity))opts.push('runet','runet');
if(S.pops.doh&&Object.keys(S.pops).some(c=>CITY[c].gcc||CITY[c].uae)&&!(S.ev.gulf>S.day))opts.push('gulf');
if(Object.keys(S.pops).some(c=>CITY[c].saudi))opts.push('mega');

View file

@ -52,6 +52,9 @@ function pieIncFire(k){const P=S.pie;if(!P||!P.co)return false;const d=S.day;
const crs=f=>Object.keys(CRUSTS).filter(f);
if(k==='storm'){const c=crs(id=>pieLive(id)>0&&!pieIncOf('piestorm',id));if(!c.length)return false;const cr=pick(c),f=+(PIE_HIT/5+Math.random()*PIE_HIT*4/5).toFixed(3);
const i=pieAdd({type:'piestorm',ref:cr,until:d+7,f,lost:0,cost:0,msg:tr('pie_inc.storm_msg',{crust:tr(CRUSTS[cr].n),p:pct(f)})});pieFounder(N_('pie.fp_storm'),{c:cr});pieStormBite(i);
// One sun: Starblink's satellites go to safe mode in the same storm (the rented LEO circuits you still have), for a
// day or two as the storm is weak or strong, so no dice are thrown that a sky without them would not throw.
if(!leoStorm()&&leoLive()){leoStormGo(f>=PIE_HIT*0.6?2:1);const x=S.inc[S.inc.length-1];toast(`<b>🛰️ ${incTitle('leostorm')}</b><br>${esc(x.msg)}`,'bad',[],incOpen(x));}
pieIncToast(i,tr('pie_inc.storm_press'),P.safe?[]:[{l:tr('pie_inc.safe_now'),act:'pieSafe',args:{}}]);return true;}
if(k==='food'){const c=crs(id=>pieLive(id)>=100&&!pieIncOf('piefood',id));if(!c.length)return false;const cr=pick(c),n=pieLose(cr,PIE_HIT/2+Math.random()*PIE_HIT/2);
const i=pieAdd({type:'piefood',ref:cr,until:d+360,cost:piePrice(PIE_ROOMBA),fix:tr('pie_inc.food_fix'),msg:tr('pie_inc.food_msg',{crust:tr(CRUSTS[cr].n),n,p:pct(PIE_FOOD_MUL)})});

View file

@ -27,13 +27,14 @@ function* dayPreRun(){
S.day++;
const d=S.day;
// A charter never picked reads as the classic one once its days are over, as a reload reads it (specSanitize).
if(S.chartSet===false&&d>CHARTER_DAYS)S.chartSet=true;
if(S.chartSet===false&&d-S.day0>CHARTER_DAYS)S.chartSet=true;
ddosForget(d);dkTick(d);ixPriceWar(d);peeringDeskDay(d);pniDay(d);mergerDay(d);
yield DAY_REST;
if(!S.phpDone&&d>45&&Math.random()<1/400)elephant();
if(!S.phpDone&&d-S.day0>45&&Math.random()<1/400)elephant();
if(R&&R.teMoved)S.stats.teMax=Math.max(S.stats.teMax||0,R.teMoved);
{const t1=!!S.won&&isTier1();if(S.t1Now&&!t1)toast(tr('day_tick.you_are_no_longer_tier_1',{why:t1Why()}),'bad');S.t1Now=t1;}
if(S.grace&&S.grace.until===d){toast(tr('day_tick.the_courtesy_route_has_ended_new'),'bad',[{l:tr('common.open_noc'),act:'leftTab',args:{t:'noc'}}]);}
lateDay(d);
if(R)ddosTrack(ddosAll(S,false).filter(a=>a.until>=d));
ddosExpire();
ddosTick();
@ -55,6 +56,7 @@ function* dayPreRun(){
if(sf>=0.9){const g=(CITY[c].be&&!(p.boost>d)?0.35:1)*0.025*(scnRule('boom')?1.5:1)*(p.boost>d?2:1)*sf*(0.7+0.6*(R.peerShare||0))*(CITY[c].reg==='AS'&&!CITY[c].cn?1.6:1);p.bb.d+=g*p.bb.d*(1-p.bb.d/P);}
else p.bb.d=Math.max(Math.min(3,P),p.bb.d*(1-(0.9-sf)*0.04));
if(p.bb.v6||p.bb.v6e)ip6Grow(p.bb,d0);}
wispGrow();
return d;}
function* dayPost(d){
yield* ddosNewsRun();ddosTrack();
@ -63,6 +65,7 @@ function* dayPost(d){
S.stats.peak=Math.max(S.stats.peak,R.served);volDay();
S.hist=S.hist||[];S.hist.push({d,dem:+R.demand.toFixed(2),srv:+R.served.toFixed(2),c:+(R.egT.c||0).toFixed(2),p:+(R.egT.p||0).toFixed(2),ix:+(R.egT.ix||0).toFixed(2),t:+(R.egT.t||0).toFixed(2),l2:+(R.egT.l2||0).toFixed(2),rev:Math.round(R.revMo),cost:Math.round(R.costMo),cash:Math.round(S.cash),inc:S.inc.length});if(S.hist.length>180)S.hist.shift();
{const top=custLevel();if(top>(S.lvl||1)){for(let lv=(S.lvl||1)+1;lv<=top;lv++){track('level_'+lv);toast(tr('day_tick.customer_level_lv_name_new_customers',{lv,name:LEVELS[lv-1].n,unlock:LEVELS[lv-1].unlock})+`<br><i>${esc(LEVELS[lv-1].q)}</i>`,'goal');}S.lvl=top;sfx('coin');}}
wispDay(d);
for(const l of S.links){if(l.kind!=='df')continue;
if(l.ready===d){delete l.lay;toast(`<b>${l.own?tr('day_tick.your_fiber_is_finished_a_b',{a:CITY[l.a].name,b:CITY[l.b].name}):tr('day_tick.dark_fiber_handed_over_a_b',{a:CITY[l.a].name,b:CITY[l.b].name})}</b><br>${(l.ch||[]).length?tr('day_tick.channels_are_lighting_up_now'):tr('day_tick.it_is_dark_add_optics_to')}`,'goal',[{l:tr('common.open'),act:'selLink',args:{id:l.id}}]);sfx('coin');}
if(l.own&&l.ready>d&&Math.random()<0.012){const extra=10+Math.floor(Math.random()*40);setCableReady(l,l.ready+leadDays(extra));toast(tr('day_tick.construction_delay_n_days_why_a',{n:leadDays(extra),why:pick(l.sub?SEA_DELAYS.map(x=>tr(x)):[tr('day_tick.archaeologists_found_a_roman'),tr('day_tick.a_protected_hamster_species_lives'),tr('day_tick.the_railway_changed_its_mind_about'),tr('day_tick.the_drilling_crew_hit_a_granite'),tr('day_tick.a_town_council_wants_a_public'),tr('day_tick.somebody_else_s_gas_main_was'),tr('day_tick.the_permit_office_lost_your_permit')]),a:CITY[l.a].name,b:CITY[l.b].name}),'bad');}}
@ -132,7 +135,7 @@ function* dayPost(d){
}
function spawnOffer(){
const mine=spMine(Object.keys(S.pops).filter(bizCity)),lv=lvl();
const types=['dia','dia','game','host'];if(mine.length>=2)types.push('l2vpn','l2vpn');if(S.day>60)types.push('scrub');
const types=['dia','dia','game','host'];if(mine.length>=2)types.push('l2vpn','l2vpn');if(netAge()>60)types.push('scrub');
if(lv>=2)types.push('isp','stream','edu','host','hft','bulk','event','event');if(mine.length>=3&&lv>=2)types.push('sdwan','sdwan');
// A broker's callers are mostly carriers who want capacity on its glass (#300).
const bk=broker(),dfR=S.links.some(l=>l.kind==='df'&&l.ready<=S.day),dfO=S.links.some(l=>l.kind==='df'&&l.own&&l.ready<=S.day);

View file

@ -37,7 +37,7 @@ const BADGES=[
{id:'fifty',i:'🗺️',t:tr('badges.everywhere_at_once'),d:tr('badges.have_pops_in_50_cities'),r:'l',ok:()=>Object.keys(S.pops).length>=50},
{id:'unicorn',i:'🦄',t:tr('common.unicorn'),d:tr('badges.hold_a_billion_dollars_in_cash'),r:'l',ok:()=>S.cash>=1e9},
{id:'clean',i:'🧼',t:tr('badges.debt_free_tier_1'),d:tr('badges.win_without_ever_taking_a_loan'),r:'l',ok:()=>!!S.won&&!(st().loans||0)&&!(S.loans||[]).length},
{id:'speed',i:'⚡',t:tr('common.speedrun'),d:tr('badges.reach_tier_1_within_three_years'),r:'l',ok:()=>!!S.won&&S.day<=1095},
{id:'speed',i:'⚡',t:tr('common.speedrun'),d:tr('badges.reach_tier_1_within_three_years'),r:'l',ok:()=>!!S.won&&netAge()<=1095},
{id:'te',i:'🧭',t:tr('common.traffic_whisperer'),d:tr('badges.have_auto_te_move_100_gbps'),r:'r',ok:()=>(st().teMax||0)>=100},
{id:'street',i:'🚧',t:tr('common.same_street'),d:tr('badges.lose_a_metro_ring_to_one'),r:'r',ok:()=>(st().by||{}).ring>=1},
{id:'anchor',i:'⚓',t:tr('common.anchors_aweigh'),d:tr('badges.have_a_cable_cut_by_a'),r:'r',ok:()=>!!(st().f||{}).anchor},
@ -53,7 +53,7 @@ const BADGES=[
{id:'unbreak',i:'🛡️',t:tr('common.unbreakable'),d:tr('badges.survive_100_incidents_without'),r:'l',ok:()=>(st().survived||0)>=100},
{id:'lv13',i:'🌐',t:tr('badges.is_this_the_internet'),d:tr('badges.reach_customer_level_13'),r:'l',ok:()=>(S.lvl||1)>=13},
{id:'gigawatt',i:'⚛️',t:tr('common.gigawatt_landlord'),d:tr('badges.hold_an_ai_wan_a_training'),r:'l',ok:()=>['aiwan','mtrain','ingest','pairs'].every(t=>S.biz.some(b=>b.type===t))},
{id:'blitz',i:'🚀',t:tr('common.blitz'),d:tr('badges.reach_tier_1_within_two_years'),r:'l',ok:()=>!!S.won&&S.day<=730},
{id:'blitz',i:'🚀',t:tr('common.blitz'),d:tr('badges.reach_tier_1_within_two_years'),r:'l',ok:()=>!!S.won&&netAge()<=730},
{id:'tera',i:'📶',t:tr('badges.terabit_club'),d:tr('badges.serve_1_tbps'),r:'c',ok:()=>R.served>=1000},
{id:'tera10',i:'🚄',t:tr('badges.ten_terabits'),d:tr('badges.serve_10_tbps'),r:'r',ok:()=>R.served>=10000},
{id:'peta',i:'🌌',t:tr('common.hundred_terabits'),d:tr('badges.serve_100_tbps'),r:'e',ok:()=>R.served>=100000},

View file

@ -1,4 +1,6 @@
// Teleports and satellite capacity (#83): build the gateway, rent circuits on its birds, resize them. Cancel is rmLink.
// A Starblink gateway on a teleport sells LEO circuits from there (teleLeo, teleLeoRm). Island zones' circuits start at
// their city's teleport too (87-wisp-zones.js).
Object.assign(ACT,{
teleBuild:({city})=>{const p=S.pops[city];if(!p||teleOf(city))return;
const why=teleWhy(city);if(why){toast(why,'bad');sfx('err');return;}
@ -6,22 +8,32 @@ Object.assign(ACT,{
teleTrk:({city})=>{const p=S.pops[city];if(!p||teleOf(city)!==1)return;
const why=trkWhy(city);if(why){toast(why,'bad');sfx('err');return;}
if(!spend(TRK_COST))return;p.tele=2;toast(tr('satellites.tracking_antennas_up',{city:CITY[city].name}),'good');after();},
// Closing a teleport asks twice, and never while circuits still start there.
teleRm:({city})=>{const p=S.pops[city];if(!p||!teleOf(city))return;const n=S.links.filter(l=>l.kind==='sat'&&l.a===city).length;
// Closing a teleport asks twice, and never while circuits still start there (an island zone's too).
teleRm:({city})=>{const p=S.pops[city];if(!p||!teleOf(city))return;const n=S.links.filter(l=>l.kind==='sat'&&l.a===city).length+wispSats(city).length;
if(n){toast(trn('satellites.cancel_n_circuits_first',n),'bad');sfx('err');return;}
if(UI.confirm!=='tele:'+city){UI.confirm='tele:'+city;renderPanel();return;}
delete p.tele;UI.confirm=null;toast(tr('satellites.teleport_closed',{city:CITY[city].name}));after();},
delete p.tele;delete p.leo;UI.confirm=null;toast(tr('satellites.teleport_closed',{city:CITY[city].name}));after();},
teleLeo:({city})=>{if(!own(S.pops,city)||leoGw(city))return;const why=leoGwWhy(city);if(why){toast(why,'bad');sfx('err');return;}
if(!spend(LEO_GW_COST))return;S.pops[city].leo=1;toast(tr('satellites.leo_gateway_up',{prov:SAT_PROV.sbk.n,city:CITY[city].name,km:SAT_ORB.leo.km.toLocaleString()}),'good');after();},
// Closing the gateway asks twice, and never while LEO circuits still start there.
teleLeoRm:({city})=>{if(!leoGw(city))return;const n=S.links.filter(l=>l.a===city&&leoLink(l)).length+wispSats(city,'leo').length;
if(n){toast(trn('satellites.cancel_n_circuits_first',n),'bad');sfx('err');return;}
if(UI.confirm!=='leo:'+city){UI.confirm='leo:'+city;renderPanel();return;}
delete S.pops[city].leo;UI.confirm=null;toast(tr('satellites.leo_gateway_closed',{city:CITY[city].name}));after();},
satOpen:({a,b})=>satModal(a,b),
// Rent a circuit from teleport a to b: the first month up front, like a wave; a POP at b comes with it if there is none.
// Next to a link you already have between the two, it goes on standby: the backup that carries only when the cable is down.
buySat:({a,b,bird,g})=>{g=+g;const why=satWhy(a,b,bird,g);if(why){toast(why,'bad');sfx('err');return;}
if(!portGate(a,1)||!portGate(b,1))return;const mo=satMo(bird,g),pop=!S.pops[b];if(!spend(mo+(pop?popCost(b):0)))return;
if(pop){S.pops[b]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false,rgen:0};popStdApply(b);}
const sb=pairLinks(a,b).some(l=>l.kind!=='sat'),n=leadDays(SAT_ORB[SATS[bird].orb].days),id=uid();
// One satellite a pair: LEO puts the GEO and MEO circuits there on standby, and one ordered beside LEO waits on standby.
const lo=SATS[bird].orb==='leo',sb=pairLinks(a,b).some(l=>l.kind!=='sat'||!lo&&!l.standby&&leoLink(l));if(lo&&!sb)satBeside(a,b);
const n=leadDays(SAT_ORB[SATS[bird].orb].days),id=uid();
S.links.push({id,a,b,kind:'sat',bird,g,km:satKm(bird,a,b),sub:true,mo,cut:0,day:S.day,ready:S.day+n,...(sb?{standby:true}:{})});
closeModal();UI.sel={type:'link',id};
toast(trn('satellites.circuit_ordered',n,{cap:fmtCap(g),bird:esc(SATS[bird].n),a:CITY[a].name,b:CITY[b].name})+(sb?' '+tr('satellites.on_standby_beside_your_link'):''),'good');after();},
// Bigger or smaller on the same bird: a bigger one pays its new month up front, as a wave upgrade does.
satSize:({id,g})=>{g=+g;const l=S.links.find(x=>x.id===id);if(!l||l.kind!=='sat'||g===l.g||!SAT_ORB[SATS[l.bird].orb].g.includes(g))return;
if(g>l.g&&leoLink(l)){const w=leoGrowWhy(l);if(w){toast(w,'bad');sfx('err');return;}}
const mo=satMo(l.bird,g);if(g>l.g&&!spend(mo))return;l.g=g;l.mo=mo;sfx('click');after();},
});

View file

@ -0,0 +1,30 @@
// Island Wi-Fi (#83): satellite capacity for a zone from its city's teleport, a spur cable, closing either (rules:
// 60-features/46-wisp-zones.js). The first order of a zone brings the island kit too. Every act names the zone (z) only;
// its city is the zone's own.
Object.assign(ACT,{
// A circuit for the zone. With one running, one on another bird is a move: the old one carries until the new one is up.
wispSat:({z,bird,g})=>{if(!own(WISP,z))return;g=+g;const why=wispSatWhy(z,bird,g);if(why){toast(why,'bad');sfx('err');return;}
const c=WISP[z].c,Z=wispZ(z),mo=wispSatMo(bird,g);if(!spend(mo+(Z?0:wispKit(z))))return;
const n=leadDays(SAT_ORB[SATS[bird].orb].days),o={bird,g,mo,day:S.day,ready:S.day+n},mv=!!(Z&&Z.sat),v={cap:fmtCap(g),bird:esc(SATS[bird].n),zone:esc(WISP[z].n)};
if(!Z){const p=S.pops[c];(p.wisp||(p.wisp={}))[z]={day:S.day,d:wispStart(z),sat:o};}else if(mv)Z.nxt=o;else Z.sat=o;
toast(mv?trn('wisp.moving',n,v):trn('wisp.ordered',n,v),'good');after();},
// Bigger or smaller on the same bird: a bigger one pays its new month up front, as satSize does.
wispSatSize:({z,g})=>{if(!own(WISP,z))return;g=+g;const Z=wispZ(z),o=Z&&Z.sat;if(!o||g===o.g||!SAT_ORB[wispOrb(o)].g.includes(g))return;
if(g>o.g&&wispOrb(o)==='leo'){const w=leoGrowWhy({a:WISP[z].c});if(w){toast(w,'bad');sfx('err');return;}}
const mo=wispSatMo(o.bird,g);if(g>o.g&&!spend(mo))return;o.g=g;o.mo=mo;sfx('click');after();},
// Cancelling asks twice; a move being commissioned goes with it.
wispSatRm:({z})=>{if(!own(WISP,z))return;const Z=wispZ(z);if(!Z||!Z.sat&&!Z.nxt)return;
if(UI.confirm!=='wsat:'+z){UI.confirm='wsat:'+z;renderPanel();return;}delete Z.sat;delete Z.nxt;UI.confirm=null;after();},
// A spur cable from the city: the price of the day, and the island kit when the zone starts with it.
wispSpur:({z})=>{if(!own(WISP,z))return;const why=wispSpurWhy(z);if(why){toast(why,'bad');sfx('err');return;}
const c=WISP[z].c,Z=wispZ(z);if(!spend(wispSpurCost(z)+(Z?0:wispKit(z))))return;const n=wispSpurDays(z),sp={day:S.day,ready:S.day+n};
if(Z)Z.sp=sp;else{const p=S.pops[c];(p.wisp||(p.wisp={}))[z]={day:S.day,d:wispStart(z),sp};}
toast(trn('wisp.spur_ordered',n,{zone:esc(WISP[z].n)}),'good');sfx('build');after();},
// Closing a zone asks twice: its circuits, spur, homes and any cut go with it.
wispRm:({z})=>{if(!own(WISP,z))return;const Z=wispZ(z);if(!Z)return;
if(UI.confirm!=='wz:'+z){UI.confirm='wz:'+z;renderPanel();return;}const p=S.pops[WISP[z].c];delete p.wisp[z];if(!Object.keys(p.wisp).length)delete p.wisp;
S.inc=S.inc.filter(i=>!(i.type==='wspur'&&i.z===z));UI.confirm=null;if(UI.wz===z)UI.wz=null;toast(tr('wisp.closed',{zone:esc(WISP[z].n)}));after();},
// A zone in its city's Customers tab (a view): the same button again on the open zone folds it.
wispOpen:({z})=>{if(!own(WISP,z))return;const c=WISP[z].c,here=!!UI.sel&&UI.sel.type==='city'&&UI.sel.id===c;
const same=here&&UI.tab==='cust'&&UI.wz===z;UI.tab='cust';UI.wz=same?null:z;if(here){UI.confirm=null;renderPanel();}else selectCity(c);},
});

View file

@ -37,7 +37,7 @@ function renderLeft(){checkLayer();
$('leftTabs').innerHTML=tabs.map(([k,l])=>`<button class="${UI.left===k?'on':''}" data-act="leftTab" data-args='{"t":"${k}"}'>${l}</button>`).join('')+(innerWidth<760?`<button data-act="toggleLeft" style="margin-left:auto" aria-label="${tr('common.close')}">×</button>`:'');
let h='';
if(UI.left==='goals'){
h+=charterCard()+scnCard()+lvlCard()+t1Card();
h+=charterCard()+lateCard()+scnCard()+lvlCard()+t1Card();
const cur=G.find(g=>S.done[g.id]===undefined);
h+=G.map(g=>{const d=S.done[g.id]!==undefined,c=g===cur;return `<div class="goal ${d?'done':''} ${c?'cur':''}"><div class="ck">${d?'✓':''}</div><div><div class="gt">${esc(g.t)}</div>${c||!d?`<div class="gd">${esc(g.d)}</div>`:''}${!d&&g.r?`<div class="gr">${tr('hud_and_panels.reward_cash',{cash:fmt$(g.r)})}</div>`:''}</div></div>`;}).join('');
h+=badgeGrid();

View file

@ -3,14 +3,14 @@ function cityPanel(c){
// Your POP's router model, as a picture left of the name (10-catalog/25-router-art.js).
const art=p?rgArt(p.rgen||0):'';
let h=`<div class="ph">${art?`<span class="rgpic big phpic">${art}</span>`:''}<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)}${satFact(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.kr&&scnRule('sender')?`<span class="fact">${tr('city_panel.sender_pays_fee_per_gbps',{fee:fmt$(KR_FEE)})}</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>
<div class="facts"><span class="fact">${tr('city_panel.g_of_eyeballs',{g:fmtG(eyeP(c))})}</span>${grantFact(c)}${satFact(c)}${wispFact(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.kr&&scnRule('sender')?`<span class="fact">${tr('city_panel.sender_pays_fee_per_gbps',{fee:fmt$(KR_FEE)})}</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>`:''}${(q=>btn(tr('city_panel.build_pop_cost_mo_mo',{cost:fmt$(popCost(c)+(q?q.cost:0)),mo:fmt$(popMo(c)+(q?q.mo:0))}),'buildPop',{city:c},'pink big',S.cash<popCost(c))+(q?`<p class="note">${q.site2||q.gen?tr('pop_std.includes_the_build_standard',{list:esc(bstdPopParts({g:q.g,rt:q.rt,site2:q.site2,gen:q.gen}).join(', ')),cost:fmt$(q.cost),mo:fmt$(q.mo)}):tr('pop_std.includes_the_standard_n_model',{n:q.rt,model:esc(RG[q.g].n),cost:fmt$(q.cost),mo:fmt$(q.mo)})}</p>`:''))(popStdQuote())}
<p class="note">${tr('city_panel.or_drag_from_one_of_your')}</p></section>${opsTplHtml(c)}`}`;
h+=offersHere(c)+satNoPop(c);
h+=offersHere(c)+satNoPop(c)+wispNoPop(c);
const trs=NETS.filter(n=>sellsAt(n,c));
const fh=FABS.filter(f=>f.cities.includes(c));
if(ix&&fh.length){if(remoteCities().includes(c))h+=ixSection(c).replace('<h3>'+tr('common.internet_exchange')+'</h3>','<h3>'+tr('city_panel.remote_peering_at_the_ix')+'</h3>');
@ -26,7 +26,7 @@ function cityPanel(c){
if(UI.tab==='cust'){
{const nl=R.nodeLoad[c]||0,nc=R.nodeCap[c]||1;if(nl>=nc*0.95)h+=`<section><h3 style="color:var(--tx-red,var(--bad))">${tr('city_panel.router_maxed_out')}</h3><p class="lead">${tr('city_panel.your_routers_here_are_forwarding',{load:fmtG(nl),cap:fmtG(nc)})}</p>${btn(tr('common.open_infra'),'tab',{t:'links'},'pink sm')}</section>`;}
h+=`<section><h3>${tr('common.home_broadband')}</h3>`;
if(!p.bb){const s=bbStart(c);h+=`<p class="lead">${tr('city_panel.sell_internet_to_homes_here_starts',{start:fmtG(s),max:fmtG(eyeP(c)),rate:fmt$(EYE_RATE*arpuOf(c))})}${C.au?` ${scnRule('levy')?tr('city_panel.it_runs_on_your_own_fibre',{pct:pct(AU_LEVY)}):tr('city_panel.the_nearly_broadband_network_keeps',{pct:pct(AU_WHOLESALE)})}`:''}</p>${btn(tr('city_panel.launch_broadband_cost',{cost:fmt$(bbCost(c))}),'launchBB',{city:c},'pink big',S.cash<bbCost(c))}`;}
if(!p.bb){const s=bbStart(c);h+=`<p class="lead">${tr('city_panel.sell_internet_to_homes_here_starts',{start:fmtG(s),max:fmtG(eyeP(c)),rate:fmt$(EYE_RATE*arpuOf(c))})}${C.au?` ${scnRule('levy')?tr('city_panel.it_runs_on_your_own_fibre',{pct:pct(AU_LEVY)}):tr('city_panel.the_nearly_broadband_network_keeps',{pct:pct(AU_WHOLESALE)})}`:''}${lateOn()&&lateLeft()?' '+trn('late.bb_pitch',lateLeft()):''}</p>${btn(tr('city_panel.launch_broadband_cost',{cost:fmt$(bbCost(c))}),'launchBB',{city:c},'pink big',S.cash<bbCost(c))}`;}
else{const eye=R.cityEye[c]||0;
h+=`<div class="kv"><span>${tr('common.eyeball_demand')}</span><b>${tr('city_panel.a_of_b',{a:fmtG(eye),b:fmtG(eyeP(c))})}</b></div><div class="bar me"><i style="width:${Math.min(100,eye/eyeP(c)*100)}%"></i></div>
<div class="kv"><span>${tr('city_panel.served_in_city',{city:C.name})}</span><b style="color:${sf<0.9?'var(--tx-red,var(--bad))':'var(--eye)'}">${pct(sf)}</b></div><div class="bar ${sf<0.9?'bad':''}"><i style="width:${sf*100}%"></i></div>
@ -34,7 +34,7 @@ function cityPanel(c){
<div class="kv"><span>${tr('city_panel.network_wide_peering_ratio')}</span><b>${pct(R.peerShare||0)}</b></div><p class="note">${tr('city_panel.more_traffic_over_peering_pnis_and')}</p>
${sf<0.9?`<p class="why">${tr('city_panel.customers_are_unhappy_and_leaving')}</p>`:''}
<div class="btns">${p.boost>S.day?`<span class="tag st on">${tr('city_panel.ad_campaign_n_d_left',{n:p.boost-S.day})}</span>`:btn(tr('city_panel.run_ad_campaign_8k_2_growth'),'ad',{city:c},'',S.cash<8000)}</div>${ip6Html(c)}`;}
h+=`</section><section><h3>${tr('common.business_customers')}</h3>`;
h+=`</section>`+wispHtml(c)+`<section><h3>${tr('common.business_customers')}</h3>`;
const bz=S.biz.filter(b=>bCities(b).includes(c));
if(!bz.length)h+=`<p class="empty">${tr('city_panel.no_businesses_yet_offers_pop_up')}</p>`;
for(const b of bz)h+=`<div class="row"><div class="grow"><div class="nm">${esc(b.name)}</div><div class="meta">${esc(BIZ_T[b.type].l)}${b.city2?` ${CITY[b.city].name} ⇄ ${CITY[b.city2].name}`:''} · ${bTerms(b)}${clTermTxt(b)?' · '+clTermTxt(b):''}${BIZ_T[b.type].l2?` · ${b.sites?tr('city_panel.carrying_g_per_site',{g:fmtG(R.l2[b.id]||0)}):tr('city_panel.carrying_g',{g:fmtG(R.l2[b.id]||0)})}`:''}${BIZ_T[b.type].fiber&&!fiberOk(b)?' · <b style="color:var(--tx-red,var(--bad))">'+tr('city_panel.fiber_is_down')+'</b>':''}${BIZ_T[b.type].event&&eventLive(b)?` · <b>${tr('city_panel.serving_v',{v:pct(sfOf(R,b.city))})}</b>`:''}${b.type==='scrub'&&!hasScrub()?' · <b style="color:var(--tx-red,var(--bad))">'+tr('common.needs_a_scrubbing_center')+'</b>':''}${S.day-(b.since||0)<15?` · <b>${tr('common.provisioning_n_d_grace',{n:15-(S.day-(b.since||0))})}</b>`:''}</div>${bRisk(b)}${reqList(b)}${BIZ_T[b.type].l2?routeCtl(b):''}${pathCtl(b)}<div class="bar ${b.mood<30?'bad':b.mood<65?'warn':''}"><i style="width:${b.mood}%"></i></div><div class="meta">${tr('common.happiness_p',{p:Math.round(b.mood)})}</div></div>${btn(UI.confirm===b.id?tr('common.really_drop'):tr('common.drop'),'dropBiz',{id:b.id},'ghost sm')}</div>`;

View file

@ -10,7 +10,7 @@ function decomModal(){const sel=[...(UI.decom||[])],im=decomImpact(sel),all=Obje
const rows=all.map(c=>`<label class="row" style="cursor:pointer"><input type="checkbox" data-act="decomToggle" data-args='${esc(JSON.stringify({city:c}))}' ${sel.includes(c)?'checked':''}><div class="grow"><div class="nm">${esc(CITY[c].name)}${c===S.home?` <span class="tag st">${tr('common.home')}</span>`:''}</div><div class="meta">${trn('decommission.n_link',S.links.filter(l=>l.a===c||l.b===c).length)} · ${trn('decommission.n_customer',S.biz.filter(b=>bCities(b).includes(c)).length)}</div></div></label>`).join('');
openModal(`<div style="display:flex;align-items:center"><h2 style="font-size:24px">${tr('common.decommission_pops')}</h2><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>
<p class="lead" style="margin-top:6px">${tr('decommission.pick_the_pops_to_shut_down')}</p>${rows}
${sel.length?`<div class="kv"><span>${tr('common.links_removed')}</span><b>${im.links.length}</b></div><div class="kv"><span>${tr('decommission.eyeballs_you_stop_serving')}</span><b>${fmtG(im.eye)}</b></div><div class="kv"><span>${trn('decommission.n_customer_let_go',im.biz.length)}</span><b style="color:var(--tx-red,var(--bad))">${fmt$(im.fee)}</b></div>${im.biz.length?`<p class="meta">${im.biz.map(b=>esc(b.name)+' '+fmt$(im.pen(b))).join(' · ')}</p>`:''}`:''}
${sel.length?`<div class="kv"><span>${tr('common.links_removed')}</span><b>${im.links.length}</b></div><div class="kv"><span>${tr('decommission.eyeballs_you_stop_serving')}</span><b>${fmtG(im.eye)}</b></div><div class="kv"><span>${trn('decommission.n_customer_let_go',im.biz.length)}</span><b style="color:var(--tx-red,var(--bad))">${fmt$(im.fee)}</b></div>${im.biz.length?`<p class="meta">${im.biz.map(b=>esc(b.name)+' '+fmt$(im.pen(b))).join(' · ')}</p>`:''}${(z=>z.length?`<p class="why">${tr('wisp.decom',{list:z.map(x=>esc(WISP[x].n)).join(', ')})}</p>`:'')(sel.flatMap(c=>wispAt(c).filter(wispZ)))}`:''}
${left<1?`<p class="why">${tr('decommission.keep_at_least_one_pop')}</p>`:''}
<div class="btns" style="margin-top:10px">${btn(sel.length?trn('decommission.decommission_n_pop_pay_fee',sel.length,{fee:fmt$(im.fee)}):tr('decommission.pick_a_pop'),'decomGo',{},'red',!sel.length||left<1)}${btn(tr('common.keep_them'),'closeModal',{},'ghost')}</div>`);}
function decommission(cities){const set=new Set(cities),im=decomImpact(cities),lids=new Set(im.links.map(l=>l.id)),bids=new Set(im.biz.map(b=>b.id));

View file

@ -4,7 +4,8 @@ const satLogo=P=>`<span class="logo" style="--c:${P.col}">${esc(P.n.slice(0,2).t
const satRtt=(id,a,b)=>Math.round(2*satLat({bird:id,km:satKm(id,a,b)}));
const satModalHead=(eye,title)=>`<div style="display:flex;align-items:center"><div><div class="eyebrow">🛰️ ${eye}</div><h2 style="font-size:24px">${title}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>`;
// In a city's facts: its own users' traffic rides a satellite today (R.satU), and they count part of the service as bad (sfOf, R.latF).
const satFact=c=>R&&R.latF&&R.latF[c]<1&&R.satU&&R.satU[c]>1e-3?`<span class="fact bad">🛰️ ${tr('satellites.users_ride_a_satellite')}</span>`:'';
// Over LEO alone they hardly notice, so the chip is a plain one.
const satFact=c=>R&&R.latF&&R.latF[c]<1&&R.satU&&R.satU[c]>1e-3?`<span class="fact${R.latF[c]>=1-SAT_ORB.leo.loss-1e-9?'':' bad'}">🛰️ ${tr('satellites.users_ride_a_satellite')}</span>`:'';
// The birds a dish at c sees, in words.
const satInView=c=>{const ids=teleSees(c);return ids.length?tr('satellites.in_view_list',{list:ids.map(id=>`<b>${esc(SATS[id].n)}</b> (${tr(SATS[id].sea)})`).join(', ')}):tr('satellites.no_bird_sees_this_city');};
// In a POP's Infra tab: its teleport (build it, what it sees, its circuits), and the teleports that can reach it.
@ -15,14 +16,36 @@ function teleHtml(c){if(pzOn())return '';const t=teleOf(c),from=satFrom(c),open=
<div class="meta">${satInView(c)}</div>`;
for(const l of out){const u=capOf(l)?(R.load[l.id]||0)/capOf(l):0;
h+=`<div class="row"><div class="grow"><div class="nm">→ ${CITY[l.b].name}${l.standby?' <span class="tag st">'+tr('common.standby')+'</span>':''}</div><div class="meta">${capName(l)} · ${esc(satName(l))}${l.ready>S.day?' · '+tr('city_panel.ready_in_n_d',{n:l.ready-S.day}):''} · ${tr('common.price_mo',{price:fmt$(l.mo)})}</div><div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div></div>${btn(tr('common.open'),'selLink',{id:l.id},'ghost sm')}</div>`;}
h+=`<div class="btns">${btn(tr('satellites.rent_satellite_capacity'),'satOpen',{a:c},'pink sm')}${t===1&&lvl()>=SAT_ORB.meo.lv&&meo?btn(tr('satellites.add_tracking_antennas_cost_mo',{cost:fmt$(TRK_COST),mo:fmt$(TRK_MO)}),'teleTrk',{city:c},'sm',S.cash<TRK_COST):''}${out.length?'':btn(cf?tr('satellites.really_close_it'):tr('satellites.close_the_teleport'),'teleRm',{city:c},'ghost sm')}</div>
${t===1&&lvl()<SAT_ORB.meo.lv&&meo?`<p class="note">${tr('satellites.meo_comes_at_level',{lv:SAT_ORB.meo.lv})}</p>`:''}`;}
h+=wispTeleRows(c);
h+=`<div class="btns">${btn(tr('satellites.rent_satellite_capacity'),'satOpen',{a:c},'pink sm')}${t===1&&lvl()>=SAT_ORB.meo.lv&&meo?btn(tr('satellites.add_tracking_antennas_cost_mo',{cost:fmt$(TRK_COST),mo:fmt$(TRK_MO)}),'teleTrk',{city:c},'sm',S.cash<TRK_COST):''}${out.length||wispSats(c).length?'':btn(cf?tr('satellites.really_close_it'):tr('satellites.close_the_teleport'),'teleRm',{city:c},'ghost sm')}</div>
${t===1&&lvl()<SAT_ORB.meo.lv&&meo?`<p class="note">${tr('satellites.meo_comes_at_level',{lv:SAT_ORB.meo.lv})}</p>`:''}`;
h+=leoHtml(c);}
// Before the build: what its dishes would see and reach at your level, and no button to a teleport that reaches nothing.
else if(open){const why=teleWhy(c),n=why?0:satTargets(c).filter(x=>satBirds(c,x).some(id=>lvl()>=SAT_ORB[SATS[id].orb].lv)).length;
h+=`<p class="lead">${tr('satellites.a_teleport_is_a_satellite_gateway')}</p><div class="meta">${satInView(c)}${why?'':' '+trn('satellites.n_places_in_reach',n)}</div>${why&&teleSees(c).length?`<div class="why">${esc(why)}</div>`:''}
else if(open){const why=teleWhy(c),n=why?0:satTargets(c).filter(x=>satBirds(c,x).some(id=>lvl()>=SAT_ORB[SATS[id].orb].lv)).length,nz=why||!wispOn()?0:wispAt(c).length;
h+=`<p class="lead">${tr('satellites.a_teleport_is_a_satellite_gateway')}</p><div class="meta">${satInView(c)}${why?'':' '+trn('satellites.n_places_in_reach',n)}</div>${nz?`<div class="meta">${tr('wisp.tele_reaches')} ${trn('wisp.n_zones',nz)}</div>`:''}${why&&teleSees(c).length?`<div class="why">${esc(why)}</div>`:''}
<div class="btns">${btn(tr('satellites.build_a_teleport_cost_mo',{cost:fmt$(TPORT_COST),mo:fmt$(TPORT_MO)}),'teleBuild',{city:c},'sm',S.cash<TPORT_COST||!!why)}</div>`;}
if(from.length)h+=satReach(c,from);
return h+`</section>`;}
/* A teleport's Starblink gateway: host it (level 5, under the shell, on your fiber), what it reaches, and once circuits
land there, the POP every island behind it leans on: its routers, the fiber out of the city and its transit ports (a
port on someone's cable is a way out too, satWired), as routing sees them. */
function leoHtml(c){const O=SAT_ORB.leo;if(!satSees(LEO_BIRD,c))return '';
if(lvl()<O.lv)return `<p class="note">${tr('satellites.leo_comes_at_level',{lv:O.lv})}</p>`;
if(!leoGw(c)){const why=leoGwWhy(c);
return `${why?`<div class="why">${esc(why)}</div>`:''}<div class="btns">${btn(tr('satellites.host_leo_gateway_cost_mo',{cost:fmt$(LEO_GW_COST),mo:fmt$(LEO_GW_MO)}),'teleLeo',{city:c},'sm',!!why||S.cash<LEO_GW_COST)}</div>`;}
// An island zone of this city over LEO lands here too (46-wisp-zones.js).
const out=S.links.filter(l=>l.a===c&&leoLink(l)),zl=wispSats(c,'leo'),n=satTargets(c).filter(x=>satPairOk(LEO_BIRD,c,x)).length,C=CITY[c].name;
let h=`<div class="kv"><span>${tr('satellites.leo_gateway')}</span><b>${esc(SAT_PROV.sbk.n)} · ${tr('common.price_mo',{price:fmt$(LEO_GW_MO)})}</b></div><div class="meta">${trn('satellites.n_in_leo_reach',n,{km:O.km.toLocaleString()})}</div>`;
if(!satWired(c))h+=`<div class="why">${tr('satellites.leo_gateway_unwired',{city:C})}</div>`;
if(!out.length&&!zl.length)return h+`<div class="btns">${btn(UI.confirm==='leo:'+c?tr('satellites.really_close_it'):tr('satellites.close_the_leo_gateway'),'teleLeoRm',{city:c},'ghost sm')}</div>`;
const land=out.reduce((a,l)=>a+(R.load[l.id]||0),0)+zl.reduce((a,z)=>{const Z=wispZ(z),x=R.wisp&&R.wisp[z];return a+(x&&Z.sat&&wispOrb(Z.sat)==='leo'&&wispLink(z,Z)===Z.sat?x.car:0);},0),nl=R.nodeLoad[c]||0,nc=R.nodeCap[c]||nodeCap(c)||1,un=nl/nc,
ws=S.links.filter(l=>(l.a===c||l.b===c)&&wiredLink(l)&&!linkDown(l)&&!l.standby),wl=ws.reduce((a,l)=>a+(R.load[l.id]||0),0),wc=ws.reduce((a,l)=>a+capOf(l),0),uw=wc>0?wl/wc:0,
ts=S.transit.filter(t=>t.city===c&&!(t.down>S.day)),tl=ts.reduce((a,t)=>a+(R.useT[t.id]||0),0),tc=ts.reduce((a,t)=>a+lagCap(PORT[t.tier].g,t.n),0),ut=tc>0?tl/tc:0;
return h+`<div class="kv"><span>${tr('satellites.leo_landing')}</span><b>${fmtG(land)}</b></div>
<div class="kv"><span>${tr('common.forwarding_load')}</span><b>${fmtG(nl)} / ${fmtG(nc)}</b></div><div class="bar ${barCls(un)}"><i style="width:${Math.min(100,un*100)}%"></i></div>
${wc>0||!tc?`<div class="kv"><span>${tr('satellites.leo_backhaul',{city:C})}</span><b>${fmtG(wl)} / ${fmtG(wc)}</b></div>${wc>0?`<div class="bar ${barCls(uw)}"><i style="width:${Math.min(100,uw*100)}%"></i></div>`:''}`:''}
${tc>0?`<div class="kv"><span>${tr('satellites.leo_transit',{city:C})}</span><b>${fmtG(tl)} / ${fmtG(tc)}</b></div><div class="bar ${barCls(ut)}"><i style="width:${Math.min(100,ut*100)}%"></i></div>`:''}
${un>=0.95||uw>=0.95||ut>=0.95?`<p class="why">${tr('satellites.leo_bottleneck',{city:C})}</p>`:''}`;}
// Teleports that reach city c: a button each, to the order sheet.
const satReach=(c,from)=>`<p class="note">${tr('satellites.reachable_from_your_teleports',{city:CITY[c].name})}</p><div class="btns">${from.slice(0,4).map(a=>btn(tr('fiber_modals.from_city',{city:CITY[a].name}),'satOpen',{a,b:c},'ghost sm')).join('')}</div>`;
// Whether a satellite can get to city c: a teleport of yours reaches it, or (once teleports are on sale) a bird you may
@ -48,6 +71,7 @@ function satModal(a,b){a=isCity(a)?a:null;b=isCity(b)?b:null;
return `<div class="row">${satLogo(P)}<div class="grow"><div class="nm">${esc(B.n)} <span class="tag">${O.n}</span></div><div class="meta">${esc(P.n)} · ${tr(B.sea)} · ${tr('satellites.ms_round_trip',{ms:satRtt(id,a,b)})} · ${trn('satellites.up_in_n_days',leadDays(O.days))}</div><div class="meta">${esc(P.blurb)}</div>${why?`<div class="why">${esc(why)}</div>`:''}
<div class="btns">${O.g.map(g=>btn(`${fmtCap(g)} <small>${tr('common.price_mo',{price:fmt$(satMo(id,g))})}</small>`,'buySat',{a,b,bird:id,g},'sm',!!why||S.cash<satMo(id,g)+pop)).join('')}</div></div></div>`;}).join('');
openModal(satModalHead(tr('satellites.satellite_capacity'),`${CITY[a].name} → ${CITY[b].name}`)+`<p class="lead" style="margin-top:8px">${tr('satellites.users_notice_geo_meo')}</p>`
+(birds.some(id=>SATS[id].orb==='leo')?`<p class="note">${tr('satellites.users_notice_leo')}</p>`:'')
+(pop?`<p class="note">${tr('satellites.no_pop_there_yet',{city:CITY[b].name,cost:fmt$(pop)})}</p>`:'')+(sib?`<p class="note">${tr('satellites.it_waits_on_standby')}</p>`:'')
+(rows||`<p class="empty">${tr('satellites.no_bird_sees_both',{a:CITY[a].name,b:CITY[b].name})}</p>`));}
// A circuit's panel: what it carries, its latency and rent, a size up or down, standby and the metric, cancel.
@ -58,10 +82,11 @@ function satPanel(l){const B=SATS[l.bird],O=SAT_ORB[B.orb],P=SAT_PROV[B.p],load=
if(l.ready>S.day){const tot=Math.max(1,l.ready-l.day),done=clamp((S.day-l.day)/tot,0,1);
h+=`<section><h3>${tr('satellites.being_commissioned')}</h3><div class="kv"><span>${tr('satellites.pointing_dishes_and_testing')}</span><b>${tr('common.n_days_left',{n:l.ready-S.day})}</b></div><div class="bar me"><i style="width:${done*100}%"></i></div></section>`;}
h+=`<section><h3>${tr('common.capacity')}</h3><div class="kv"><span>${capName(l)}${l.standby?' · '+tr('common.standby'):''}</span><b>${fmtG(load)} / ${fmtG(cap)}</b></div><div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div>
${leoDown(l)?`<p class="why">${trn('satellites.leo_safe_mode_n_days',S.ev.sky-S.day)}</p>`:''}
<div class="kv"><span>${tr('common.latency')}</span><b>${tr('satellites.ms_one_way_rtt',{ms:Math.round(ms),rtt:Math.round(2*ms)})}</b></div>
<div class="kv"><span>${tr('satellites.radio_path')}</span><b>${l.km.toLocaleString()} km</b></div>
<div class="kv"><span>${tr('satellites.rent')}</span><b>${tr('common.price_mo',{price:fmt$(l.mo)})}</b></div>
<p class="note">${B.orb==='geo'?tr('satellites.geo_users_notice',{p:pct(O.loss)}):tr('satellites.meo_users_notice',{p:pct(O.loss)})} ${esc(P.blurb)}</p>
<p class="note">${B.orb==='geo'?tr('satellites.geo_users_notice',{p:pct(O.loss)}):B.orb==='meo'?tr('satellites.meo_users_notice',{p:pct(O.loss)}):tr('satellites.leo_users_notice',{p:pct(O.loss),city:CITY[l.a].name})} ${esc(P.blurb)}</p>
<div class="btns">${O.g.filter(g=>g!==l.g).map(g=>btn(`${g>l.g?tr('satellites.grow_to',{cap:fmtCap(g)}):tr('satellites.shrink_to',{cap:fmtCap(g)})} <small>${tr('common.price_mo',{price:fmt$(satMo(l.bird,g))})}</small>`,'satSize',{id:l.id,g},'sm',g>l.g&&S.cash<satMo(l.bird,g))).join('')}</div></section>
${trafficSection(l)}${metricSection(l)}
<section>${btn(UI.confirm===l.id?tr('common.really_cancel'):tr('common.cancel_circuit'),'rmLink',{id:l.id},'ghost sm')}</section></div>`;

View file

@ -0,0 +1,67 @@
// Island Wi-Fi on screen (#83): a city's fact chip and teaser, the zones in its Customers tab, their rows at the teleport.
// Rows are laid out as the teleport section's (name, meta, a bar, small buttons that wrap), so they fit a phone at 360 px.
const wispFact=c=>{if(!wispOn())return '';const n=wispAt(c).length;return n?`<span class="fact">🏝️ ${trn('wisp.n_zones',n)}</span>`:'';};
// A city without a POP of yours: what its islands are, and that a POP comes first.
function wispNoPop(c){if(!wispOn()||S.pops[c])return '';const zs=wispAt(c);if(!zs.length)return '';
return `<section><h3>🏝️ ${tr('wisp.section')}</h3><p class="lead">${tr('wisp.no_pop',{list:zs.map(z=>`<b>${esc(WISP[z].n)}</b> (${tr('wisp.pool',{g:fmtG(wispPool(z))})})`).join(', ')})}</p></section>`;}
// A zone's status: what carries it today, or why nothing does.
function wispStatus(z,Z){if(!Z)return {t:tr('wisp.st_none'),k:'st'};if(wispLit(Z))return wispCut(z)?{t:tr('wisp.st_cut'),k:'restrictive'}:{t:tr('wisp.st_spur'),k:'open'};
const o=Z.sat;if(o&&!(o.ready>S.day))return {t:SAT_ORB[wispOrb(o)].n,k:''};return o||Z.sp?{t:tr('wisp.st_soon'),k:'st'}:{t:tr('wisp.st_none'),k:'st'};}
// Days until the first of a zone's circuits or spur being commissioned comes up; 0 for none.
const wispSoon=Z=>[Z.sat,Z.nxt,Z.sp].reduce((m,o)=>o&&o.ready>S.day&&(!m||o.ready-S.day<m)?o.ready-S.day:m,0);
// In a POP's Customers tab, after Home broadband: one row per zone, one of them open at a time (UI.wz). Until something
// reaches the islands nobody is online: the row says when they will be, not a red 0% served.
function wispHtml(c){if(!wispOn()||!S.pops[c])return '';const zs=wispAt(c);if(!zs.length)return '';
return `<section><h3>🏝️ ${tr('wisp.section')}</h3><p class="lead">${tr('wisp.lead',{rate:fmt$(wispRate(zs[0]))})}</p>${zs.map(wispRow).join('')}</section>`;}
function wispRow(z){const W=WISP[z],Z=wispZ(z),r=R.wisp&&R.wisp[z],P=wispPool(z),st=wispStatus(z,Z),open=UI.wz===z,d=Z?Z.d:0,sf=r?r.sf:0,on=!!Z&&wispTake(Z)>0,n=Z&&!on?wispSoon(Z):0;
let h=`<div class="row"><div class="grow"><div class="nm">${esc(W.n)} <span class="tag ${st.k}">${st.t}</span></div><div class="meta">${tr('wisp.pool',{g:fmtG(P)})}${on?' · '+tr('pie_gov.served',{p:pct(sf)}):n?' · '+tr('city_panel.ready_in_n_d',{n}):''}</div>${on?`<div class="bar me"><i style="width:${Math.min(100,d/P*100)}%"></i></div>`:''}</div>${btn(open?tr('common.close'):tr('common.open'),'wispOpen',{z},'ghost sm')}</div>`;
return open?h+wispOpenHtml(z,Z,r):h;}
// The open zone: its homes and money (once something reaches them; until then, the day it will), its backhaul (the
// circuit, the birds to order on), the spur, closing it. A cut spur or a solar storm is an outage: that one shows in red.
function wispOpenHtml(z,Z,r){const K=Z?wispK(z,Z):0,k=Z?wispLink(z,Z):null;let h='';
if(Z){const sf=r?r.sf:0,cl=sf<0.9?'var(--tx-red,var(--bad))':'var(--eye)',n=K>0?0:wispSoon(Z);
h+=K>0?`<div class="kv"><span>${tr('wisp.homes_online')}</span><b>${tr('city_panel.a_of_b',{a:fmtG(Z.d),b:fmtG(K)})}</b></div>
<div class="kv"><span>${tr('wisp.served')}</span><b style="color:${cl}">${pct(sf)}</b></div>
<div class="kv"><span>${tr('common.revenue')}</span><b>${tr('common.price_mo',{price:fmt$(r?r.d*r.sf*wispRate(z):0)})}</b></div>`:n?`<p class="note">${trn('wisp.online_in_n_days',n)}</p>`:'';
h+=`<div class="kv"><span>${tr('wisp.upkeep')}</span><b>${tr('common.price_mo',{price:fmt$(wispUpMo(z)+(wispLit(Z)?wispSpurMo(z):0))})}</b></div>
${k&&r&&r.d>=k.g*0.98?`<p class="why">${tr('wisp.full')}</p>`:''}`;}
h+=`<p class="note">${tr('wisp.take',{geo:pct(SAT_ORB.geo.wisp),meo:pct(SAT_ORB.meo.wisp),leo:pct(SAT_ORB.leo.wisp)})}</p>${ip4On()?`<p class="note">${tr('wisp.ipv6')}</p>`:''}`;
return `<div class="wisp">${h}${wispBackhaul(z,Z,k)}${wispSpurHtml(z,Z)}${Z?`<div class="btns">${btn(UI.confirm==='wz:'+z?tr('satellites.really_close_it'):tr('wisp.close'),'wispRm',{z},'ghost sm')}</div>`:''}</div>`;}
// Backhaul: the circuit (and a move under way), then a row per bird that sees both the city and the islands.
function wispBackhaul(z,Z,k){const W=WISP[z],c=W.c,C=CITY[c].name,t=teleOf(c);
let h=`<h4 class="sub4">${tr('wisp.backhaul')}</h4>`;
if(satOnly(c))h+=`<p class="why">${tr('wisp.double_hop',{city:C})}</p>`;
const o=Z&&Z.sat,run=(x,now)=>{const O=SAT_ORB[wispOrb(x)],P=SAT_PROV[SATS[x.bird].p],car=now&&k===x&&R.wisp&&R.wisp[z]?R.wisp[z].car:0,u=x.g?car/x.g:0,sb=now&&k&&k.sp;
return `<div class="row">${satLogo(P)}<div class="grow"><div class="nm">${esc(SATS[x.bird].n)} <span class="tag">${O.n}</span>${sb?` <span class="tag st">${tr('common.standby')}</span>`:''}</div><div class="meta">${fmtCap(x.g)} · ${tr('satellites.ms_round_trip',{ms:Math.round(2*wispMs(z,x.bird))})} · ${tr('common.price_mo',{price:fmt$(x.mo)})}${x.ready>S.day?' · '+tr('city_panel.ready_in_n_d',{n:x.ready-S.day}):''}</div>
${now&&wispOrb(x)==='leo'&&leoStorm()?`<p class="why">${trn('satellites.leo_safe_mode_n_days',S.ev.sky-S.day)}</p>`:''}${now?`<div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div>`:''}</div></div>`;};
if(o){const G=SAT_ORB[wispOrb(o)].g;h+=run(o,true)+`<div class="btns">${G.filter(g=>g!==o.g).map(g=>btn(`${g>o.g?tr('satellites.grow_to',{cap:fmtCap(g)}):tr('satellites.shrink_to',{cap:fmtCap(g)})} <small>${tr('common.price_mo',{price:fmt$(wispSatMo(o.bird,g))})}</small>`,'wispSatSize',{z,g},'sm',g>o.g&&S.cash<wispSatMo(o.bird,g))).join('')}${btn(UI.confirm==='wsat:'+z?tr('common.really_cancel'):tr('common.cancel_circuit'),'wispSatRm',{z},'ghost sm')}</div>`;}
if(Z&&Z.nxt)h+=run(Z.nxt,false);
if(!t){h+=`<p class="note">${tr('wisp.no_teleport',{city:C})}</p><div class="btns">${btn(tr('satellites.build_a_teleport_cost_mo',{cost:fmt$(TPORT_COST),mo:fmt$(TPORT_MO)}),'teleBuild',{city:c},'sm',S.cash<TPORT_COST||!!teleWhy(c))}</div>`;return h;}
if(Z&&Z.nxt)return h;
h+=o?`<p class="note">${tr('wisp.move_note')}</p>`:Z?'':`<p class="note">${tr('wisp.kit',{cost:fmt$(wispKit(z))})}</p>`;
const kit=Z?0:wispKit(z);
for(const id of wispBirds(z)){if(o&&o.bird===id)continue;const B=SATS[id],O=SAT_ORB[B.orb],P=SAT_PROV[B.p];if(lvl()<O.lv)continue;
// The teleport's own upgrade, where the bird needs one: tracking antennas for MEO, a Starblink gateway for LEO (and why
// that cannot go up, when it cannot). None once your own constellation flies: wispSatWhy says what the islands have left.
const trk=B.orb==='meo'&&t<2,gw=B.orb==='leo'&&!leoGw(c)&&!leoRival(),why=(trk?trkWhy(c):gw?leoGwWhy(c):'')||wispSatWhy(z,id);
const up=trk?btn(tr('satellites.add_tracking_antennas_cost_mo',{cost:fmt$(TRK_COST),mo:fmt$(TRK_MO)}),'teleTrk',{city:c},'sm',S.cash<TRK_COST||!!trkWhy(c))
:gw?btn(tr('satellites.host_leo_gateway_cost_mo',{cost:fmt$(LEO_GW_COST),mo:fmt$(LEO_GW_MO)}),'teleLeo',{city:c},'sm',S.cash<LEO_GW_COST||!!leoGwWhy(c)):'';
h+=`<div class="row">${satLogo(P)}<div class="grow"><div class="nm">${esc(B.n)} <span class="tag">${O.n}</span></div><div class="meta">${esc(P.n)} · ${tr('satellites.ms_round_trip',{ms:Math.round(2*wispMs(z,id))})} · ${trn('satellites.up_in_n_days',leadDays(O.days))}</div>${why?`<div class="why">${esc(why)}</div>`:''}
<div class="btns">${up||O.g.map(g=>btn(`${fmtCap(g)} <small>${tr('common.price_mo',{price:fmt$(wispSatMo(id,g))})}</small>`,'wispSat',{z,bird:id,g},'sm',!!why||S.cash<wispSatMo(id,g)+kit)).join('')}</div></div></div>`;}
return h;}
// The spur: what it costs and takes, laying it, lit, or cut (with the incident's own rush button).
function wispSpurHtml(z,Z){const W=WISP[z],c=W.c;let h=`<h4 class="sub4">${tr('wisp.spur')}</h4>`;
if(!W.km)return h+`<p class="note">${tr('wisp.spur_none')}</p>`;
const sp=Z&&Z.sp;
if(!sp){const why=wispSpurWhy(z),cost=wispSpurCost(z)+(Z?0:wispKit(z));
return h+`<p class="lead">${tr('wisp.spur_lead',{km:W.km.toLocaleString(),city:CITY[c].name})}</p><div class="meta">${tr('common.price_mo',{price:fmt$(wispSpurMo(z))})} · ${trn('satellites.up_in_n_days',wispSpurDays(z))}</div>
${why?`<div class="why">${esc(why)}</div>`:''}${lvl()<WISP_SPUR_LV?'':`<div class="btns">${btn(tr('wisp.lay_spur',{cost:fmt$(cost)}),'wispSpur',{z},'pink sm',!!why||S.cash<cost)}</div>`}`;}
if(sp.ready>S.day){const tot=Math.max(1,sp.ready-sp.day),done=clamp((S.day-sp.day)/tot,0,1);
return h+`<div class="kv"><span>${tr('wisp.spur_laying')}</span><b>${tr('common.n_days_left',{n:sp.ready-S.day})}</b></div><div class="bar me"><i style="width:${done*100}%"></i></div>`;}
const cut=wispCut(z);if(!cut)return h+`<div class="kv"><span>${tr('wisp.spur_lit',{cap:fmtCap(WISP_SPUR_G)})}</span><b>${W.km.toLocaleString()} km</b></div>`;
const i=S.inc.filter(x=>x.type==='wspur'&&x.z===z).sort((a,b)=>b.until-a.until)[0],up=!!Z.sat&&!(Z.sat.ready>S.day);
return h+`<p class="why">${trn('wisp.spur_cut',cut-S.day)}</p>${i&&i.cost?`<div class="btns">${btn(`${esc(i.fix||tr('common.rush_repair'))} ${fmt$(i.cost)}`,'fixInc',{id:i.id},'red sm',S.cash<i.cost)}</div>`:''}${up?'':`<p class="note">${tr('wisp.spur_trap')}</p>`}`;}
// In the teleport section: the zones' circuits from here, each opening its zone.
function wispTeleRows(c){const zs=wispSats(c);if(!zs.length)return '';
return `<div class="meta">${tr('wisp.tele_reaches')}</div>`+zs.map(z=>{const Z=wispZ(z),o=Z.sat||Z.nxt,k=wispLink(z,Z),car=R.wisp&&R.wisp[z]&&k===Z.sat?R.wisp[z].car:0,u=Z.sat&&Z.sat.g?car/Z.sat.g:0;
return `<div class="row"><div class="grow"><div class="nm">🏝️ ${esc(WISP[z].n)}${k&&k.sp&&Z.sat?' <span class="tag st">'+tr('common.standby')+'</span>':''}</div><div class="meta">${fmtCap(o.g)} · ${esc(SATS[o.bird].n)}${o.ready>S.day?' · '+tr('city_panel.ready_in_n_d',{n:o.ready-S.day}):''} · ${tr('common.price_mo',{price:fmt$(o.mo)})}</div><div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div></div>${btn(tr('common.open'),'wispOpen',{z},'ghost sm')}</div>`;}).join('');}

View file

@ -9,7 +9,7 @@ function renderDash(){checkLayer();
<div class="dgrid">${tile(tr('common.traffic_now'),fmtG(R.served),tr('dashboard.of_g_wanted',{g:fmtG(R.demand)}))}${tile(tr('common.peak'),fmtG(S.stats.peak))}${tile(tr('dashboard.carried'),fmtVol(S.vol||0),tr('dashboard.carried_sub'))}${tile(tr('dashboard.delivered_30_days'),(up*100).toFixed(1)+'%',up>=0.999?tr('dashboard.five_nines_ish'):up>=0.99?tr('dashboard.two_nines_and_change'):tr('dashboard.customers_are_upset'))}${tile(tr('common.peering_ratio'),pct(R.peerShare||0),tr('dashboard.caches_pnis_and_ix'))}${tile(tr('dashboard.monthly_p_l'),`<span style="color:${net>=0?'var(--eye)':'var(--tx-red,var(--bad))'}">${net>=0?'+':''}${fmt$(net)}</span>`,tr('dashboard.in_in_out_out',{in:fmt$(R.revMo),out:fmt$(R.costMo)}))}${tile(tr('common.incidents'),S.stats.incidents,tr('dashboard.n_shrugged_off',{n:S.stats.survived}))}</div>
<div class="dcols"><div class="panel2"><h3>${tr('dashboard.traffic_by_way_out')}</h3>${svgChart(rows,['c','p','ix','t','l2'],[{k:'dem',col:'var(--text)',dash:true}],v=>fmtCap(Math.round(v)),'traffic')}${chartLegend('traffic',k=>k==='dem'?'':' '+pct((R.egT[k]||0)/tot))}</div>
<div class="panel2"><h3>${tr('dashboard.money_per_month')}</h3>${svgChart(rows,[],[{k:'rev',col:'#16A866'},{k:'cost',col:'#FF4D5E'}],v=>fmt$(v),'money')}${chartLegend('money')}
<h3 style="margin-top:8px">${tr('dashboard.where_the_money_goes')}</h3>${Object.entries(R.cost).filter(([k,v])=>v>0).sort((a,b)=>b[1]-a[1]).map(([k,v])=>`<div class="kv"><span>${{pops:tr('dashboard.pops_and_routers'),links:tr('dashboard.waves_and_fiber'),transit:tr('common.transit'),ix:tr('common.ix_ports'),pni:tr('common.pnis'),caches:tr('common.cache_power'),nni:tr('common.fabric_ports'),optical:tr('dashboard.amp_huts_and_spares'),loans:tr('common.loan_repayments'),revshare:tr('dashboard.investor_revenue_share'),extras:tr('dashboard.licenses_and_scrubbing'),wholesale:tr('dashboard.nearly_broadband_network_wholesale'),levy:tr('dashboard.regional_broadband_levy'),pie:tr('pie.costs_row'),ip4:tr('ip4.leases_cgnat_nat64'),sat:tr('satellites.costs_row')}[k]||k}</span><b>${tr('common.price_mo',{price:fmt$(v)})}</b></div>`).join('')}</div></div>`;
<h3 style="margin-top:8px">${tr('dashboard.where_the_money_goes')}</h3>${Object.entries(R.cost).filter(([k,v])=>v>0).sort((a,b)=>b[1]-a[1]).map(([k,v])=>`<div class="kv"><span>${{pops:tr('dashboard.pops_and_routers'),links:tr('dashboard.waves_and_fiber'),transit:tr('common.transit'),ix:tr('common.ix_ports'),pni:tr('common.pnis'),caches:tr('common.cache_power'),nni:tr('common.fabric_ports'),optical:tr('dashboard.amp_huts_and_spares'),loans:tr('common.loan_repayments'),revshare:tr('dashboard.investor_revenue_share'),extras:tr('dashboard.licenses_and_scrubbing'),wholesale:tr('dashboard.nearly_broadband_network_wholesale'),levy:tr('dashboard.regional_broadband_levy'),pie:tr('pie.costs_row'),ip4:tr('ip4.leases_cgnat_nat64'),sat:tr('satellites.costs_row'),wisp:tr('wisp.costs_row')}[k]||k}</span><b>${tr('common.price_mo',{price:fmt$(v)})}</b></div>`).join('')}</div></div>`;
const tT=(R.egT.t||0)||1;
const offMix=(UI.chartOff&&UI.chartOff.mix)||{},filt=Object.keys(offMix).length>0;
// The legend above the table picks which ways in count; "lost" still looks at everything the network gets.

View file

@ -29,6 +29,6 @@ function renderBank(){
${B.equity?`<div class="meta">${tr('bank.taking_pct_of_your_revenue_every',{pct:pct(l.share)})}</div>`:`<div class="kv"><span>${tr('common.still_owed')}</span><b>${fmt$(l.bal)}</b></div><div class="bar me"><i style="width:${Math.min(100,(1-l.bal/l.amount)*100)}%"></i></div><div class="meta">${loanLine(l)}</div>`}
${covList(l)}${l.breach>=1?`<div class="why">${trn('bank.condition_broken_for_n_day',l.breach)} ${l.breach<10?tr('bank.penalty_in_n_days',{n:10-l.breach}):tr('bank.penalties_are_running')}</div>`:''}
<div class="btns" style="margin-top:6px">${btn(UI.confirm===l.id?tr('bank.really_pay_price',{price:fmt$(cost)}):B.equity?tr('bank.buy_them_out_price',{price:fmt$(cost)}):tr('bank.repay_early_price_incl_2_fee',{price:fmt$(cost)}),'repayLoan',{id:l.id},UI.confirm===l.id?'red sm':'sm',S.cash<cost)}</div></div></div>`;}
h+=pieGovBank()+ip4Bank();
h+=lateBank()+pieGovBank()+ip4Bank();
if(h!==UI._bh){UI._bh=h;$('bankCard').innerHTML=h;}
}

View file

@ -2,7 +2,7 @@
some are IPv6-only), the CGNAT and NAT64 ratios, your blocks, and the transfer market. Phones: the boxes are full
width, the dropdowns stack and every button row wraps. */
const ip4Pc=x=>(x*100).toFixed(1).replace(/\.0$/,'')+'%';
function ip4Bank(){if(!S||!ip4On())return '';const I=S.ip4,B=ip4Bill((R.rev&&R.rev.eyeballs)||0),u=B.u,len=ip4LenOk(UI.ip4Len)?UI.ip4Len:IP4_MAX,px=ip4Px(),full=ip4Full();
function ip4Bank(){if(!S||!ip4On())return '';const I=S.ip4,B=ip4Bill(ip4Eye()),u=B.u,len=ip4LenOk(UI.ip4Len)?UI.ip4Len:IP4_MAX,px=ip4Px(),full=ip4Full();
const kv=(l,v,bad)=>`<div class="kv"><span>${l}</span><b${bad?' style="color:var(--tx-red,var(--bad))"':''}>${v}</b></div>`,mo=v=>tr('common.price_mo',{price:fmt$(v)});
let h=`<section class="bank-gov bank-ip4"><h3 id="bankIp4" style="font-size:18px;margin-top:14px">🔢 ${tr('ip4.section')}</h3><p class="meta">${tr('ip4.note')}</p>`;
h+=`<div class="ops-o">${kv(tr('ip4.yours'),ip4N(u.T))}${kv(tr('ip4.business'),ip4N(u.B))}`;

View file

@ -20,5 +20,5 @@ function showHelp(){
<dt>RouteScript</dt><dd>${tr('help.rules_for_your_auto_te_controller')}</dd>
</dl><h3 style="margin:16px 0 0">${tr('help.want_to_know_how_it_really')}</h3>${plugHtml(true)}${chatHtml()}${issueHtml()}</dl><div class="btns" style="margin-top:14px">${btn(UI.started?tr('common.back_to_the_map'):tr('common.got_it'),'helpClose',{},'big')}${RELEASE_NOTES.length?btn(tr('common.what_s_new_in_v',{v:esc(APP_VERSION)}),'whatsNewShow',{},'ghost'):''}${UI.started&&S&&!S.lost?btn(tr('common.start_a_new_network'),'resetAsk',{},'ghost sm'):''}</div><div class="btns" style="margin-top:6px">${UI.started&&S&&!S.lost?btn(tr('common.export_save'),'exportSave',{},'ghost sm'):''}${btn(tr('common.import_a_save'),'importPick',{},'ghost sm')}${btn(tr('transfer.from_another_device'),'xferRecv',{},'ghost sm')}${btn(tr('common.settings'),'settings',{},'ghost sm')}${isPhone()?'':btn(tr('keys.keyboard_shortcuts'),'keys',{},'ghost sm')}</div>`);
}
function showWin(){setTimeout(()=>{const m=$('modalCard');if(m&&!m.querySelector('[data-act=share]'))m.insertAdjacentHTML('beforeend',`<div class="btns" style="margin-top:8px">${btn(tr('help.share_my_network'),'share',{},'pink')}</div><p class="meta" style="margin:12px 0 0">${tr('help.you_built_a_cartoon_internet_now')}</p>${plugHtml(true)}`);},0);openModal(`<h1 style="font-family:var(--display);font-size:44px;margin:0">${tr('help.you_re_a_tier_1')}</h1><p class="tagline">${tr('help.name_as_asn_is_transit_free',{name:esc(S.name),asn:S.asn,days:S.day,n:S.stats.incidents})}</p>${btn(tr('common.keep_building'),'keepPlaying',{},'pink big')}`);sfx('coin');}
function showLose(){openModal(`<h1 style="font-family:var(--display);font-size:40px;margin:0">${tr('common.bankrupt')}</h1><p class="tagline">${tr('help.the_bank_repossessed_your_routers',{name:esc(S.name),days:S.day,peak:fmtG(S.stats.peak)})}</p>${btn(tr('common.try_again'),'newgame',{},'pink big')}`);if(UI.slot){const id=UI.slot;slotDrop(id);slotFree(id);}}
function showWin(){setTimeout(()=>{const m=$('modalCard');if(m&&!m.querySelector('[data-act=share]'))m.insertAdjacentHTML('beforeend',`<div class="btns" style="margin-top:8px">${btn(tr('help.share_my_network'),'share',{},'pink')}</div><p class="meta" style="margin:12px 0 0">${tr('help.you_built_a_cartoon_internet_now')}</p>${plugHtml(true)}`);},0);openModal(`<h1 style="font-family:var(--display);font-size:44px;margin:0">${tr('help.you_re_a_tier_1')}</h1><p class="tagline">${tr('help.name_as_asn_is_transit_free',{name:esc(S.name),asn:S.asn,days:netAge(),n:S.stats.incidents})}</p>${btn(tr('common.keep_building'),'keepPlaying',{},'pink big')}`);sfx('coin');}
function showLose(){openModal(`<h1 style="font-family:var(--display);font-size:40px;margin:0">${tr('common.bankrupt')}</h1><p class="tagline">${tr('help.the_bank_repossessed_your_routers',{name:esc(S.name),days:netAge(),peak:fmtG(S.stats.peak)})}</p>${btn(tr('common.try_again'),'newgame',{},'pink big')}`);if(UI.slot){const id=UI.slot;slotDrop(id);slotFree(id);}}

View file

@ -2834,6 +2834,17 @@
"keys.show_this_list":"Show this list",
"keys.space":"Space",
"keys.zoom_the_map_out_or":"Zoom the map out or in",
"late.bank_note":"For joining this session late. The match is on what home broadband pays you after any wholesale cut, not on island Wi-Fi, and investors take no share of it.",
"late.bb_pitch":{"one":"You joined late: for {n} more day, what homes here pay you is matched.","other":"You joined late: for {n} more days, what homes here pay you is matched."},
"late.card":{"one":"Home broadband pays double for {n} more day: +{price}/mo right now.","other":"Home broadband pays double for {n} more days: +{price}/mo right now."},
"late.hello":"<b>Late to the party, but welcome.</b> This session is {n} days old and hardware costs {p} more than on its first day, so the bank adds {cash} to your starting cash. For your first year, home broadband pays double: every dollar it pays you is matched (island Wi-Fi is not).",
"late.hello_flat":"<b>Late to the party, but welcome.</b> This session is {n} days old. For your first year, home broadband pays double: every dollar it pays you is matched (island Wi-Fi is not).",
"late.match":"Home broadband matched",
"late.over":"Your late joiner's year is over: home broadband pays the usual rate again.",
"late.this_month":"Match this month",
"late.title":"Late joiner's head start",
"late.top_up":"Starting cash top-up",
"late.until":"until {date}",
"latency_contracts.credits_paid":"{price} paid in SLA credits",
"latency_contracts.over_sla":"<b>{name}</b>: {a} ⇄ {b} runs at {ms} ms, over the {max} ms in its contract. Every day over costs you a day's fee in SLA credits ({price}).",
"latency_contracts.sla_terms":"Latency SLA {ms} ms: a day's fee back for every day over it · never more than {max}",
@ -4777,16 +4788,34 @@
"satellites.cancel_n_circuits_first":{"one":"Cancel its satellite circuit first.","other":"Cancel its {n} satellite circuits first."},
"satellites.choose":"Choose",
"satellites.circuit_ordered":{"one":"<b>{cap} on {bird} ordered.</b> {a} ⇄ {b} is being pointed and tested: up in {n} day.","other":"<b>{cap} on {bird} ordered.</b> {a} ⇄ {b} is being pointed and tested: up in {n} days."},
"satellites.close_the_leo_gateway":"Close the LEO gateway",
"satellites.close_the_teleport":"Close the teleport",
"satellites.costs_row":"Teleports and satellites",
"satellites.geo_dishes":"GEO dishes",
"satellites.geo_dishes_and_meo_tracking":"GEO dishes and MEO tracking antennas",
"satellites.geo_users_notice":"From 36,000 km up the round trip is about 600 ms: video calls and games stutter, and users count {p} of the service as bad.",
"satellites.grow_to":"Grow to {cap}",
"satellites.host_leo_gateway_cost_mo":"LEO gateway <small>{cost} + {mo}/mo</small>",
"satellites.in_view_list":"In view: {list}.",
"satellites.it_waits_on_standby":"You already have a link between these two: the satellite waits on standby and carries traffic only when that link is down.",
"satellites.its_blurb":"Old-school C-band and Ku-band beams that cover a whole ocean. Reliable, everywhere, and priced like it.",
"satellites.kac_blurb":"Ka-band spot beams over the western Pacific: the cheapest Gbps in orbit, if your island is under a beam.",
"satellites.leo_backhaul":"Fiber and cables out of {city}",
"satellites.leo_bottleneck":"{city} is full: every island behind this gateway slows down with it. Add routers, a bigger wave or transit here.",
"satellites.leo_comes_at_level":"Low-orbit capacity (about 30 ms round trip) comes at level {lv}.",
"satellites.leo_gateway":"LEO gateway",
"satellites.leo_gateway_closed":"The LEO gateway in {city} is closed.",
"satellites.leo_gateway_unwired":"No fiber of yours leaves {city} any more: the islands behind this gateway reach the rest of your network over another satellite.",
"satellites.leo_gateway_up":"<b>{prov} gateway up in {city}.</b> Their antennas on your roof: rent low-orbit capacity from here to islands within {km} km.",
"satellites.leo_landing":"Landing here from orbit",
"satellites.leo_needs_fiber":"A LEO gateway has to sit on your fiber: {city} reaches the rest of your network only by satellite. Land a cable or a wave there, or buy transit, first.",
"satellites.leo_no_rivals":"{prov} does not sell capacity to a rival constellation, and yours is flying: put a pie dish on the island instead.",
"satellites.leo_out_of_reach":"{prov} is a bent pipe: one satellite has to see your gateway and the island at once, so they can be at most {km} km apart. {a} to {b} is {d} km.",
"satellites.leo_safe_mode_n_days":{"one":"Safe mode through a solar storm: back in {n} day.","other":"Safe mode through a solar storm: back in {n} days."},
"satellites.leo_shell_misses_city":"{prov} does not reach {city}: its shells cover {lat}° either side of the equator.",
"satellites.leo_storm_msg":"A geomagnetic storm: {prov} puts its satellites in safe mode. Your LEO circuits carry nothing until it passes; standby circuits and cables take what they can.",
"satellites.leo_transit":"Transit out of {city}",
"satellites.leo_users_notice":"Bent pipe from 550 km up, about 30 ms round trip: users hardly notice ({p} of the service counts as bad), and selective networks peer with you as over a cable. It lands at your gateway in {city}: when that POP's routers or fiber fill up, every island behind it slows down.",
"satellites.meo_comes_at_level":"The MEO ring (about 130 ms round trip) comes at level {lv}.",
"satellites.meo_ring_misses_city":"The MEO ring does not see {city}: it covers {lat}° either side of the equator.",
"satellites.meo_users_notice":"Much closer to the ground, about 130 ms round trip: users barely notice ({p} of the service counts as bad).",
@ -4795,7 +4824,9 @@
"satellites.ms_round_trip":"{ms} ms round trip",
"satellites.n_birds_see_both":{"one":"{n} satellite sees both","other":"{n} satellites see both"},
"satellites.n_circuits_go_on_standby":{"one":"Your satellite circuit between {a} and {b} goes on standby beside the new link: it carries traffic only when that link is down.","other":"Your {n} satellite circuits between {a} and {b} go on standby beside the new link: they carry traffic only when that link is down."},
"satellites.n_in_leo_reach":{"one":"{n} island or remote town within {km} km of this gateway.","other":"{n} islands and remote towns within {km} km of this gateway."},
"satellites.n_places_in_reach":{"one":"{n} island or remote town in reach at your level.","other":"{n} islands and remote towns in reach at your level."},
"satellites.needs_leo_gateway":"LEO capacity needs a gateway at your teleport in {city}.",
"satellites.needs_tracking_antennas":"The MEO ring needs tracking antennas at your teleport in {city}.",
"satellites.new_pop_cost":"new POP {cost}",
"satellites.no_bird_sees_both":"No satellite on sale sees both {a} and {b}.",
@ -4819,9 +4850,11 @@
"satellites.rent_satellite_capacity":"Rent satellite capacity",
"satellites.satellite_capacity":"Satellite capacity",
"satellites.satellites":"Satellites",
"satellites.sbk_blurb":"Thousands of small satellites 550 km up, about 30 ms there and back: the first satellite your users will not complain about. They blink from one satellite to the next every few seconds; nobody notices.",
"satellites.sea_americas":"Americas",
"satellites.sea_atlantic":"Atlantic",
"satellites.sea_indian":"Indian Ocean",
"satellites.sea_leo":"within 56° of the equator, 550 km up",
"satellites.sea_pacific":"Pacific",
"satellites.sea_tropics":"within 50° of the equator",
"satellites.sea_west_pacific":"Western Pacific",
@ -4833,7 +4866,8 @@
"satellites.teleports_unlock_at_level":"Teleports unlock at level {lv}.",
"satellites.tracking_antennas_up":"<b>Tracking antennas up in {city}.</b> They follow the MEO ring across the sky.",
"satellites.up_in_n_days":{"one":"up in {n} day","other":"up in {n} days"},
"satellites.users_notice_geo_meo":"Users notice the lag: broadband over GEO counts as half the service, over MEO almost all of it. A cable always beats it, so your routers only send traffic up when there is no other way.",
"satellites.users_notice_geo_meo":"Users notice the lag: broadband over GEO counts as half the service, over MEO almost all of it. A cable beats both, so your routers only send traffic up there when there is no other way.",
"satellites.users_notice_leo":"Over LEO, about 30 ms round trip, users hardly notice, and selective networks peer as they would over a cable. Next to a cable it waits on standby.",
"satellites.users_ride_a_satellite":"users ride a satellite",
"satellites.via_bird":"via {bird}",
"satellites.who_a_satellite_serves":"Satellites serve small islands and remote towns that the same satellite sees as your teleport. Pick where to.",
@ -5238,6 +5272,60 @@
"utilities.title":"Utilities",
"utilities.two_routers":"At least two routers",
"utilities.view_pop":"View PoP",
"wisp.backhaul":"Backhaul",
"wisp.close":"Close island Wi-Fi",
"wisp.closed":"Island Wi-Fi on {zone} is closed.",
"wisp.costs_row":"Island Wi-Fi: towers and spurs",
"wisp.cut_anchor":"A ship's anchor dragged across the {zone} spur off {city}.",
"wisp.cut_dark":"Nothing else reaches the islands: they are offline until it is mended.",
"wisp.cut_sat":"The satellite circuit carries the islands meanwhile.",
"wisp.cut_slide":"An undersea landslide snapped the {zone} spur.",
"wisp.cut_trawler":"A trawler snagged the {zone} spur.",
"wisp.cut_volcano":"An undersea volcano erupted on top of the {zone} spur.",
"wisp.decom":"Island Wi-Fi closes with it: {list}.",
"wisp.double_hop":"Double hop: {city} reaches the world only by satellite, so the islands' traffic would go up twice. Bring {city} a cable first.",
"wisp.full":"The link is full: homes are waiting.",
"wisp.homes_online":"Homes online",
"wisp.inc_title":"Spur cut",
"wisp.ipv6":"Its homes are IPv6-only (464XLAT) from day one: their IPv4 shares the NAT64 pool, so the islands never need a block of their own.",
"wisp.kit":"The first order brings the island kit too: towers, solar panels and home radios, {cost}.",
"wisp.lay_spur":"Lay the spur {cost}",
"wisp.lead":"No cable reaches these islands' homes, so you can be their internet: satellite capacity from a teleport here first, a spur cable later. Islanders pay island prices: {rate} a Gbps a month.",
"wisp.leo_no_rivals":"{prov} does not sell capacity to a rival constellation, and yours is flying: these islands can still have GEO or MEO capacity, or a spur cable.",
"wisp.move_note":"Order on another satellite to move the islands there: the old circuit carries until the new one is up.",
"wisp.moved":"{zone} now rides {bird}.",
"wisp.moving":{"one":"{cap} on {bird} ordered for {zone}: the islands move over in {n} day.","other":"{cap} on {bird} ordered for {zone}: the islands move over in {n} days."},
"wisp.n_zones":{"one":"{n} island zone","other":"{n} island zones"},
"wisp.no_pop":"Open a POP here to bring Wi-Fi to the islands around it: {list}.",
"wisp.no_teleport":"Satellite capacity for the islands comes down at a teleport in {city}. Build one there first.",
"wisp.online":"{zone} is online: the first islanders are signing up.",
"wisp.online_in_n_days":{"one":"The islands come online in {n} day: the first homes sign up then.","other":"The islands come online in {n} days: the first homes sign up then."},
"wisp.ordered":{"one":"{cap} on {bird} ordered for {zone}: islanders go online in {n} day.","other":"{cap} on {bird} ordered for {zone}: islanders go online in {n} days."},
"wisp.pool":"{g} of homes",
"wisp.rush":"Charter a repair ship",
"wisp.section":"Island Wi-Fi",
"wisp.served":"Served on the islands",
"wisp.spur":"Spur cable",
"wisp.spur_cut":{"one":"Cut: the repair ship is {n} day away.","other":"Cut: the repair ship is {n} days away."},
"wisp.spur_laying":"Cable ship laying the spur",
"wisp.spur_lead":"{km} km of subsea cable from {city}. Development banks paid for most of it; this is your share. Everyone on the islands can sign up once it is lit, and nothing is rented.",
"wisp.spur_level":"Spurs come at level {lv}.",
"wisp.spur_lit":"Spur lit, {cap}",
"wisp.spur_none":"Too far, or too much sea ice, for a spur: these islands stay on satellites.",
"wisp.spur_ordered":{"one":"A cable ship sails to lay the {zone} spur: lit in {n} day.","other":"A cable ship sails to lay the {zone} spur: lit in {n} days."},
"wisp.spur_ready":"The {zone} spur is lit: everyone on the islands can sign up now.",
"wisp.spur_trap":"One cable is one point of failure: when it is cut, the repair ship takes weeks. A satellite circuit kept on standby carries the islands meanwhile.",
"wisp.st_cut":"Spur cut",
"wisp.st_none":"No link yet",
"wisp.st_soon":"Coming up",
"wisp.st_spur":"Spur",
"wisp.take":"Islanders sign up as far as the link lets them: about {geo} over GEO, {meo} over MEO, {leo} over LEO, all of them over a cable.",
"wisp.tele_reaches":"Island Wi-Fi from this teleport:",
"wisp.upkeep":"Towers, solar and crews",
"wisp.why_moving":"A move to another satellite is under way.",
"wisp.why_no_pop":"Open a POP in {city} first: the islands' crews and licence work from there.",
"wisp.why_same":"The islands ride {bird} already: resize that circuit instead.",
"wisp.why_spur_have":"The spur is laid already.",
"wkscn.copy_my_result":"Copy my result",
"wkscn.desc_a_g_event_comes_to":"A {g} event comes to {city} on day {day}. Build the network it needs, from nothing.",
"wkscn.desc_a_ship_dragged_its_anchor":"A ship dragged its anchor across {cab}. Find another way from {a} to {b}.",

View file

@ -11,7 +11,7 @@ const { load } = require('./harness');
const BAD = ['__proto__', 'constructor', 'prototype', 'toString', 'hasOwnProperty', 'valueOf'];
// The other args an action may need before it looks the name up: ptSave a kind, ptApply a kind and a price.
const WITH = { k: 'micro', cost: 0 };
const ARGS = ['city', 'id', 'net', 'k', 'c', 'v', 'a', 'b', 'to', 'from', 'link', 's'];
const ARGS = ['city', 'id', 'net', 'k', 'c', 'v', 'a', 'b', 'to', 'from', 'link', 's', 'z'];
test('no action reaches a built-in through an arg that names one', (t) => {
// The development page: API_CMD is every action an agent may send (the MCP facade), the sent ones of a server's page.

View file

@ -171,6 +171,42 @@ test('buying, leasing in, leasing out and selling move the right money', (t) =>
assert.deepEqual(errors, []);
});
test('investors on a revenue share take their cut of IPv4 lease income, not of a sale', (t) => {
const { ev, dom, errors } = game(t);
homes(ev, 20);
ev("S.loanOffers.push({id:'v1',bank:'vult',amount:500000,exp:S.day+20,covs:['blitz'],share:0.1});ACT.takeLoan({id:'v1'})");
const base = () => ev('R.rev.eyeballs+R.rev.business+R.rev.ix+(R.rev.orbit||0)');
const rs0 = ev('R.cost.revshare');
assert.ok(rs0 > 0 && Math.abs(rs0 - 0.1 * base()) < 1e-6, 'the vultures take 10% of what homes pay');
ev('ACT.ip4Buy({len:20})');
const id = ev("S.ip4.b.find(b=>b.k==='buy').id");
ev(`ACT.ip4Out({id:${lit(id)}})`);
const lout = ev('R.rev.ip4');
assert.equal(lout, ev('ip4OutMo(20)'));
assert.ok(Math.abs(ev('R.cost.revshare') - 0.1 * (base() + lout)) < 1e-6, 'and 10% of the lease too');
assert.ok(Math.abs(ev('R.cost.revshare') - 0.1 * (ev('R.revMo') - ev('R.rev.grant||0') - ev('R.rev.gov||0'))) < 1, 'of everything but government money');
// A bank's big loan with a revenue share takes its share of the lease while it runs, and stops once repaid.
ev("S.loans.push({id:'b1',bank:'db',start:S.day,amount:2e6,got:2e6,bal:2e6,apr:0.1,apr0:0.1,pay:1,left:12,term:12,share:0.05,covs:[],base:{sub:0}});compute()");
assert.ok(Math.abs(ev('R.cost.revshare') - 0.15 * (base() + lout)) < 1e-6);
ev("S.loans.find(l=>l.id==='b1').bal=0;compute()");
assert.ok(Math.abs(ev('R.cost.revshare') - 0.1 * (base() + lout)) < 1e-6);
// Taking the block back ends the cut; selling it is a one-off that is all yours, like a fiber pair's up-front price.
ev(`ACT.ip4Back({id:${lit(id)}})`);
assert.equal(ev('R.rev.ip4'), undefined);
assert.ok(Math.abs(ev('R.cost.revshare') - rs0) < 1e-6);
ev('S.day+=730;compute()');
const rs1 = ev('R.cost.revshare'), cash = ev('S.cash');
ev(`ACT.ip4Sell({id:${lit(id)}});ACT.ip4Sell({id:${lit(id)}})`);
assert.equal(ev(`S.ip4.b.some(b=>b.id===${lit(id)})`), false);
assert.equal(ev('S.cash'), cash + ev('ip4Value(20)'));
assert.ok(Math.abs(ev('R.cost.revshare') - rs1) < 1e-6);
// The dashboard's Investor revenue share row shows the new amount.
ev("ACT.ip4Buy({len:20});ACT.ip4Out({id:S.ip4.b.filter(b=>b.k==='buy').pop().id});UI.dtab='overview';renderDash()");
assert.ok(ev('R.cost.revshare') > rs1, 'a new lease is shared again');
assert.ok(dom.window.document.getElementById('dash').textContent.includes(ev('fmt$(R.cost.revshare)')));
assert.deepEqual(errors, []);
});
test('a list of blocks stops where a save keeps them: buying and leasing past it is refused, and a full save loads whole', (t) => {
const { ev, dom, errors } = load({ agent: true });
t.after(() => dom.window.close());

View file

@ -2,8 +2,9 @@
// A server-run network's page loads the server's state with migrate() (it never trusts state it did not check), and
// the server checks every action against the save path; both need migrate(live S) to change nothing. A year of a big
// network with everything on (DDoS, failures, events, the intern on every order, the sales desk on auto, IPv6-only, and
// once before the year everything else a network can own: an own exchange, scrubbing centers, teleports, satellites,
// dark fiber, an own cable, a subsea seat, exchange points, the backbone core, the redundancy kit, the bulk orders),
// once before the year everything else a network can own: an own exchange, scrubbing centers, teleports, LEO gateways,
// satellites, an island Wi-Fi zone with a circuit and a spur, dark fiber, an own cable, a subsea seat, exchange points,
// the backbone core, the redundancy kit, the bulk orders),
// checked every day. T1_BASE=<git ref> also plays the same year on the page at that ref: the same money, customers,
// incidents, dice and ids every day, so making the state canonical changed no play.
const test = require('node:test');
@ -29,6 +30,9 @@ function open(file) {
for(const c of pops.slice(0,40)){if(Object.keys(S.myIx).length)break;tryA('foundIx',{city:c});}
for(const c of pops.slice(0,6))tryA('buildScrub',{city:c});
for(const c of pops.slice(0,4))tryA('teleBuild',{city:c});
for(const c of pops.slice(0,4))tryA('teleLeo',{city:c});
{let n=0;for(const a of pops.slice(0,4))for(const b of satTargets(a)){if(n>=1)break;if(!satWhy(a,b,LEO_BIRD,5)){tryA('buySat',{a,b,bird:LEO_BIRD,g:5});n++;}}}
tryA('buildPop',{city:'suv'});tryA('teleBuild',{city:'suv'});tryA('wispSat',{z:'vanualevu',bird:'kac1',g:2});tryA('wispSpur',{z:'vanualevu'});
{let n=0;for(const a of pops.slice(0,12))for(const b of pops.slice(12,30)){if(n>=2)break;for(const bird of Object.keys(SATS))for(const g of [1,2,5,10]){if(n>=2)break;if(!satWhy(a,b,bird,g)){tryA('buySat',{a,b,bird,g});n++;}}}}
{let n=0;for(const a of pops.slice(0,10))for(const b of pops.slice(10,40)){if(n>=2)break;if(kmBetween(a,b)<900&&!noTalk(a,b)){UI.pending={a,b};UI.dfSrc='build';const k=S.links.length;tryA('orderDf');if(S.links.length>k)n++;}}}
{let n=0;for(const a of pops.slice(0,30))for(const b of Object.keys(CITY)){if(n>=1)break;if(S.pops[b]||a===b)continue;UI.pending={a,b};const k=S.links.length;if(!ownCabWhy(a,b)){tryA('orderCable');if(S.links.length>k)n++;}}}
@ -41,7 +45,7 @@ function open(file) {
UI.pending=null;closeModal();compute();`);
return h;
}
const BUILT = ['foundIx', 'buildScrub', 'teleBuild', 'buySat', 'orderDf', 'orderCable', 'seatBuy', 'coreUp', 'xpBuild', 'utilityKit', 'pniAll', 'bstdApply'];
const BUILT = ['foundIx', 'buildScrub', 'teleBuild', 'teleLeo', 'buySat', 'wispSat', 'wispSpur', 'orderDf', 'orderCable', 'seatBuy', 'coreUp', 'xpBuild', 'utilityKit', 'pniAll', 'bstdApply'];
// In the page: every top-level key whose JSON differs between live S and what a reload makes of it, both ways a reload
// happens (the full state a page takes, and the save text). uidN and the dice are put back: a reload may draw ids.
@ -82,6 +86,7 @@ test(`a year of a big network with everything on: live state is what a reload ma
const did = JSON.parse(head.ev('JSON.stringify(__did)'));
assert.deepEqual(did.filter((x) => / threw /.test(x)), [], 'nothing threw while building');
for (const a of BUILT) assert.ok(did.includes(a), `${a} built something before the year (${did.join(', ')})`);
assert.ok(head.ev('S.links.some(l=>l.bird===LEO_BIRD)'), 'a LEO circuit before the year');
assert.equal(head.ev('S.slAuto.on'), true);
assert.ok(head.ev("Object.values(S.pops).filter(p=>p.bb&&(p.bb.v6||p.bb.v6e)).length") >= 3, 'IPv6-only homes on the way');
const seen = { ddos: 0, inc: 0, starts: 0 };

View file

@ -1 +1 @@
{"t":"clock","speed":1,"eff":1,"run":true,"why":null,"votes":{"efgh5678":4},"tally":{"4":1},"need":2,"active":["abcd1234","efgh5678"],"hold":[],"idle":[],"day":518,"last":1,"max":8,"off":{"abcd1234":-473,"efgh5678":0}}
{"t":"clock","speed":1,"eff":1,"run":true,"why":null,"votes":{"efgh5678":4},"tally":{"4":1},"need":2,"active":["abcd1234","efgh5678"],"hold":[],"idle":[],"day":518,"last":1,"max":8}

View file

@ -1 +1 @@
{"t":"roster","code":"K7Q2XD","title":"Friday","preset":"oncall","seed":424242,"created":1730913600000,"players":[{"pid":"abcd1234","name":"Packet Pals","asn":201234,"color":"#3a86ff","card":{"day":45,"name":"Packet Pals","asn":201234,"tier":"t3","t1":false,"lvl":2,"pops":["fra","ams"],"links":[["ams","fra",10]],"ix":[],"transit":["cog"],"ppol":"open","reach":1,"peak":47.5,"served":47.5,"cust":0,"rev":7126,"cashB":5,"score":48},"seen":1731000000000,"joined":1730913600000},{"pid":"efgh5678","name":"Tubular Bells","asn":207777,"color":"#ff4f9a","card":null,"seen":1730999940000,"joined":1730996400000}],"feed":[{"k":"join","pid":"abcd1234","name":"Packet Pals","at":1730913600000},{"k":"join","pid":"efgh5678","name":"Tubular Bells","at":1730996400000},{"k":"chat","pid":"efgh5678","name":"Tubular Bells","at":1730999940000,"text":"peer with me?"}],"on":["abcd1234","efgh5678"]}
{"t":"roster","code":"K7Q2XD","title":"Friday","preset":"oncall","seed":424242,"created":1730913600000,"players":[{"pid":"abcd1234","name":"Packet Pals","asn":201234,"color":"#3a86ff","card":{"day":518,"name":"Packet Pals","asn":201234,"tier":"t3","t1":false,"lvl":2,"pops":["fra","ams"],"links":[["ams","fra",10]],"ix":[],"transit":["cog"],"ppol":"open","reach":1,"peak":47.5,"served":47.5,"cust":0,"rev":14252,"cashB":5,"score":48},"seen":1731000000000,"joined":1730913600000},{"pid":"efgh5678","name":"Tubular Bells","asn":207777,"color":"#ff4f9a","card":null,"seen":1730999940000,"joined":1730996400000}],"feed":[{"k":"join","pid":"abcd1234","name":"Packet Pals","at":1730913600000},{"k":"join","pid":"efgh5678","name":"Tubular Bells","at":1730996400000},{"k":"chat","pid":"efgh5678","name":"Tubular Bells","at":1730999940000,"text":"peer with me?"}],"on":["abcd1234","efgh5678"]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -171,6 +171,14 @@ test('W5: every island city can be reached: it shares its land, has a cable, or
fail('W5', bad, 'land a cable there or give it beach:true');
});
test('W6: every island Wi-Fi zone hangs off a satellite city within 1,000 km, seen with it by a GEO bird; pool 3 to 12 G; a spur of at most 1,500 km or none', () => {
const ids = J('Object.keys(WISP)');
assert.deepEqual(ids, [...ids].sort(), 'W6: zone ids sorted');
fail('W6', J(`Object.keys(WISP).filter(z=>{const W=WISP[z],C=CITY[W.c];return !C||!satRemote(W.c)||hav(C.lon,C.lat,W.lon,W.lat)>1000
||!Object.keys(SATS).some(id=>SATS[id].orb==='geo'&&satPairAt(id,C,W))||!(W.P>=3&&W.P<=12)||!(W.km===0||W.km>0&&W.km<=1500)||typeof W.n!=='string'||!W.n.trim();}).map(z=>z+' ('+WISP[z].c+')')`),
'hang the zone off the island city it looks to (one a satellite serves), within 1,000 km, where a GEO bird sees both; 3 to 12 G of homes; a spur of at most 1,500 km, or km:0');
});
// ---------- Networks ----------
test('N1: network ids and ASNs are unique, ASNs are valid', () => {
@ -555,6 +563,44 @@ test('F10: growth goes sideways, plus one paid way up (#61, #323)', () => {
fail('F10', J("MEGA.filter(m=>!CITY[m.c]).map(m=>m.c)"), 'campuses sit in real cities');
});
test('F11: a late joiner starts on the session\'s date with F1\'s gentle start, a hardware top-up and a year of home broadband matched', () => {
const g = load();
const D = 1868, MP = { code: 'K7Q2XD', pid: 'abcd1234', asn: 201234, seed: 424242, preset: 'oncall', color: '#3a86ff', title: 'Friday' };
g.ev(`UI.pitched=true;beginState('Late','fra',{mode:'normal',preset:'oncall',mp:${lit(MP)},day:${D}});S.mp.sim=1;compute()`);
// The session's date, F1's start counted from its own first day.
assert.deepEqual(JSON.parse(g.ev('JSON.stringify([S.day,S.day0,S.nextFail-S.day0,S.nextEvent-S.day0])')), [D, D, 45, 40], 'F11: the session\'s date, and F1\'s first outage and event');
const opts = JSON.parse(g.ev(`(()=>{let o=null;const f=eval('('+fireEvent.toString().replace('const e=pick(opts);','o=opts.slice();return;')+')');S.day=S.day0+45;f();S.day=S.day0;return JSON.stringify(o);})()`));
fail('F11', opts.filter((e) => !['viral', 'price', 'grant'].includes(e)), 'no bad events before its day 50 (count S.day-S.day0: netAge())');
assert.equal(g.ev("(()=>{for(let a=0;a<90;a++){S.day=S.day0+a;if(CITIES.some(c=>soldOut('fra',c.id,1)))return true;}S.day=S.day0;return false;})()"), false, 'F11: nothing sold out in its first 90 days');
// The top-up: the rise in hardware prices on START_CASH, at most $60k; the market stays on the session's date.
const top = g.ev('S.cash-START_CASH');
assert.ok(top === Math.round(g.ev(`START_CASH*(hwTrend(${D})-1)`) / 1000) * 1000 && top > 0 && top <= 60000, `F11: a top-up of ${top}`);
assert.equal(g.ev('lateCash(1e6)'), 60000, 'F11: never more than $60k');
assert.equal(g.ev('hwMul("rt")'), g.ev(`hwTrend(${D})`), 'F11: hardware at the session\'s price');
// The match: what homes pay after wholesale, for 365 days, outside investors' share.
g.ev("S.cash=1e7;ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});S.loans.push({id:'v',bank:'vult',start:S.day,amount:1,got:1,bal:0,share:0.1,covs:[]});compute()");
const r = JSON.parse(g.ev('JSON.stringify([R.rev.eyeballs,R.rev.late,R.cost.revshare])'));
assert.ok(r[0] > 0 && r[1] === r[0], 'F11: home broadband matched');
assert.ok(Math.abs(r[2] - 0.1 * r[0]) < 1e-6, 'F11: investors take no share of the match');
assert.equal(g.ev('(()=>{S.day=S.day0+366;compute();const v=R.rev.late;S.day=S.day0;compute();return v===undefined;})()'), true, 'F11: for one year');
assert.deepEqual(g.errors, []);
});
test('F12: island Wi-Fi pays on its own books on some way in; a spur beats every satellite, and pays back within 5 years up to 250 km, 10 up to 1,000 km', () => {
// The zone's own books at full take-up, era 1: its homes at island prices, less the towers' upkeep and the backhaul
// rent. The teleport, tracking antennas and a Starblink gateway serve more than one zone and are left out. Each way in
// at its best size; a spur at its price before the market moves it.
const rows = J(`Object.keys(WISP).map(z=>{const W=WISP[z],R=wispRate(z),up=wispUpMo(z),o={z,km:W.km};
for(const id of wispBirds(z)){const orb=SATS[id].orb;for(const g of SAT_ORB[orb].g){const pl=Math.min(W.P*SAT_ORB[orb].wisp,g)*R-wispSatMo(id,g)-up;if(o[orb]===undefined||pl>o[orb])o[orb]=pl;}}
if(W.km){o.sp=W.P*R-up-wispSpurMo(z);o.cost=Math.round((WISP_SPUR+WISP_SPUR_KM*W.km)/1000)*1000;}return o;})`);
fail('F12', rows.filter((r) => !(Math.max(r.geo ?? -Infinity, r.meo ?? -Infinity, r.leo ?? -Infinity, r.sp ?? -Infinity) > 0)).map((r) => r.z), 'every zone makes money on at least one way in: raise WISP_ARPU or WISP_SHARE, or the pool');
fail('F12', rows.filter((r) => r.sp !== undefined && ['geo', 'meo', 'leo'].some((o) => r[o] !== undefined && r[o] >= r.sp)).map((r) => r.z), 'a spur earns more than any satellite option');
fail('F12', rows.filter((r) => r.meo !== undefined && r.geo !== undefined && r.meo < r.geo || r.leo !== undefined && r.meo !== undefined && r.leo < r.meo).map((r) => r.z), 'MEO earns at least as much as GEO, and LEO as MEO, where both reach');
// Payback in whole months against the best GEO or MEO stage (LEO needs a level-5 gateway, off the zone's books).
const pay = (r) => Math.round(r.cost / (r.sp - Math.max(r.geo ?? 0, r.meo ?? 0, 0)));
fail('F12', rows.filter((r) => r.sp !== undefined && (r.km <= 250 && pay(r) > 60 || r.km <= 1000 && pay(r) > 120)).map((r) => `${r.z} (${r.km} km): ${pay(r)} months`), 'spurs up to 250 km pay back within 5 years, up to 1,000 km within 10');
});
test('D1: attack sizes come from the world, never from your network', () => {
const g = load();
ddFra(g.ev);
@ -733,6 +779,32 @@ test('O7: a fresh Tier 1 cannot afford a full Shortcrust in its first year', ()
// O7's other half (a full lasered Shortcrust pays back in 5 to 10 years, never sooner) is played through the game loop
// in tests/pie-balance.test.js, so it counts launches, aging, incidents, churn and every running cost.
test('O8: rented LEO reaches only near a gateway on your fiber under its shell, stops selling once your crust carries, and costs more than a subsea wave', () => {
const g = load();
g.ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e9;S.lvl=SAT_ORB.leo.lv;S.nextFail=S.nextEvent=1e9;UI.speed=0;S.rules=makeRules('freeze')");
// Every pair the bird is sold on: at most km apart, both ends under the shell.
fail('O8', JSON.parse(g.ev("JSON.stringify((()=>{const O=SAT_ORB.leo,out=[];for(const A of CITIES)for(const B of CITIES){if(A.id>=B.id||!satPairOk(LEO_BIRD,A.id,B.id))continue;if(kmBetween(A.id,B.id)>O.km||Math.abs(A.lat)>O.lat||Math.abs(B.lat)>O.lat)out.push(A.id+'-'+B.id+' '+kmBetween(A.id,B.id)+' km');}return out;})())")),
'a LEO circuit beyond one satellite\'s bent pipe: keep SAT_ORB.leo.km and lat in satPairOk');
assert.ok(g.ev("Object.keys(SATS).filter(id=>SATS[id].orb==='leo').join()===LEO_BIRD"), 'O8: one rented LEO bird');
// The gateway sits on your fiber: an island only a satellite reaches cannot host one; beyond the shell, nobody can.
g.ev("ACT.buildPop({city:'suv'});ACT.teleBuild({city:'suv'});ACT.buildPop({city:'anc'});S.pops.anc.tele=1;ACT.buildPop({city:'ccs'});ACT.teleBuild({city:'ccs'})");
assert.notEqual(g.ev("leoGwWhy('suv')"), '', 'O8: a gateway on an island off your fiber');
assert.notEqual(g.ev("leoGwWhy('anc')"), '', 'O8: a gateway beyond the shell');
assert.notEqual(g.ev("satWhy('ccs','cur',LEO_BIRD,10)"), '', 'O8: a LEO circuit without a gateway');
g.ev("ACT.teleLeo({city:'ccs'});ACT.buySat({a:'ccs',b:'cur',bird:LEO_BIRD,g:10});closeModal();ACT.buyTransit({city:'ccs',net:'drz',tier:1});ACT.launchBB({city:'cur'});closeModal()");
assert.equal(g.ev('S.links.filter(l=>l.bird===LEO_BIRD).length'), 1, 'O8: a gateway on the mainland sells');
// Your own crust carries: nothing new from Starblink, not even growth; what you rent keeps running.
g.ev('S.pieV=1;pieInit();S.pie.crusts.short.cohorts=[{n:CRUSTS.short.full,day:S.day,las:false}];S.day=S.links.find(l=>l.bird===LEO_BIRD).ready;compute()');
assert.ok(g.ev('Object.keys(CRUSTS).some(id=>pieCarry(id)>0)'), 'a crust carries');
for (const x of ["satWhy('ccs','gnd',LEO_BIRD,10)", "leoGwWhy('ccs')", 'leoGrowWhy(S.links.find(l=>l.bird===LEO_BIRD))']) assert.notEqual(g.ev(x), '', `O8: ${x} once your own constellation carries`);
assert.equal(g.ev("leoReachLL('ccs',CITY.cur.lat,CITY.cur.lon)"), false, 'O8: no WISP reach either');
assert.ok(g.ev('R.load[S.links.find(l=>l.bird===LEO_BIRD).id]') > 0, 'O8: a circuit you rent keeps carrying');
// Dearer per Gbps than any subsea wave over its whole reach, so a cable is always the better buy where one can go.
const dear = JSON.parse(g.ev('JSON.stringify(SAT_ORB.leo.g.flatMap(n=>LT.map((t,i)=>[n,t.g,satMo(LEO_BIRD,n)/n,waveMo(SAT_ORB.leo.km,true,i)/t.g])))'));
fail('O8', dear.filter((x) => x[2] <= x[3]).map((x) => `${x[0]}G LEO at ${Math.round(x[2])}/G is no dearer than a ${x[1]}G subsea wave at ${Math.round(x[3])}/G`), 'raise SAT_PROV.sbk.pg');
assert.deepEqual(g.errors, []);
});
test('no page errors while checking the rules', () => {
assert.deepEqual(errors, []);
});

257
tests/late-joiners.test.js Normal file
View file

@ -0,0 +1,257 @@
// Late joiners (src/game/60-features/81-late-joiners.js, docs/plans/server-run.md "What Q1 changes"): a network that
// joins a server session after day 180 begins on the session's date (S.day0), counts its first-days rules from there
// (netAge()), gets a top-up as large as the rise in hardware prices and has its first year of home broadband income
// matched, outside investors' share. The market and the calendar stay the session's. Nothing of it outside a session.
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
const { lit } = require('../scripts/lib/js-literal');
const MP = { code: 'K7Q2XD', pid: 'abcd1234', asn: 201234, seed: 424242, preset: 'oncall', color: '#3a86ff', title: 'Friday' };
const D = 1868;
// A network of a server session, begun the way the server begins one (srvBegin), on day `day` of the session.
function late(t, { day = D, home = 'fra', preset = 'oncall', mp = MP } = {}) {
const h = load();
t.after(() => h.dom.window.close());
h.ev(`Date.now=()=>1.7e12;UI.pitched=true;beginState('Late Bloomers',${lit(home)},{mode:'normal',preset:${lit(preset)},${mp ? `mp:${lit(mp)},` : ''}day:${day}});
if(S.mp)S.mp.sim=1;compute();beginHello();UI.started=true;UI.speed=0;`);
return h;
}
const J = (ev, x) => JSON.parse(ev(`JSON.stringify(${x})`));
// Live S against what a reload makes of it, as text (never deep-compared as objects).
const same = (ev) => ev('(()=>{const u=uidN,r=S.rng;try{return JSON.stringify(S)===JSON.stringify(migrate(JSON.parse(JSON.stringify(S))));}finally{uidN=u;S.rng=r;}})()');
const homes = (ev, c = 'fra') => ev(`S.cash=1e7;ACT.launchBB({city:${lit(c)}});S.pops[${lit(c)}].bb.d=40;ACT.buyTransit({city:${lit(c)},net:NETS.filter(n=>sellsAt(n,${lit(c)}))[0].id,tier:1});compute();
if(!S.transit.length||!(R.rev.eyeballs>0))throw new Error('no homes served');`);
test('a late network starts on the session\'s date, its schedules and first block stamped with it, and a reload keeps it', (t) => {
const { ev, errors } = late(t);
assert.deepEqual(J(ev, '[S.day,S.day0,S.nextFail,S.nextEvent,S.pops.fra.day]'), [D, D, D + 45, D + 40, D]);
assert.deepEqual(J(ev, 'S.ip4.b.map(b=>[b.d,ip4Held(b)])'), [[D, true]], 'its RIR block cannot be sold on day one at the session\'s price');
assert.equal(ev('S.cash'), ev('START_CASH') + 37000, 'hardware costs 18% more on day 1868: the bank adds $37k');
assert.equal(ev('netAge()'), 0);
// The welcome, then the late welcome, which opens the bank (newest first in the log).
const log = J(ev, 'S.log.slice(0,2).map(x=>[x.k,x.h,x.o&&x.o.a])');
assert.deepEqual(log, [['goal', 'Late to the party, but welcome.', 'bank'], ['goal', 'Welcome, Late Bloomers!', 'city']]);
assert.match(ev('S.log[0].t'), /This session is 1868 days old and hardware costs 18% more than on its first day, so the bank adds \$37\.0k to your starting cash\./);
assert.equal(same(ev), true, 'a reload makes the same game');
ev('S.nextFail=S.nextEvent=1e9');
homes(ev);
for (let i = 0; i < 30; i++) {
ev('dayTick()');
assert.equal(same(ev), true, `day ${i + 1}: a reload makes the same game`);
}
assert.equal(ev('netAge()'), 30);
assert.deepEqual(errors, []);
});
test('the first-days rules count the network\'s age, not the calendar', (t) => {
const { ev, errors } = late(t);
homes(ev);
// Events: none of the world's bad news before age 50, no shortage before 180 (F1's trick: what fireEvent picks from;
// a network's own events, like its traffic through the Great Firewall, come whatever its age).
const evOpts = (age) => J(ev, `(()=>{let o=null;const f=eval('('+fireEvent.toString().replace('const e=pick(opts);','o=opts.slice();return;')+')');S.day=S.day0+${age};f();return o;})()`);
const early = ['sanction', 'tariff', 'hijack', 'landban', 'shutdown', 'redsea', 'baltic', 'hwshock'];
assert.deepEqual(evOpts(45).filter((e) => early.includes(e)), [], 'no bad news at age 45');
assert.ok(evOpts(51).includes('sanction') && !evOpts(51).includes('hwshock'), 'bad news possible from age 51, a shortage not yet');
assert.ok(evOpts(181).includes('hwshock'), 'a shortage from age 181');
// Failures: no route leak before age 60, no RPKI mess before age 30.
const failOpts = (age) => J(ev, `(()=>{window.__o=null;window.__f=null;S.day=S.day0+${age};const g=eval('('+failureRun.toString().replace('if(!opts.length)return;','__o=opts.map(o=>o[0]);if(!opts.length)return;').replace('type=pick(f);','__f=f.slice();return;')+')');g('funny').next();return {o:__o,f:__f};})()`);
let f = failOpts(25);
assert.ok(!f.o.includes('leak') && !f.f.includes('rpki'), 'nothing of the sort at age 25');
f = failOpts(61);
assert.ok(f.o.includes('leak') && f.f.includes('rpki'), 'both from age 61');
// DDoS: none through age 40, even with the dice always low; then one may come.
ev('S.day=S.day0;window.__r=Math.random;Math.random=()=>0.001');
const attacks = J(ev, '(()=>{const n=[];for(let a=1;a<=41;a++){S.day=S.day0+a;ddosTick();n.push(ddosAll().length);}return n;})()');
ev('Math.random=__r');
assert.deepEqual(attacks.slice(0, 40), Array(40).fill(0), 'no attack through age 40');
assert.equal(attacks[40], 1, 'the first at age 41');
// Attack sizes stay within twice your biggest port until age 180, with two POPs.
ev("S.ev.ddos=null;S.ev.ddosMore=[];S.ddosStarts=[];ACT.buildPop({city:'ams'});compute()");
const maxAt = (age) => ev(`(()=>{S.day=S.day0+${age};__reseed(8);return Math.max(...Array.from({length:500},()=>ddosSize({tgt:'d'})));})()`);
assert.ok(maxAt(100) <= 2 * ev('ddMaxPort()'), 'early floods stay small');
assert.ok(maxAt(400) > 2 * ev('ddMaxPort()'), 'later ones do not');
// Sold-out routes: none in the first 90 days of the network.
assert.equal(ev('(()=>{for(let a=0;a<90;a++){S.day=S.day0+a;if(CITIES.some(c=>soldOut(\'fra\',c.id,1)))return true;}return false;})()'), false);
// Loan offers: none spawned through age 20, even with the dice always low.
ev('S.loanOffers=[];window.__r=Math.random;Math.random=()=>0.001');
const offers = J(ev, '(()=>{const n=[];for(let a=1;a<=21;a++){S.day=S.day0+a;loanTick(S.day);n.push(S.loanOffers.length);}return n;})()');
ev('Math.random=__r');
assert.deepEqual(offers.slice(0, 20), Array(20).fill(0), 'no loan offer through age 20');
assert.ok(offers[20] > 0, 'the banks call from age 21');
assert.deepEqual(errors, []);
});
test('the charter window, the tutorial, the badges and the win count the network\'s days', (t) => {
const { ev, dom, errors } = late(t);
ev('S.nextFail=S.nextEvent=1e9');
// The charter is still open at age 10, a reload keeps it open, and it closes after 30 days.
ev('S.day=S.day0+10');
assert.equal(ev('S.chartSet'), false);
ev('S=migrate(JSON.parse(JSON.stringify(S)));compute()');
assert.equal(ev('S.chartSet'), false, 'a reload keeps the choice open');
ev('S.day=S.day0+30;dayTick()');
assert.equal(ev('S.chartSet'), true, 'the classic charter once its days are over');
// The tutorial's "start the clock" step: five days of the network's own.
const tut = (age) => ev(`(()=>{S.day=S.day0+${age};return TUT.find(s=>s.sel==='#sp1').ok();})()`);
assert.deepEqual([tut(4), tut(5)], [false, true]);
// Speedrun: Tier 1 within three years of the network's start.
const speed = (age) => ev(`(()=>{S.won=true;S.day=S.day0+${age};return BADGES.find(b=>b.id==='speed').ok();})()`);
assert.deepEqual([speed(1095), speed(1096)], [true, false]);
ev('S.day=S.day0+700;showWin()');
const txt = dom.window.document.getElementById('modalCard').textContent;
assert.match(txt, /Took you 700 days/);
assert.deepEqual(errors, []);
});
test('the match: home broadband pays double for a year, net of wholesale, outside investors\' share', (t) => {
const { ev, errors } = late(t);
ev('S.nextFail=S.nextEvent=1e9');
homes(ev);
const rev = J(ev, 'R.rev');
assert.ok(rev.eyeballs > 0 && rev.late === rev.eyeballs, 'every dollar homes pay is matched');
assert.ok(Math.abs(ev('R.revMo') - (rev.eyeballs + rev.business + rev.ix + rev.grant + rev.late)) < 1e-6, 'and counts as revenue');
// Investors and the IPv4 bill see what homes pay, never the match.
ev("S.loanOffers.push({id:'v1',bank:'vult',amount:500000,exp:S.day+20,covs:['blitz'],share:0.1});ACT.takeLoan({id:'v1'});S.pops.fra.bb.d=400;compute()");
const a = J(ev, '[R.cost.revshare,R.cost.ip4||0,R.rev.late]');
const b = J(ev, '(()=>{const d0=S.day0;S.day0=0;compute();const o=[R.cost.revshare,R.cost.ip4||0,R.rev.late];S.day0=d0;compute();return o;})()');
assert.ok(a[0] > 0 && a[1] > 0 && a[2] > 0, `a share, an IPv4 bill and a match (${a})`);
assert.deepEqual(b.slice(0, 2), a.slice(0, 2), 'the same share and IPv4 bill without the match');
assert.equal(b[2], null, 'no match for a network that began on day 0');
// The last matched day is day0+365; the next day says the year is over.
ev('S.day=S.day0+364;dayTick()');
assert.equal(ev('S.day'), D + 365);
assert.ok(ev('R.rev.late') > 0, 'still matched on day 365');
ev('dayTick()');
assert.equal(ev('R.rev.late'), undefined, 'not on day 366');
assert.ok(ev("S.log.some(x=>x.t===tr('late.over'))"), 'the year is over, in the log');
assert.deepEqual(errors, []);
});
test('the match is net of the Australian wholesale cut', (t) => {
const { ev, errors } = late(t, { home: 'syd' });
homes(ev, 'syd');
const r = J(ev, '[R.rev.eyeballs,R.rev.late,R.cost.wholesale,AU_WHOLESALE]');
assert.ok(r[0] > 0 && r[2] > 0);
assert.ok(Math.abs(r[1] - r[0] * (1 - r[3])) < 1e-6, 'what homes pay after the wholesale cut');
assert.deepEqual(errors, []);
});
test('five seeded days: the match is the only difference in cash, a monthly match paid by the day', (t) => {
const { ev, errors } = late(t);
ev('S.nextFail=S.nextEvent=1e9');
homes(ev);
ev('window.__s0=JSON.stringify(S);window.__lm=lateMoney;window.__vd=volDay;window.__late=[];volDay=function(){__late.push((R.rev.late||0)/monLen(S.day));return __vd.apply(this,arguments);}');
const run = (match) => ev(`(()=>{S=migrate(JSON.parse(__s0));lateMoney=${match ? '__lm' : '()=>{}'};compute();__reseed(77);__late=[];for(let i=0;i<5;i++)dayTick();return S.cash;})()`);
const withM = run(true), sum = J(ev, '__late').reduce((x, y) => x + y, 0), without = run(false);
ev('lateMoney=__lm;volDay=__vd');
assert.ok(sum > 0);
assert.ok(Math.abs(withM - without - sum) < 1e-6, `cash ${withM} − ${without} is the match, ${sum}`);
assert.deepEqual(errors, []);
});
test('who is late: after day 180 only, the top-up with the market rule only', (t) => {
for (const [day, preset, isLate, topUp] of [[180, 'oncall', false, 0], [181, 'oncall', true, 0], [D, 'freeze', true, 0], [D, 'bgp', true, 37000]]) {
const { ev, dom, errors } = late(t, { day, preset });
assert.equal(ev('S.day0'), day);
assert.equal(ev('lateIs()'), isLate, `day ${day} ${preset}`);
assert.equal(ev('S.cash'), ev('START_CASH') + topUp, `day ${day} ${preset}: top-up`);
assert.equal(ev("S.log.filter(x=>/Late to the party/.test(x.t)).length"), isLate ? 1 : 0, `day ${day} ${preset}: the late welcome`);
homes(ev);
assert.equal(ev("'late' in R.rev"), isLate, `day ${day} ${preset}: the match`);
assert.deepEqual(errors, []);
dom.window.close();
}
});
test('outside a server session nothing changes: day 0, no match, and saves repair the start day', (t) => {
const { ev, errors } = load();
ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();compute()");
assert.deepEqual(J(ev, "[S.day,S.day0,'late' in R.rev,Object.keys(S).indexOf('day0')-Object.keys(S).indexOf('day')]"), [0, 0, false, 1]);
// A day without a session, or a session in sandbox or a scenario, begins on day 0.
ev(`beginState('Solo','fra',{mode:'normal',preset:'oncall',day:${D}})`);
assert.deepEqual(J(ev, '[S.day,S.day0]'), [0, 0], 'no session, no start day');
ev(`beginState('Box','fra',{mode:'sandbox',mp:${lit(MP)},day:${D}})`);
assert.deepEqual(J(ev, '[S.day,S.day0,S.mp]'), [0, 0, null], 'sandbox never is a session network');
// Saves: a start after the day is the day, a negative one 0, an old save without one 0.
const fix = (x) => J(ev, `(()=>{const s=JSON.parse(JSON.stringify(S));Object.assign(s,${lit(x)});if(${lit(x)}.day0===undefined)delete s.day0;const m=migrate(s);return [m.day,m.day0];})()`);
assert.deepEqual(fix({ day: 100, day0: 500 }), [100, 100]);
assert.deepEqual(fix({ day: 100, day0: -3 }), [100, 0]);
assert.deepEqual(fix({ day: 100, day0: 'x' }), [100, 0]);
assert.deepEqual(fix({ day: 100 }), [100, 0]);
assert.deepEqual(errors, []);
});
test('a late network sees its head start on the Goals tab, in the bank and in a city\'s pitch, also on a phone', (t) => {
const { ev, dom, errors } = late(t);
const doc = dom.window.document;
ev("window.innerWidth=360;window.innerHeight=740;UI.left='goals';UI.leftOpen=true;UI.sel=null;renderAll();renderLeft()");
// The city pitch before broadband launches.
ev("UI.tab='cust';selectCity('fra');renderAll()");
assert.match(doc.getElementById('panel').textContent, /You joined late: for 365 more days, what homes here pay you is matched\./);
homes(ev);
ev("UI.left='goals';UI.leftOpen=true;UI.sel=null;renderLeft()");
const card = [...doc.querySelectorAll('#leftBody .inc')].find((e) => /Late joiner's head start/.test(e.textContent));
assert.ok(card, 'the Goals card');
assert.match(card.textContent, new RegExp(`Home broadband pays double for 365 more days: \\+${ev('fmt$(R.rev.late)').replace('$', '\\$')}/mo right now\\.`));
ev('ACT.bank()');
const bank = doc.getElementById('bankCard').textContent;
assert.match(bank, /Late joiner's head start/);
assert.match(bank, /Starting cash top-up\$37\.0k/);
// The match is home broadband's: island homes on Wi-Fi pay island prices, never matched (lateMoney), and it says so.
assert.match(bank, /The match is on what home broadband pays you after any wholesale cut, not on island Wi-Fi/);
for (const k of ['late.hello', 'late.hello_flat']) assert.match(ev(`tr('${k}',{n:400,p:'5%',cash:'$1k'})`), /home broadband pays double: every dollar it pays you is matched \(island Wi-Fi is not\)/, k);
assert.ok(bank.includes('until ' + ev('dateStr(S.day0+365)')));
// The "since you started" lines measure from the network's own first day.
assert.equal(ev('mktTxt()'), ev("tr('lifecycle.market_as_start')"));
assert.match(ev('hwCard()'), /as when you started/);
assert.doesNotMatch(ev("marketNote('fra','ams',false)"), /fallen/);
assert.match(ev("(()=>{S.day+=400;const t=marketNote('fra','ams',false)+mktTxt();S.day-=400;return t;})()"), /fallen|below/, 'and move once it ages');
assert.deepEqual(errors, []);
});
test('a network that began on day 0 shows none of it', (t) => {
const { ev, dom, errors } = load();
ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e7;UI.tab='cust';selectCity(S.home);renderAll()");
assert.doesNotMatch(dom.window.document.getElementById('panel').textContent, /You joined late/);
ev("ACT.launchBB({city:S.home});compute();UI.left='goals';UI.leftOpen=true;UI.sel=null;renderLeft();ACT.bank()");
assert.doesNotMatch(dom.window.document.getElementById('leftBody').textContent, /Late joiner/);
assert.doesNotMatch(dom.window.document.getElementById('bankCard').textContent, /Late joiner/);
assert.deepEqual([ev('lateCard()'), ev('lateBank()')], ['', '']);
assert.deepEqual(errors, []);
});
// Island Wi-Fi and Starblink (#83) on a late network: what islanders pay is theirs to share with investors (as an IPv4
// lease is) and is never matched; a spur cut or a solar storm is a failure like any other, drawn only once a lit spur or
// a LEO circuit is up and only on the network's own outage schedule (S.nextFail, counted from S.day0), no calendar grace.
test('a late network with island Wi-Fi and Starblink: islanders are not matched, investors share islands and IPv4 leases but not the match', (t) => {
const { ev, errors } = late(t, { home: 'suv' });
const Z = "wispZ('vanualevu')", sp = "wispZ('tobago')";
assert.equal(ev('S.nextFail-S.day0'), 45, 'the first outage 45 days into its own life');
ev(`S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.lvl=5;
ACT.launchBB({city:'suv'});S.pops.suv.bb.d=8;ACT.buyTransit({city:'suv',net:NETS.find(n=>sellsAt(n,'suv')).id,tier:1});
ACT.teleBuild({city:'suv'});ACT.teleLeo({city:'suv'});ACT.wispSat({z:'vanualevu',bird:LEO_BIRD,g:5});
ACT.buildPop({city:'pos'});ACT.buyTransit({city:'pos',net:NETS.find(n=>sellsAt(n,'pos')).id,tier:1});ACT.wispSpur({z:'tobago'});
${Z}.sat.ready=S.day;${sp}.sp.ready=S.day;${Z}.d=4;${sp}.d=2;compute()`);
assert.equal(ev('netAge()'), 0);
assert.equal(ev('leoLive()') && ev('wispSpurs().length'), 1, 'a LEO zone in the sky and a lit spur on its first day');
// The pool a failure draws from, on its first day: both are there, with no grace of their own.
const pool = () => J(ev, "(()=>{window.__o=null;runNow(eval('('+failureRun.toString().replace('if(!opts.length)return;','__o=opts.map(o=>o[0]);return;')+')')());return __o;})()");
assert.ok(pool().includes('leostorm') && pool().includes('wspur'), 'a storm and a cut are possible failures from day one');
// The money: islanders pay, homes are matched, the islands are not.
const r = J(ev, 'R.rev');
assert.ok(r.wisp > 0 && r.eyeballs > 0, `islanders and homes both pay (${r.wisp}, ${r.eyeballs})`);
assert.equal(r.late, r.eyeballs, 'the match is what homes pay, never what islanders pay');
// Investors: their share of homes, islands and an IPv4 lease, never of the match.
ev("S.loans.push({id:'v',bank:'vult',start:S.day,amount:1,got:1,bal:0,share:0.1,covs:[]});ACT.ip4Buy({len:20});ACT.ip4Out({id:S.ip4.b.find(b=>b.k==='buy').id});compute()");
const m = J(ev, '[R.rev,R.cost.revshare,R.revMo]'), v = m[0];
assert.ok(v.ip4 > 0 && v.wisp > 0 && v.late > 0, `a lease, islanders and a match (${v.ip4}, ${v.wisp}, ${v.late})`);
assert.ok(Math.abs(m[1] - 0.1 * (v.eyeballs + v.business + v.ix + (v.orbit || 0) + v.ip4 + v.wisp)) < 1e-6, 'investors take 10% of homes, islands and the lease');
assert.ok(Math.abs(m[1] - 0.1 * (m[2] - v.grant - (v.gov || 0) - v.late)) < 1e-6, 'of every revenue but grants and the match');
// Its first outage comes on its own schedule, and the pool still holds both: a storm or a cut can be that outage.
ev("window.__fr=[];const f0=failureRun;failureRun=function*(o){__fr.push(netAge());yield* f0(o);};S.nextEvent=1e9;__reseed(5)");
for (let i = 0; i < 46; i++) ev('dayTick()');
assert.equal(J(ev, '__fr')[0], 45, 'no failure before age 45');
assert.equal(same(ev), true, 'a reload makes the same game');
assert.deepEqual(errors, []);
});

386
tests/leo.test.js Normal file
View file

@ -0,0 +1,386 @@
// Rented low-orbit capacity (#83): a Starblink gateway on a teleport at a POP on your fiber sells LEO circuits (5 to
// 50 Gbps, about 30 ms round trip) to small islands and remote towns within 1,200 km. A circuit is a link (kind 'sat') like
// GEO and MEO ones; selective networks peer over it as over a cable; the islands behind a gateway lean on its POP; a rare
// solar storm puts every LEO circuit in safe mode; once your own constellation carries traffic Starblink sells you nothing.
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 { createSession, TOOLS } = require('../scripts/lib/mcp-game');
const SAVE = fs.readFileSync(path.join(__dirname, 'fixtures', 'big-network.json'), 'utf8');
// Level 5, Change Freeze (nothing breaks, lead times quick), plenty of cash.
const BASE = "ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.lvl=5;S.nextFail=S.nextEvent=1e9;UI.speed=0;S.rules=makeRules('freeze');";
// Caracas: a POP with transit (Caracas sells drz, mvs and llt) and a teleport.
const CAR = "ACT.buildPop({city:'ccs'});ACT.buyTransit({city:'ccs',net:'drz',tier:1});ACT.teleBuild({city:'ccs'});";
const GW = CAR + "ACT.teleLeo({city:'ccs'});";
function game(t, setup = '') {
const h = load();
t.after(() => h.dom.window.close());
h.ev(BASE + setup);
return h;
}
const J = (ev, s) => JSON.parse(ev(`JSON.stringify(${s})`));
const leo = "S.links.find(l=>l.bird==='sb53')", geo = "S.links.find(l=>l.kind==='sat'&&SATS[l.bird].orb==='geo')";
const ready = 'S.day=Math.max(...S.links.map(l=>l.ready||0));compute()';
const pie = "S.pieV=1;pieInit();S.pie.crusts.short.cohorts=[{n:CRUSTS.short.full,day:S.day,las:false}];";
test('the footprint and the physics: a bent pipe 550 km up, regional, about 30 ms', (t) => {
const { ev, errors } = game(t);
assert.deepEqual(J(ev, "['tbu','cur','ome','hpa'].map(c=>satSees('sb53',c))"), [true, true, false, false], 'the shell misses Nome and Haparanda');
assert.deepEqual(J(ev, "[['suv','tbu'],['suv','vli'],['ccs','cur'],['syd','tbu']].map(([a,b])=>satPairOk('sb53',a,b))"), [true, true, true, false], 'Sydney to Tonga is too far for one satellite');
// Every LEO pair on sale with an island or a remote town in it clears the floor at the midpoint and the reach.
const bad = J(ev, "(()=>{const O=SAT_ORB.leo,out=[];for(const A of CITIES)for(const B of CITIES){if(A.id>=B.id||!(satRemote(A.id)||satRemote(B.id))||!satPairOk('sb53',A.id,B.id))continue;if(satElev(satArc(A.lat,A.lon,B.lat,B.lon)/2,O.h)<O.el||kmBetween(A.id,B.id)>O.km||satKm('sb53',A.id,B.id)<2*O.h)out.push(A.id+'-'+B.id);}return out;})()");
assert.deepEqual(bad, []);
for (const [a, b] of [['ccs', 'cur'], ['suv', 'vli']]) {
const rtt = ev(`satRtt('sb53','${a}','${b}')`);
assert.ok(rtt >= 25 && rtt <= 45, `${a}-${b}: about 30 ms round trip, got ${rtt}`);
}
assert.ok(ev("satKm('sb53','ccs','cur')") >= 2 * 550, 'up to the shell and back down');
// The orbits are told apart by their loss in satEdges/satAfter, so none may share one.
assert.equal(new Set(J(ev, 'Object.values(SAT_ORB).map(o=>o.loss)')).size, 3);
assert.deepEqual(J(ev, 'Object.keys(SAT_ORB)'), ['geo', 'meo', 'leo']);
assert.equal(J(ev, "satBirds('ccs','cur')").pop(), 'sb53', 'orbit order: GEO, MEO, then LEO');
assert.deepEqual(errors, []);
});
test('the WISP hooks: radio path, one-way ms and reach for any point on the globe, and they change nothing', (t) => {
const { ev, errors } = game(t, CAR);
const P = "CITY.cur.lat,CITY.cur.lon";
assert.equal(ev(`leoKmLL('ccs',${P})`), ev("satKm('sb53','ccs','cur')"), 'the same radio path as a circuit to the city there');
assert.ok(Math.abs(ev(`leoMsLL('ccs',${P})`) - ev("satLat({bird:'sb53',km:satKm('sb53','ccs','cur')})")) < 1e-9);
assert.equal(ev(`leoReachLL('ccs',${P})`), false, 'no gateway yet');
ev("ACT.teleLeo({city:'ccs'})");
const s0 = ev('JSON.stringify(S)');
assert.equal(ev(`leoReachLL('ccs',${P})`), true);
assert.equal(ev("leoReachLL('ccs',25,-77)"), false, 'Nassau’s point is too far for one satellite');
assert.equal(ev("leoReachLL('ccs',60,-66)"), false, 'beyond the shell');
assert.equal(ev('JSON.stringify(S)'), s0, 'pure');
assert.equal(ev(`S.lvl=4;leoReachLL('ccs',${P})`), false, 'below level 5');
ev('S.lvl=5;' + pie);
assert.equal(ev(`leoReachLL('ccs',${P})`), false, 'your own constellation flies');
assert.equal(ev('leoStorm()'), false);
assert.deepEqual(errors, []);
});
test('a gateway: level 5, a teleport under the shell on your fiber, its price; closing it asks twice', (t) => {
const { ev, errors } = game(t, CAR);
let c0 = ev('S.cash');
ev("S.lvl=4;ACT.teleLeo({city:'ccs'})");
assert.equal(ev("'leo' in S.pops.ccs"), false, 'LEO unlocks at level 5');
assert.equal(ev('S.cash'), c0, 'nothing charged');
ev("S.lvl=5;ACT.teleLeo({city:'ccs'});compute()");
assert.equal(ev('S.pops.ccs.leo'), 1);
assert.equal(c0 - ev('S.cash'), ev('LEO_GW_COST'));
assert.equal(ev('R.cost.sat'), ev('TPORT_MO+LEO_GW_MO'), 'the gateway bills with the teleports');
// Suva with a teleport and only a satellite out: no gateway until a wave of yours is lit there.
ev("ACT.buildPop({city:'syd'});ACT.buyTransit({city:'syd',net:'cog',tier:1});ACT.buildPop({city:'suv'});ACT.teleBuild({city:'suv'})");
assert.equal(ev("teleOf('suv')"), 1);
assert.match(ev("leoGwWhy('suv')"), /fiber/);
c0 = ev('S.cash');
ev("ACT.teleLeo({city:'suv'})");
assert.equal(ev("'leo' in S.pops.suv"), false);
assert.equal(ev('S.cash'), c0);
ev("UI.pending={a:'syd',b:'suv'};ACT.buildLink({tier:1});closeModal();S.links.find(l=>l.kind==='wave').ready=S.day+5");
assert.match(ev("leoGwWhy('suv')"), /fiber/, 'still being built');
ev("S.day=S.links.find(l=>l.kind==='wave').ready");
assert.equal(ev("leoGwWhy('suv')"), '', 'lit: Suva is on your fiber');
// Anchorage is beyond the shell; Edinburgh, just inside it, needs no tracking antennas.
ev("ACT.buildPop({city:'anc'});S.pops.anc.tele=1;ACT.buildPop({city:'edi'});ACT.teleBuild({city:'edi'})");
assert.match(ev("leoGwWhy('anc')"), /56°/);
assert.equal(ev("leoGwWhy('edi')"), '');
assert.match(ev("leoGwWhy('lon')"), /no POP/);
// Closing: refused while a LEO circuit starts there, and two taps.
ev("ACT.buySat({a:'ccs',b:'cur',bird:'sb53',g:5});closeModal();ACT.teleLeoRm({city:'ccs'});ACT.teleLeoRm({city:'ccs'})");
assert.equal(ev('S.pops.ccs.leo'), 1, 'not while a LEO circuit starts there');
ev(`ACT.rmLink({id:${leo}.id});ACT.rmLink({id:${leo}.id})`);
assert.equal(ev(`!!${leo}`), false);
ev("UI.confirm=null;ACT.teleLeoRm({city:'ccs'})");
assert.equal(ev('S.pops.ccs.leo'), 1, 'the first tap only arms it');
ev("ACT.teleLeoRm({city:'ccs'})");
assert.equal(ev("'leo' in S.pops.ccs"), false);
assert.equal(ev("teleOf('ccs')"), 1, 'the teleport stays');
// Closing the teleport takes the gateway along.
ev("ACT.teleLeo({city:'ccs'});UI.confirm=null;ACT.teleRm({city:'ccs'});ACT.teleRm({city:'ccs'})");
assert.equal(ev("teleOf('ccs')"), 0);
assert.equal(ev("'leo' in S.pops.ccs"), false);
assert.deepEqual(errors, []);
});
test('a LEO circuit: price, lead time, about 30 ms, users hardly notice; refused without a gateway or beyond the bent pipe', (t) => {
const { ev, errors } = game(t, CAR);
assert.match(ev("satWhy('ccs','cur','sb53',10)"), /gateway/);
ev("ACT.buySat({a:'ccs',b:'cur',bird:'sb53',g:10})");
assert.equal(ev(`!!${leo}`), false, 'no gateway, no circuit');
ev("ACT.teleLeo({city:'ccs'})");
const c0 = ev('S.cash');
ev("ACT.buySat({a:'ccs',b:'cur',bird:'sb53',g:10})");
const l = J(ev, leo);
assert.ok(ev('!!S.pops.cur'), 'the order builds the POP');
assert.equal(c0 - ev('S.cash'), ev("satMo('sb53',10)+popCost('cur')"));
assert.equal(l.mo, ev("satMo('sb53',10)"));
assert.equal(l.ready, ev('S.day+leadDays(14)'));
assert.equal(!!l.standby, false);
ev('compute()');
assert.equal(ev(`linkDown(${leo})`), true, 'down while it is pointed');
ev("ACT.launchBB({city:'cur'});closeModal();" + ready);
assert.ok(ev(`R.load[${leo}.id]`) > 0);
const ms = ev(`linkLat(${leo})`);
assert.ok(ms >= 12 && ms <= 23, 'one way: ' + ms);
assert.ok(Math.abs(ev('R.latF.cur') - 0.97) < 1e-9, 'users count 3% as bad');
assert.ok(ev("sfOf(R,'cur')") >= 0.95, 'so broadband keeps growing');
assert.equal(ev("/fact bad/.test(satFact('cur'))"), false, 'a plain chip: they hardly notice');
assert.match(ev("satFact('cur')"), /users ride a satellite/);
// Beyond the bent pipe: both under the shell but 1,958 km apart.
assert.match(ev("satWhy('ccs','nas','sb53',10)"), /bent pipe.*1,200 km.*1,958 km/);
assert.match(ev("satWhy('ccs','cur','sb53',7)"), /No such satellite circuit/);
// The price ladder: half MEO per Gbps; the smallest order dearer than the cheapest GEO; far dearer than a subsea wave.
assert.ok(ev("satMo('sb53',20)/20") < ev("satMo('o3b',20)/20"));
assert.ok(ev("satMo('sb53',5)") > ev("satMo('kac1',1)"));
const wave = ev("waveMo(kmBetween('suv','tbu'),true,1)/LT[1].g");
for (const g of [10, 50]) assert.ok(ev(`satMo('sb53',${g})/${g}`) > 3 * wave, `LEO ${g}G per Gbps against a wave`);
assert.deepEqual(errors, []);
});
test('selective peers do not refuse an island only LEO reaches; a circuit being pointed does not change their verdict', (t) => {
const { ev, errors } = game(t, CAR + "ACT.buySat({a:'ccs',b:'cur',bird:'is37',g:5});closeModal();");
ev(ready + ";ACT.buyIx({city:'cur',tier:0});closeModal();compute()");
assert.equal(ev("satOnly('cur').bird"), 'is37');
const sel = J(ev, "ixMembers('cur').filter(id=>NET[id].pol==='selective')");
const geoNo = sel.filter((id) => ev(`noSat('${id}','geo')`));
assert.ok(geoNo.length > 0, 'some members of Blue-Curaçao-IX refuse GEO: ' + sel.join(','));
for (const id of geoNo) assert.equal(J(ev, `peerOk('${id}','ix','cur')`).sat, true, id + ' over GEO');
// LEO ordered: the GEO circuit goes on standby, but until LEO is commissioned the GEO one is the way out they judge.
ev("ACT.teleLeo({city:'ccs'});ACT.buySat({a:'ccs',b:'cur',bird:'sb53',g:10});closeModal();compute()");
assert.equal(ev(`${geo}.standby`), true);
assert.equal(ev("satOnly('cur').bird"), 'is37', 'a circuit being pointed does not count yet');
ev(ready);
assert.equal(ev("satOnly('cur').bird"), 'sb53', 'still a satellite island');
for (const id of geoNo) {
for (const via of ['ix', 'pni']) assert.ok(!J(ev, `peerOk('${id}','${via}','cur')`).sat, `${id} ${via} over LEO`);
ev(`S.peers['${id}@cur']=true`);
}
ev('compute()');
for (const id of geoNo) assert.equal(ev(`ixSessions('cur').has('${id}')`), true, id + ' peers over LEO');
assert.ok(J(ev, 'NETS.map(n=>n.id)').every((id) => !ev(`noSat('${id}','leo')`)), 'nobody minds LEO');
// MEO first, commissioned, then LEO being pointed: the MEO circuit, on standby now, is still the one they judge.
ev("S.links=S.links.filter(l=>l.kind!=='sat');S.pops.ccs.tele=2;ACT.buySat({a:'ccs',b:'cur',bird:'o3b',g:5});closeModal();" + ready);
ev("ACT.buySat({a:'ccs',b:'cur',bird:'sb53',g:10});closeModal();compute()");
assert.equal(ev("S.links.find(l=>l.bird==='o3b').standby"), true);
assert.equal(ev("satOnly('cur').bird"), 'o3b');
assert.deepEqual(errors, []);
});
test('one satellite a pair: LEO puts GEO on standby, GEO ordered beside LEO waits, and carries when LEO is down', (t) => {
const { ev, errors } = game(t, GW + "ACT.buySat({a:'ccs',b:'cur',bird:'is37',g:5});closeModal();");
ev(ready + ";ACT.launchBB({city:'cur'});closeModal();ACT.buySat({a:'ccs',b:'cur',bird:'sb53',g:10});closeModal();renderAll()");
assert.equal(ev(`${geo}.standby`), true, 'the GEO circuit waits');
assert.equal(!!ev(`${leo}.standby`), false);
assert.match(ev("document.querySelector('#toasts').textContent"), /goes on standby/);
ev(ready);
assert.ok(ev(`R.load[${leo}.id]`) > 0 && !(ev(`R.load[${geo}.id]`) > 0), 'LEO carries, GEO stands by');
// A solar storm: the GEO circuit carries the island.
ev('S.ev.sky=S.day+2;compute()');
assert.equal(ev(`linkDown(${leo})`), true);
assert.ok(ev(`R.load[${geo}.id]`) > 0, 'GEO takes over');
// GEO ordered beside an active LEO circuit starts on standby.
ev(`S.ev.sky=0;S.links=S.links.filter(l=>l.bird!=='is37');ACT.buySat({a:'ccs',b:'cur',bird:'gx19',g:5});closeModal()`);
assert.equal(ev("S.links.find(l=>l.bird==='gx19').standby"), true);
assert.equal(!!ev(`${leo}.standby`), false);
// A cable laid later puts LEO on standby too.
ev("UI.pending={a:'ccs',b:'cur'};ACT.buildLink({tier:1});closeModal()");
assert.equal(ev(`${leo}.standby`), true);
assert.deepEqual(errors, []);
});
test('the gateway POP is the islands’ bottleneck: its fiber full, every island behind it slows down, and the Infra tab says so', (t) => {
const isl = ['cur', 'gnd', 'svd', 'slu'];
const { ev, errors } = game(t, "ACT.buildPop({city:'ccs'});ACT.teleBuild({city:'ccs'});ACT.teleLeo({city:'ccs'});ACT.buildPop({city:'bog'});ACT.buyTransit({city:'bog',net:NETS.find(n=>sellsAt(n,'bog')).id,tier:1});UI.pending={a:'ccs',b:'bog'};ACT.buildLink({tier:0});closeModal();");
assert.equal(ev("noTalk('ccs','bog')"), '');
ev(`for(const c of ${JSON.stringify(isl)}){ACT.buySat({a:'ccs',b:c,bird:'sb53',g:10});closeModal();ACT.launchBB({city:c});closeModal();S.pops[c].bb.d=7;}` + ready);
const srv = () => ev(`${JSON.stringify(isl)}.reduce((a,c)=>a+(R.citySrv[c]||0),0)`);
assert.ok(ev(`${JSON.stringify(isl)}.reduce((a,c)=>a+R.cityDem[c],0)`) >= 25);
assert.ok(srv() <= 10 + 1e-6, 'four islands through one 10G wave: ' + srv());
const panel = () => { ev("UI.sel={type:'city',id:'ccs'};UI.tab='links';renderAll()"); return ev("document.querySelector('#panel').textContent"); };
let p = panel();
assert.match(p, /every island behind this gateway slows down/);
assert.match(p, /Landing here from orbit/);
assert.match(p, /Fiber and cables out of Caracas/);
ev("UI.pending={a:'ccs',b:'bog'};ACT.buildLink({tier:1});closeModal();" + ready);
assert.ok(srv() >= 0.9 * 28, 'a 100G wave lets them through: ' + srv());
p = panel();
assert.doesNotMatch(p, /every island behind this gateway slows down/);
assert.deepEqual(errors, []);
});
// An island gateway whose only way out is a transit port (someone else's cable) is on your fiber all the same
// (satWired): its section shows that port's load, not "0.0 Gbps / 0.0 Gbps" of fiber, and warns when it fills.
test('a gateway out over transit only: the teleport section shows the transit port, and says when it is the bottleneck', (t) => {
const { ev, errors } = game(t, "ACT.buildPop({city:'suv'});ACT.buyTransit({city:'suv',net:NETS.find(n=>sellsAt(n,'suv')).id,tier:0});ACT.teleBuild({city:'suv'});ACT.teleLeo({city:'suv'});ACT.wispSat({z:'vanualevu',bird:'sb53',g:10});");
assert.equal(ev("S.links.some(l=>l.a==='suv'||l.b==='suv')"), false, 'no fiber, no cable of yours');
assert.equal(ev("satWired('suv')"), true, 'a transit port is a way out');
ev("S.day=wispZ('vanualevu').sat.ready;wispZ('vanualevu').d=6;compute()");
const panel = () => { ev("UI.sel={type:'city',id:'suv'};UI.tab='links';renderAll()"); return ev("document.querySelector('#panel').textContent"); };
let p = panel();
assert.match(p, /Landing here from orbit6\.0 Gbps/);
assert.doesNotMatch(p, /Fiber and cables out of Suva/, 'no fiber row without fiber');
const tl = ev("S.transit.filter(t=>t.city==='suv').reduce((a,t)=>a+(R.useT[t.id]||0),0)");
assert.ok(tl >= 6 - 1e-6, 'the islands leave over transit: ' + tl);
assert.ok(p.includes(`Transit out of Suva${ev(`fmtG(${tl})`)} / ${ev('fmtG(10)')}`), 'the port\'s load and size');
assert.doesNotMatch(p, /every island behind this gateway slows down/);
// The port fills: the islands slow down with it, and the section says so.
ev("ACT.launchBB({city:'suv'});closeModal();S.pops.suv.bb.d=8;compute()");
assert.ok(ev("S.transit.filter(t=>t.city==='suv').reduce((a,t)=>a+(R.useT[t.id]||0),0)") >= 9.5);
assert.match(panel(), /Suva is full: every island behind this gateway slows down/);
assert.deepEqual(errors, []);
});
test('Pie in the Sky: once your crust carries, Starblink sells you nothing new; what you rent keeps running, on its own bill', (t) => {
const { ev, errors } = game(t, GW + "ACT.buySat({a:'ccs',b:'cur',bird:'sb53',g:10});closeModal();ACT.launchBB({city:'cur'});closeModal();ACT.buildPop({city:'bog'});ACT.teleBuild({city:'bog'});");
ev(ready);
assert.equal(ev('leoRival()'), false);
ev(pie + 'compute()');
assert.equal(ev('leoRival()'), true, 'a full Shortcrust carries');
assert.match(ev("satWhy('ccs','gnd','sb53',10)"), /rival constellation/);
ev("ACT.buySat({a:'ccs',b:'gnd',bird:'sb53',g:10})");
assert.equal(ev("S.links.some(l=>l.b==='gnd')"), false, 'no new circuit');
const c0 = ev('S.cash');
ev(`ACT.satSize({id:${leo}.id,g:20})`);
assert.equal(ev(`${leo}.g`), 10, 'no growing');
assert.equal(ev('S.cash'), c0);
assert.match(ev(`leoGrowWhy(${leo})`), /rival constellation/);
assert.match(ev("leoGwWhy('bog')"), /rival constellation/);
ev("ACT.teleLeo({city:'bog'})");
assert.equal(ev("'leo' in S.pops.bog"), false, 'no new gateway');
ev(`ACT.satSize({id:${leo}.id,g:5});compute()`);
assert.equal(ev(`${leo}.g`), 5, 'shrinking works');
assert.ok(ev(`R.load[${leo}.id]`) > 0, 'the circuit still carries');
assert.ok(ev('R.cost.sat') >= ev(`${leo}.mo+LEO_GW_MO`), 'rented LEO is on the satellite bill');
const spent = ev('S.pie.book.spent');
ev('dayTick()');
assert.equal(ev('S.pie.book.spent'), spent, 'never on the rocket company’s books');
assert.deepEqual(errors, []);
});
test('a solar storm: every LEO circuit in safe mode for a day or two, no cut, no bill; Pie’s storms are the same sun', (t) => {
const { ev, errors } = game(t, GW + "ACT.buySat({a:'ccs',b:'cur',bird:'sb53',g:10});closeModal();ACT.buySat({a:'ccs',b:'gnd',bird:'is37',g:5});closeModal();");
ev(ready);
assert.equal(ev('leoLive()'), true);
const c0 = ev('S.cash');
ev("fireFailure('leostorm')");
const d = ev('S.ev.sky-S.day');
assert.ok(d >= 1 && d <= 2, 'one or two days: ' + d);
assert.equal(ev(`linkDown(${leo})`), true);
assert.equal(ev(`linkDown(${geo})`), false, 'GEO flies on');
assert.equal(ev("S.links.filter(l=>l.kind==='sat').every(l=>!l.cut)"), true, 'nobody cut a satellite');
assert.equal(ev("incTitle('leostorm')"), 'Solar storm');
const i = J(ev, "S.inc.find(x=>x.type==='leostorm')");
assert.equal(i.until, ev('S.ev.sky'));
assert.equal(i.cost, 0, 'nothing to rush');
assert.equal(ev('S.cash'), c0);
assert.match(ev(`satPanel(${leo})`), /Safe mode through a solar storm: back in \d days?\./);
ev('S.day=S.ev.sky');
assert.equal(ev(`linkDown(${leo})`), false, 'back when it passes');
// Clearing the incident clears the storm, and leaves the key.
ev("S.inc=[];S.ev.sky=0;fireFailure('leostorm');clearInc(S.inc.find(x=>x.type==='leostorm'))");
assert.equal(ev('S.ev.sky'), 0);
// Spicy chaos stretches it, and the outage follows, within what a save keeps.
ev("S.inc=[];S.rules.chaos='spicy';fireFailure('leostorm');S.rules.chaos='none'");
assert.equal(ev("S.inc.find(x=>x.type==='leostorm').until"), ev('S.ev.sky'));
assert.ok(ev('S.ev.sky-S.day') <= ev('LEO_STORM_MAX'));
// Saves: the day is a number no later than LEO_STORM_MAX ahead, and the key stays.
ev("S.ev.sky='junk';S=migrate(JSON.parse(JSON.stringify(S)))");
assert.equal(ev('S.ev.sky'), 0);
assert.equal(ev("'sky' in S.ev"), true);
ev('S.ev.sky=S.day+999;S=migrate(JSON.parse(JSON.stringify(S)))');
assert.ok(ev('S.ev.sky') <= ev('S.day+LEO_STORM_MAX'));
ev('S.ev.sky=0');
const ev0 = ev('JSON.stringify(S.ev)');
ev('S=migrate(JSON.parse(JSON.stringify(S)))');
assert.equal(ev('JSON.stringify(S.ev)'), ev0, 'a live 0 loads as it was');
// One sun: a storm that drags your own pies down puts Starblink in safe mode too, but only with LEO circuits up.
ev("S.inc=[];" + pie + "S.pie.co={name:PIE_NAMES[0]};pieIncFire('storm')");
assert.ok(ev('S.ev.sky>S.day'), 'Starblink in safe mode');
assert.ok(ev("S.inc.some(x=>x.type==='piestorm')&&S.inc.some(x=>x.type==='leostorm')"));
ev("S.inc=[];S.ev.sky=0;S.links=S.links.filter(l=>l.bird!=='sb53');pieIncFire('storm')");
assert.equal(ev('S.ev.sky'), 0, 'no LEO circuits, nothing to put in safe mode');
assert.deepEqual(errors, []);
});
test('saves: gateways and circuits survive a round trip, broken ones are repaired, old saves load as they were', (t) => {
const { ev, errors } = game(t, GW + "ACT.buySat({a:'ccs',b:'cur',bird:'sb53',g:10});closeModal();ACT.buySat({a:'ccs',b:'gnd',bird:'is37',g:5});closeModal();");
const before = ev("JSON.stringify([S.pops.ccs,S.links.filter(l=>l.kind==='sat')])");
ev('S=migrate(JSON.parse(JSON.stringify(S)));compute()');
assert.equal(ev("JSON.stringify([S.pops.ccs,S.links.filter(l=>l.kind==='sat')])"), before);
ev('S.pops.ccs.leo=7;S=migrate(JSON.parse(JSON.stringify(S)))');
assert.equal(ev("'leo' in S.pops.ccs"), false, 'a gateway is 1');
assert.equal(ev(`!!${leo}`), false, 'no gateway, no LEO circuit');
assert.equal(ev(`!!${geo}`), true, 'the GEO circuit stays');
ev('S.pops.ccs.leo=1;delete S.pops.ccs.tele;S=migrate(JSON.parse(JSON.stringify(S)))');
assert.equal(ev("'leo' in S.pops.ccs"), false, 'no teleport, no gateway');
// A save from before LEO: nothing about it changes.
ev('S=migrate(JSON.parse(' + JSON.stringify(SAVE) + '));UI.started=true;UI.pitched=true;UI.speed=0;closeModal();compute()');
assert.equal(ev("Object.values(S.pops).some(p=>'leo' in p)||'sky' in S.ev"), false);
assert.equal(ev("'sat' in R.cost"), false);
assert.ok(ev('R.served') > 0);
assert.deepEqual(errors, []);
});
test('on a phone: the gateway, its readout, the order sheet and a LEO circuit’s panel, at 360 px', (t) => {
const { ev, errors } = game(t, CAR);
ev('window.innerWidth=360;window.innerHeight=740;window.dispatchEvent(new window.Event("resize"))');
assert.equal(ev('isPhone()'), true);
const text = (sel) => ev(`(document.querySelector('${sel}')||{}).textContent||''`);
const acts = (sel) => J(ev, `[...document.querySelectorAll('${sel} [data-act]')].map(b=>b.dataset.act)`);
const infra = "UI.sel={type:'city',id:'ccs'};UI.tab='links';renderAll()";
ev('S.lvl=4;' + infra);
assert.match(text('#panel'), /Low-orbit capacity \(about 30 ms round trip\) comes at level 5/);
ev('S.lvl=5;' + infra);
assert.match(text('#panel'), /LEO gateway/);
assert.ok(acts('#panel').includes('teleLeo'));
ev("ACT.teleLeo({city:'ccs'});" + infra);
assert.match(text('#panel'), /islands and remote towns within 1,200 km of this gateway/);
assert.ok(acts('#panel').includes('teleLeoRm'));
ev("ACT.satOpen({a:'ccs',b:'cur'})");
assert.ok(J(ev, "[...document.querySelectorAll('#modalCard [data-act=\"buySat\"]')].filter(b=>JSON.parse(b.dataset.args).bird==='sb53')").length >= 4, 'four sizes');
assert.match(text('#modalCard'), /Over LEO, about 30 ms round trip/);
ev("ACT.buySat({a:'ccs',b:'cur',bird:'sb53',g:10});ACT.launchBB({city:'cur'});closeModal();" + ready + ';' + infra);
assert.match(text('#panel'), /Landing here from orbit/);
assert.ok(!acts('#panel').includes('teleLeoRm'), 'no closing while a circuit starts there');
ev(`UI.sel={type:'link',id:${leo}.id};renderAll()`);
assert.match(text('#panel'), /round trip/);
assert.match(text('#panel'), /Bent pipe from 550 km up/);
ev("S.ev.sky=S.day+2;compute();renderAll()");
assert.match(text('#panel'), /Safe mode through a solar storm: back in 2 days/);
ev("UI.sel={type:'city',id:'cur'};UI.tab='cust';renderAll()");
for (const s of ['#panel', '#modalCard', '#toasts']) assert.doesNotMatch(text(s), /satellites\.|undefined|NaN/, s);
assert.deepEqual(errors, []);
});
test('MCP: the gateway and LEO circuits quote what the game then charges, and say no once your crust flies', () => {
const s = createSession(), T = (n, a = {}) => TOOLS.find((x) => x.name === n).run(s, a), ev = (x) => s.game.ev(x);
T('new_game', { city: 'ccs', preset: 'sandbox', seed: 7, name: 'Probe' });
ev('S.cash=1e9');
T('act', { action: 'teleBuild', args: { city: 'ccs' } });
const q = T('act', { action: 'teleLeo', args: { city: 'ccs' }, dryRun: true }).quote;
assert.equal(q.setup, ev('LEO_GW_COST'));
assert.equal(q.monthly, ev('LEO_GW_MO'));
assert.deepEqual(q.blocked, []);
let c0 = ev('S.cash');
T('act', { action: 'teleLeo', args: { city: 'ccs' } });
assert.equal(c0 - ev('S.cash'), q.setup);
assert.match(T('act', { action: 'teleLeo', args: { city: 'ccs' }, dryRun: true }).quote.blocked.join(' '), /already/);
const b = T('act', { action: 'buySat', args: { a: 'ccs', b: 'cur', bird: 'sb53', g: 10 }, dryRun: true }).quote;
assert.deepEqual(b.blocked, []);
c0 = ev('S.cash');
T('act', { action: 'buySat', args: { a: 'ccs', b: 'cur', bird: 'sb53', g: 10 } });
assert.equal(c0 - ev('S.cash'), b.setup, 'the quote is the bill');
assert.equal(b.monthly, ev("S.links.find(l=>l.bird==='sb53').mo"));
const id = ev("S.links.find(l=>l.bird==='sb53').id");
assert.deepEqual(T('act', { action: 'satSize', args: { id, g: 20 }, dryRun: true }).quote.blocked, []);
ev(pie);
assert.match(T('act', { action: 'satSize', args: { id, g: 20 }, dryRun: true }).quote.blocked.join(' '), /rival constellation/);
assert.deepEqual(T('act', { action: 'satSize', args: { id, g: 5 }, dryRun: true }).quote.blocked, [], 'shrinking is fine');
assert.deepEqual(s.errors(), []);
});

View file

@ -6,7 +6,8 @@
// const engine = createFakeEngine({onLost});
// engine.load(code, nets:[{nid, env?, begin?, lang, prefs}]) → [{t:'loaded', nid, epoch, day, lost, saved?}], one per
// net; a network that did not load is {t:'loaded', nid, err} (broken, 4.7): one with
// neither a save (env.s, the save text) nor a begin answers err 'no save to load'
// neither a save (env.s, the save text) nor a begin answers err 'no save to load'; a begin
// starts on begin.day (the session's date; 0 when it is none)
// engine.day(code, {d, speed, last, alone:[nid], nets:[nid], mute}) → {t:'dayDone', code, d, nets:{[nid]:{day, lost,
// pause?, err?, retried?, ms}}}; a network of nets that is not loaded is left out
// engine.act(code, nid, msg) → {t:'actDone', nid, epoch, rid, outcome, why?, v, upd, ms} (msg: the request body, 5.8)
@ -58,6 +59,8 @@ function createFakeEngine(opts = {}) {
const hasSession = (code) => [...realms.keys()].some((k) => k.startsWith(code + '/'));
// The day of a save text (the real engine reads the save); else the canned one.
const dayOf = (s) => { try { const d = JSON.parse(s).day; return Number.isInteger(d) ? d : F.snap.S.day; } catch (e) { return F.snap.S.day; } };
// The day a save's network began (S.day0), at most its day; 0 for a save that does not say.
const day0Of = (s, day) => { try { const d = JSON.parse(s).day0; return Number.isInteger(d) && d >= 0 ? Math.min(d, day) : 0; } catch (e) { return 0; } };
// A realm the worker had to build again after a timeout: a new epoch, versions from 0.
const rebuilt = (r) => { if (r) { r.epoch = newEpoch(); r.v = 0; r.dirty = false; } };
// Every answer goes through here: held back, failed, or rejected when the worker exits meanwhile. failed(f): the reply
@ -102,7 +105,7 @@ function createFakeEngine(opts = {}) {
}
return o;
};
const savedOf = (code, nid, r) => ({ t: 'saved', nid, txt: JSON.stringify({ ...F.snap.S, day: r.day, lost: r.lost, mp: { ...F.snap.S.mp, code, pid: nid } }), uidN: 100 + r.day, rt: { load: {}, l2route: {}, efg: {} }, day: r.day, lost: r.lost });
const savedOf = (code, nid, r) => ({ t: 'saved', nid, txt: JSON.stringify({ ...F.snap.S, day: r.day, day0: r.day0, lost: r.lost, mp: { ...F.snap.S.mp, code, pid: nid } }), uidN: 100 + r.day, rt: { load: {}, l2route: {}, efg: {} }, day: r.day, lost: r.lost });
const CLOSED = () => Promise.reject(coded('engine closed', 'CLOSED'));
const engine = {
@ -123,8 +126,8 @@ function createFakeEngine(opts = {}) {
const one = (n, err) => {
if (!err && !n.begin && !(n.env && typeof n.env === 'object' && typeof n.env.s === 'string')) err = 'no save to load';
if (err) { realms.delete(key(code, n.nid)); return { t: 'loaded', nid: n.nid, err }; }
const day = n.begin ? 0 : Number.isInteger(n.env.day) ? n.env.day : dayOf(n.env.s);
const r = { epoch: newEpoch(), v: 0, day, lost: false, broken: false, dirty: false, greeted: false, pause: false, loseNext: false, keep: [], lang: n.lang || 'en' };
const day = n.begin ? (Number.isInteger(n.begin.day) ? n.begin.day : 0) : Number.isInteger(n.env.day) ? n.env.day : dayOf(n.env.s);
const r = { epoch: newEpoch(), v: 0, day, day0: n.begin ? day : day0Of(n.env.s, day), lost: false, broken: false, dirty: false, greeted: false, pause: false, loseNext: false, keep: [], lang: n.lang || 'en' };
realms.set(key(code, n.nid), r);
return { t: 'loaded', nid: n.nid, epoch: r.epoch, day, lost: false, ...(n.begin ? { saved: savedOf(code, n.nid, r) } : {}) };
};

View file

@ -28,7 +28,8 @@ function make() {
ev(`Date.now=()=>${NOW};`);
// A network of a server session, built the way the server builds one (beginState, then the server's own marks), with
// the intern on every order and a fiber cut it rushes: the snapshot carries a shift's log and the week's tally.
ev(`UI.pitched=true;beginState('Packet Pals','fra',{mode:'normal',preset:'oncall',mp:${JSON.stringify(MP)}});S.mp.sim=1;S.tut=null;compute();beginHello();
// It joined the session late (day 473): the session's date, one calendar for every network (S.day0).
ev(`UI.pitched=true;beginState('Packet Pals','fra',{mode:'normal',preset:'oncall',mp:${JSON.stringify(MP)},day:473});S.mp.sim=1;S.tut=null;compute();beginHello();
S.nextFail=S.nextEvent=1e9;UI.speed=0;UI.started=true;ACT.charter({k:'global'});
ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});ACT.buildPop({city:'ams'});ACT.launchBB({city:'ams'});
UI.pending={a:'fra',b:'ams'};ACT.buildLink({tier:0});closeModal();
@ -43,7 +44,7 @@ function make() {
return { s, del, keys: now }; };
const fx = () => JSON.parse(ev('JSON.stringify(__fx.splice(0))'));
const clock = { t: 'clock', speed: 1, eff: 1, run: true, why: null, votes: { [PID2]: 4 }, tally: { 4: 1 }, need: 2, active: [PID, PID2], hold: [], idle: [],
day: 518, last: 1, max: 8, off: { [PID]: S0day(snapS) - 518, [PID2]: 0 } };
day: snapS.day, last: 1, max: 8 };
const card = JSON.parse(ev('JSON.stringify(mpCard())'));
const roster = { t: 'roster', code: CODE, title: 'Friday', preset: 'oncall', seed: MP.seed, created: NOW - 864e5,
players: [{ pid: PID, name: 'Packet Pals', asn: MP.asn, color: MP.color, card, seen: NOW, joined: NOW - 864e5 },
@ -76,9 +77,6 @@ function make() {
dom.window.close();
return { snap, 'upd-day': updDay, 'upd-act': updAct, sub, clock, roster };
}
// The calendar offset of the network in the fixtures: its own date against the session day (open question 1).
function S0day(S) { return S.day; }
function write() {
fs.mkdirSync(DIR, { recursive: true });
const out = make();

View file

@ -102,10 +102,8 @@ const fxList = (v, w, out) => { if (!Array.isArray(v)) return false; v.forEach((
const CLOCK = { t: (v) => v === 'clock', speed: (v) => SPEEDS.includes(v), eff: (v) => num(v) && v >= 0, run: bool, why: (v) => WHY.includes(v),
votes: mapOf((k) => PID.test(k), (v) => v === null || SPEEDS.includes(v)), tally: mapOf((k) => SPEEDS.includes(+k), nat), need: (v) => int(v) && v >= 1,
active: listOf((v) => PID.test(v)), hold: listOf((v) => PID.test(v)), idle: listOf((v) => PID.test(v)), day: nat, last: (v) => SPEEDS.includes(v) && v > 0,
max: (v) => SPEEDS.includes(v) && v > 0,
// The calendar offset of every network of the session: its own S.day minus the session day (open question 1: "own
// date"). One field, so a shared date later only means all zeros.
off: mapOf((k) => PID.test(k), int) };
// day: the session's date, and every network's (one calendar: a network that joins late begins on it, S.day0).
max: (v) => SPEEDS.includes(v) && v > 0 };
const PLAYER = { pid: (v) => PID.test(v), name: str, asn: nat, color: (v) => /^#[0-9a-f]{6}$/i.test(v), card: (v) => v === null || obj(v), seen: nat, joined: nat,
lost: [bool, 'opt'], broken: [bool, 'opt'] };
const ROSTER = { t: (v) => v === 'roster', code: (v) => CODE.test(v), title: str, preset: str, seed: int, created: nat,

View file

@ -228,7 +228,8 @@ test('a dry run prices every command that has a price, and changes nothing', ()
opsHire: { id: ev('Object.keys(INTERNS)[0]') }, opsNewPop: { city: 'nyc' }, pniAll: { net: 'cog', tier: 1 }, seatBuy: { n: 2 }, layShip: { id: df }, seaRush: { id: df },
utilityKit: { city: 'fra' }, utilityCaches: { city: 'fra' }, acceptFix: { id: 'none' }, ptApply: { city: 'fra', k: 'medium' }, ptAll: { k: 'medium' }, teDeploy: { script: 'spill at 85%' }, upLinkX: {},
pieRd: { k: 'reuse' }, pieAnt: { id: 'none' }, ip4Buy: { len: 24 }, ip4Lease: { len: 22 }, ip6Go: { city: 'fra' },
teleBuild: { city: 'fra' }, teleTrk: { city: 'fra' }, buySat: { a: 'fra', b: 'rek', bird: 'is37', g: 1 }, satSize: { id: wave, g: 2 },
teleBuild: { city: 'fra' }, teleTrk: { city: 'fra' }, teleLeo: { city: 'fra' }, buySat: { a: 'fra', b: 'rek', bird: 'is37', g: 1 }, satSize: { id: wave, g: 2 },
wispSat: { z: 'vanualevu', bird: 'kac1', g: 2 }, wispSatSize: { z: 'vanualevu', g: 5 }, wispSpur: { z: 'vanualevu' },
};
const missing = quoted.filter((n) => !sample[n] && T('schema', { section: 'commands' })[n].args.some((a) => a.required));
assert.deepEqual(missing, [], 'every priced command with arguments has a sample here');

View file

@ -30,11 +30,13 @@ test('SEND is the agent\'s game commands without the puzzles, teCheck, traceRun
});
/* A rich network with something behind every two-click button: the big fixture, an intern, a sales head, a scrubbing
center, a teleport, an own exchange. Its S also goes to the realm, so both sides start the same. */
center, a teleport with a LEO gateway, an own exchange, an island Wi-Fi zone with a circuit. Its S also goes to the
realm, so both sides start the same. */
function rich() {
const P = page({ save: bigScenic() });
P.ev(`S.lvl=Math.max(S.lvl,6);ACT.opsHire({id:'kevin'});closeModal();ACT.salesHire({id:'eng'});closeModal();
ACT.buildScrub({city:'fra'});closeModal();ACT.teleBuild({city:'sea'});closeModal();UI.confirm=null;UI.sel=null;
ACT.buildScrub({city:'fra'});closeModal();ACT.teleBuild({city:'sea'});closeModal();ACT.teleLeo({city:'sea'});closeModal();
ACT.buildPop({city:'suv'});ACT.teleBuild({city:'suv'});ACT.wispSat({z:'vanualevu',bird:'kac1',g:2});closeModal();UI.confirm=null;UI.sel=null;
S.day=Math.max(S.day,IP4_HOLD+30);S=migrate(JSON.parse(JSON.stringify(S)));compute();`);
// (Address blocks are held two years before they may be sold: these were bought long ago.)
return P;
@ -72,7 +74,10 @@ test('two-click buttons: the first click arms SRV_ARM\'s key (or waits for ok),
const found = {};
for (const [a, args] of crawl(ev)) if (A.CONFIRM[a] && !found[a]) found[a] = args;
ev('UI.confirm=null;UI.sel=null;closeModal();');
Object.assign(found, { rmScrub: { city: 'fra' }, teleRm: { city: 'sea' }, cancelVxc: found.cancelVxc || { id: 'nolink' }, dkOptOut: found.dkOptOut || { city: 'fra', n: 'Nobody' } }, found);
// (The gateway closes before its teleport, which would take it along.)
Object.assign(found, { rmScrub: { city: 'fra' }, teleLeoRm: { city: 'sea' }, teleRm: { city: 'sea' }, cancelVxc: found.cancelVxc || { id: 'nolink' }, dkOptOut: found.dkOptOut || { city: 'fra', n: 'Nobody' } }, found);
// (A zone's circuit is cancelled before the zone, which would take it along.)
for (const a of ['wispSatRm', 'wispRm']) { const v = found[a] || { z: 'vanualevu' }; delete found[a]; found[a] = v; }
const missing = Object.keys(A.CONFIRM).filter((a) => !found[a] && a !== 'repayLoan');
assert.deepEqual(missing, [], 'a button for every two-click act');
const changed = {};
@ -98,7 +103,7 @@ test('two-click buttons: the first click arms SRV_ARM\'s key (or waits for ok),
if (changed[a]) assert.equal(r.outcome, 'applied', a);
}
// The ones with a real target were really done.
for (const a of ['cancelTransit', 'cancelIx', 'cancelPni', 'rmLink', 'rmSite', 'dropBiz', 'salesFire', 'opsFire', 'rmScrub', 'teleRm', 'connCancel']) if (found[a]) assert.equal(changed[a], true, `${a} did its thing`);
for (const a of ['cancelTransit', 'cancelIx', 'cancelPni', 'rmLink', 'rmSite', 'dropBiz', 'salesFire', 'opsFire', 'rmScrub', 'teleLeoRm', 'teleRm', 'wispSatRm', 'wispRm', 'connCancel']) if (found[a]) assert.equal(changed[a], true, `${a} did its thing`);
assert.deepEqual(P.errors, []);
});
const closeAll = (ev) => ev('closeModal();');

View file

@ -153,12 +153,15 @@ test('the canned stream: every fixture passes the shape checker, and the shape c
assert.equal(upd.v, upd.from + 1);
assert.equal(fixture('upd-day').from, fixture('snap').v, 'the day follows the snapshot');
assert.equal(upd.from, fixture('upd-day').v, 'the actions follow the day');
assert.ok('off' in fixture('clock'), 'the clock carries each network\'s calendar offset');
// One calendar for the session: no offsets, and the network in the snapshot is on the clock's day (it joined late).
assert.ok(!('off' in fixture('clock')), 'the clock carries no calendar offsets');
assert.equal(fixture('snap').S.day, fixture('clock').day);
assert.ok(fixture('snap').S.day0 > 0 && fixture('snap').S.day0 < fixture('snap').S.day, 'the canned network began on the session\'s date');
const broken = [
[{ ...upd, v: upd.from + 2 }, /from \+ 1/], [{ ...upd, r: { ...upd.r, ef: {} } }, /never carries/], [{ ...upd, fx: [['boom', 1]] }, /unknown effect/],
[{ ...upd, acts: [{ rid: 'x', dev: '9f8e7d6c', ui: {} }] }, /rid/], [{ ...fixture('clock'), speed: 3 }, /speed/], [{ ...fixture('roster'), on: ['NOPE'] }, /on/],
[{ ...fixture('snap'), S: { ...fixture('snap').S, mp: { ...fixture('snap').S.mp, sim: undefined } } }, /server network/], [{ t: 'bye', why: 'tired' }, /why/], [{ t: 'nope' }, /unknown event/],
[{ ...upd, s: { ...upd.s, day: 1 }, day: 2 }, /day/],
[{ ...upd, s: { ...upd.s, day: 1 }, day: 2 }, /day/], [{ ...fixture('clock'), off: {} }, /unknown field/],
];
for (const [e, re] of broken) assert.match(checkEvent(e).join('\n'), re);
assert.deepEqual(checkFx(['floater', [1, 2, 'x', '#fff']]), []);
@ -188,12 +191,14 @@ test('the canned state is the game\'s own: migrate() keeps the snapshot and ever
test('the fake engine answers every call in the shapes of section 4.2', async () => {
const e = createFakeEngine(), code = 'K7Q2XD', a = 'abcd1234', b = 'efgh5678';
const all = [];
const L = await e.load(code, [{ nid: a, begin: { name: 'Packet Pals', home: 'fra', preset: 'oncall', asn: 201234, mp: {}, tut: false }, lang: 'en', prefs: {} }, { nid: b, env: { s: sv(40) }, lang: 'de', prefs: {} }]);
// A network that joins the session on its day 40 begins on it, beside one loaded at 40: one calendar.
const L = await e.load(code, [{ nid: a, begin: { name: 'Packet Pals', home: 'fra', preset: 'oncall', asn: 201234, mp: {}, tut: false, day: 40 }, lang: 'en', prefs: {} }, { nid: b, env: { s: sv(40) }, lang: 'de', prefs: {} }]);
assert.equal(L.length, 2); assert.ok(L[0].saved, 'a new network is checkpointed at once');
assert.deepEqual([L[0].day, L[1].day, JSON.parse(L[0].saved.txt).day0], [40, 40, 40]);
assert.ok(L[0].epoch && L[1].epoch && L[0].epoch !== L[1].epoch, 'each realm load has its own epoch');
all.push(...L);
const D = await e.day(code, { d: 1, speed: 1, last: 1, alone: [], nets: [b, a] });
assert.deepEqual(Object.keys(D.nets), [a, b]); assert.equal(D.nets[b].day, 41);
const D = await e.day(code, { d: 41, speed: 1, last: 1, alone: [], nets: [b, a] });
assert.deepEqual(Object.keys(D.nets), [a, b]); assert.deepEqual([D.nets[a].day, D.nets[b].day], [41, 41]);
all.push(D);
const P1 = await e.pull(code, a, {}), P2 = await e.pull(code, a, {});
assert.ok(P1.upd && !P2.upd, 'a pull sends what changed, once'); assert.equal(P2.v, P1.v, 'only a pull with something to send is a version');
@ -204,9 +209,9 @@ test('the fake engine answers every call in the shapes of section 4.2', async ()
await e.sub(code, a, { views: [{ link: 'l1' }] }), await e.greet(code, a), await e.save(code, b), await e.card(code, a));
assert.equal(await e.prefs(code, a, { prefs: { pauseFurious: true } }), undefined);
e.lose(code, b);
const D2 = await e.day(code, { d: 2, nets: [a, b] });
const D2 = await e.day(code, { d: 42, nets: [a, b] });
assert.equal(D2.nets[b].lost, true);
const D3 = await e.day(code, { d: 3, nets: [a, b] });
const D3 = await e.day(code, { d: 43, nets: [a, b] });
assert.equal(D3.nets[b], undefined, 'a lost network has no more days');
assert.equal((await e.act(code, b, env('buildPop', { city: 'par' }))).outcome, 'stopped');
e.failNext('act', 'timeout');
@ -224,7 +229,7 @@ test('the fake engine answers every call in the shapes of section 4.2', async ()
for (const m of all) assert.deepEqual(checkWorker(m), [], JSON.stringify(m).slice(0, 80));
// Held answers wait; a worker that dies rejects everything pending.
e.hold('day');
let done = false; const p = e.day(code, { d: 4, nets: [a] }).then(() => { done = true; });
let done = false; const p = e.day(code, { d: 44, nets: [a] }).then(() => { done = true; });
await new Promise((r) => setImmediate(r));
assert.equal(done, false, 'held');
e.release('day'); await p; assert.equal(done, true);

View file

@ -106,6 +106,28 @@ test('a new network: begin, a snapshot, its welcome, actions, days, a what-if, v
await assert.rejects(E.act(code, nid, msg('launchBB', { city: 'ams' })), (e) => e.code === 'NO_REALM');
});
test('a network that joins a session late begins on the session\'s date, with its head start; a start day that is none is refused', async () => {
const code = 'J01NER', nid = 'late0001';
const [L] = await E.load(code, [begin(nid, { day: 518 })]);
checked(L);
assert.equal(L.day, 518);
const sv = JSON.parse(L.saved.txt);
assert.deepEqual([sv.day, sv.day0, sv.nextFail, sv.nextEvent], [518, 518, 563, 558], 'its schedules count from its own start');
assert.equal(sv.cash, await ev(code, nid, 'return START_CASH+7000'), 'hardware costs 3.7% more by day 518: the bank adds $7k');
checked(await E.pull(code, nid, { snap: true }));
const G = checked(await E.greet(code, nid));
assert.ok(updOf(G).fx.some(([k, p]) => k === 'toast' && p.k === 'goal' && /Late to the party/.test(p.h) && p.a[0].act === 'bank'), 'the late welcome, with a button to the bank');
assert.ok(updOf(G).fx.some(([k, p]) => k === 'toast' && /AS201234/.test(p.h)), 'after the usual welcome');
const D = await day(code, 519, [nid]);
assert.equal(D.nets[nid].day, 519);
for (const bad of [-1, 1.5, '518']) {
const [B] = await E.load(code, [begin('latebad1', { day: bad })]);
checked(B);
assert.match(String(B.err), /start day/, JSON.stringify(bad));
}
await E.unload(code);
});
test('the capture table: every kind of effect comes out as an fx in its shape, at most 60 an update', async () => {
const code = 'CAPTVR', nid = 'capt0001';
checked((await E.load(code, [begin(nid)]))[0]);

453
tests/wisp-zones.test.js Normal file
View file

@ -0,0 +1,453 @@
// Island Wi-Fi (#83): 18 zones of outer islands, each a pool of homes hanging off one island city. Your POP there brings
// them online over satellite capacity from its teleport (GEO about 35% sign up, MEO about 75%, Starblink LEO from a
// gateway there about 90%) or a spur cable (all of them). Their Gbps join the city's demand; they are IPv6-only homes;
// a spur can be cut for weeks, and a satellite kept beside it carries the islands meanwhile.
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');
// Level 3, Change Freeze (nothing breaks by itself, lead times quick), plenty of cash.
const BASE = "ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.lvl=3;S.nextFail=S.nextEvent=1e9;UI.speed=0;S.rules=makeRules('freeze');";
// Suva: a POP with transit (so its traffic gets out) and a teleport.
const SUV = "ACT.buildPop({city:'suv'});ACT.buyTransit({city:'suv',net:NETS.find(n=>sellsAt(n,'suv')).id,tier:1});ACT.teleBuild({city:'suv'});";
const VL = "ACT.wispSat({z:'vanualevu',bird:'kac1',g:2});";
function game(t, setup = '') {
const h = load();
t.after(() => h.dom.window.close());
h.ev(BASE + setup);
return h;
}
const J = (ev, s) => JSON.parse(ev(`JSON.stringify(${s})`));
const Z = "wispZ('vanualevu')";
// Past the day the zone's circuit (or a move) is commissioned.
const ready = `S.day=Math.max(${Z}.sat?${Z}.sat.ready:0,${Z}.nxt?${Z}.nxt.ready:0,${Z}.sp?${Z}.sp.ready:0);compute()`;
const days = (ev, n) => ev(`for(let i=0;i<${n};i++)dayTick()`);
// The first top-level keys whose JSON differs between two states (never deepEqual on S).
const firstDiff = (a, b) => { const A = JSON.parse(a), B = JSON.parse(b); return [...new Set([...Object.keys(A), ...Object.keys(B)])].filter((k) => JSON.stringify(A[k]) !== JSON.stringify(B[k])).slice(0, 5); };
test('the catalog and the geometry: zones off satellite cities, seen by a GEO bird; points give exactly the city answers', (t) => {
const { ev, errors } = game(t);
const ids = J(ev, 'Object.keys(WISP)');
assert.equal(ids.length, 18);
assert.deepEqual(ids, [...ids].sort(), 'ids sorted');
const bad = J(ev, `Object.keys(WISP).filter(z=>{const W=WISP[z],C=CITY[W.c];return !C||!satRemote(W.c)||hav(C.lon,C.lat,W.lon,W.lat)>1000||!Object.keys(SATS).some(id=>SATS[id].orb==='geo'&&satPairAt(id,C,W))
||!(W.P>=3&&W.P<=12)||!(W.km===0||W.km>=50&&W.km<=1500)||typeof W.n!=='string'||!W.n;})`);
assert.deepEqual(bad, []);
// The point versions, on cities, are the city versions: every bird, every satellite city against every city.
const diff = J(ev, `(()=>{const out=[];for(const id of Object.keys(SATS))for(const A of CITIES.filter(C=>satRemote(C.id))){if(satSeesAt(id,A)!==satSees(id,A.id))out.push('sees '+id+A.id);
for(const B of CITIES){if(A.id===B.id)continue;const p=satPairOk(id,A.id,B.id);if(p!==satPairAt(id,A,B))out.push(id+A.id+B.id);else if(p&&satKmAt(id,A,B)!==satKm(id,A.id,B.id))out.push('km '+id+A.id+B.id);}}return out.slice(0,5);})()`);
assert.deepEqual(diff, []);
// Starblink reaches a zone from a gateway in its own city wherever both are under the shell: all but the two beyond 56°.
assert.deepEqual(J(ev, "Object.keys(WISP).filter(z=>!wispBirds(z).includes(LEO_BIRD))"), ['nunavut', 'seak']);
assert.deepEqual(J(ev, "wispBirds('nunavut').map(b=>SATS[b].orb)"), ['geo'], 'Nunavut: GEO only');
assert.deepEqual(J(ev, "wispBirds('vanualevu').map(b=>SATS[b].orb)"), ['geo', 'geo', 'meo', 'leo'], 'GEO first, cheapest first, then MEO and LEO');
assert.deepEqual(errors, []);
});
test('launch over GEO: the kit and the first month, homes at the floor, then the city carries them and they pay island prices', (t) => {
const { ev, errors } = game(t, SUV + "ACT.launchBB({city:'suv'});");
ev('compute()');
const eye0 = ev('R.cityEye.suv'), c0 = ev('S.cash');
ev(VL);
assert.equal(c0 - ev('S.cash'), ev("wispKit('vanualevu')+wispSatMo('kac1',2)"), 'the island kit and the first month');
assert.equal(ev(`${Z}.d`), ev("wispStart('vanualevu')"));
assert.equal(ev('R.wisp.vanualevu.car'), 0, 'nothing before the circuit is commissioned');
assert.equal(ev('R.cost.sat'), ev("TPORT_MO+wispSatMo('kac1',2)"), 'the rent from the order on');
assert.equal(ev('R.cost.wisp'), ev("wispUpMo('vanualevu')"));
ev(ready);
const car = ev('R.wisp.vanualevu.car');
assert.ok(car > 0);
assert.ok(Math.abs(ev('R.cityWisp.suv') - car) < 1e-9, 'the city carries the homes');
assert.ok(Math.abs(ev('R.cityEye.suv') - eye0) < 1e-9, 'broadband stays broadband');
assert.ok(ev('R.wisp.vanualevu.sf') > 0.9, 'served');
assert.ok(Math.abs(ev('R.rev.wisp') - ev('R.wisp.vanualevu.d*R.wisp.vanualevu.sf*wispRate("vanualevu")')) < 1e-6);
assert.equal(ev("wispRate('vanualevu')"), ev('EYE_RATE*14'), 'island prices');
assert.ok(ev('R.revMo') >= ev('R.rev.eyeballs+R.rev.wisp') - 1e-6);
// Investors on a revenue share take their slice of island homes too.
ev("S.loans=[{id:'v',bank:'vult',share:0.1,bal:0}];compute()");
assert.ok(Math.abs(ev('R.cost.revshare') - 0.1 * ev('R.rev.eyeballs+R.rev.business+R.rev.ix+(R.rev.orbit||0)+R.rev.wisp')) < 1e-6);
assert.deepEqual(errors, []);
});
test('take-up grows to the link\'s cap and no further; a small circuit fills, and growing it lets homes in', (t) => {
const { ev, errors } = game(t, SUV + "ACT.wispSat({z:'vanualevu',bird:'kac1',g:5});");
ev(ready);
const K = ev(`wispK('vanualevu',${Z})`);
assert.ok(Math.abs(K - ev("wispPool('vanualevu')*SAT_ORB.geo.wisp")) < 1e-9, 'about 35% over GEO');
let top = 0;
for (let i = 0; i < 40; i++) { days(ev, 10); top = Math.max(top, ev(`${Z}.d`)); }
assert.ok(top <= K + 1e-9, `never past the cap: ${top} of ${K}`);
assert.ok(ev(`${Z}.d`) > 0.9 * K, 'close to it after a year');
// A 1G circuit: homes hover where it serves 90% of them.
ev("ACT.wispSatSize({z:'vanualevu',g:1})");
days(ev, 200);
const d1 = ev(`${Z}.d`);
assert.ok(d1 > 0.95 && d1 < 1.25, `about 1/0.9 G: ${d1}`);
ev("selectCity('suv');UI.tab='cust';UI.wz='vanualevu';renderPanel()");
assert.match(ev("document.getElementById('panel').textContent"), /The link is full: homes are waiting/);
const c0 = ev('S.cash');
ev("ACT.wispSatSize({z:'vanualevu',g:5})");
assert.equal(c0 - ev('S.cash'), ev("wispSatMo('kac1',5)"), 'a bigger one pays its month up front');
days(ev, 100);
assert.ok(ev(`${Z}.d`) > 1.5, 'more homes come in');
assert.deepEqual(errors, []);
});
test('moving to MEO: tracking antennas first, then the old circuit carries until the new one is up', (t) => {
const { ev, errors } = game(t, SUV + VL);
ev(ready);
const c0 = ev('S.cash');
ev("ACT.wispSat({z:'vanualevu',bird:'o3b',g:5})");
assert.equal(ev('S.cash'), c0, 'nothing charged');
assert.match(ev("wispSatWhy('vanualevu','o3b',5)"), /tracking antennas/);
ev("ACT.teleTrk({city:'suv'});ACT.wispSat({z:'vanualevu',bird:'o3b',g:5})");
assert.equal(ev(`${Z}.nxt.bird`), 'o3b');
assert.equal(ev(`${Z}.sat.bird`), 'kac1');
assert.match(ev("wispSatWhy('vanualevu','is18',2)"), /move to another satellite is under way/);
ev('compute()');
assert.equal(ev(`wispLink('vanualevu',${Z})===${Z}.sat`), true, 'the old circuit carries meanwhile');
assert.ok(ev('R.wisp.vanualevu.car') > 0);
assert.equal(ev('R.cost.sat'), ev("TPORT_MO+TRK_MO+wispSatMo('kac1',2)+wispSatMo('o3b',5)"), 'both rents while it moves');
ev(`S.day=${Z}.nxt.ready-1;dayTick()`);
assert.equal(ev(`${Z}.sat.bird`), 'o3b');
assert.equal(ev(`${Z}.nxt`), undefined);
assert.ok(Math.abs(ev(`wispK('vanualevu',${Z})`) - ev("wispPool('vanualevu')*SAT_ORB.meo.wisp")) < 1e-9, 'about 75% over MEO');
assert.match(ev("JSON.stringify(S.log.slice(0,8).map(e=>e.t))"), /Vanua Levu & Taveuni now rides O3bservant/);
assert.deepEqual(errors, []);
});
// Before anything reaches the islands, nobody is online yet: the zone says when they will be, not "0.0 Gbps of homes"
// in red. The upkeep is paid from the order on, so it stays.
test('while its first circuit or spur is commissioned, a zone says when the islands come online, with no red 0% served', (t) => {
const { ev, errors } = game(t, SUV + VL);
const text = () => ev("document.getElementById('panel').textContent");
const sec = () => ev("[...document.querySelectorAll('#panel section')].filter(s=>/Island Wi-Fi/.test(s.querySelector('h3').textContent)).map(s=>s.innerHTML).join('')");
const show = "UI.sel={type:'city',id:'suv'};UI.tab='cust';UI.wz='vanualevu';renderAll()";
const pending = (n) => {
const p = text();
assert.doesNotMatch(p, /Homes online|Served on the islands|% served|of 0\.0 Gbps|\$0\/mo/, 'nobody online yet');
assert.match(p, new RegExp(`Coming up[^]*ready in ${n}d[^]*The islands come online in ${n} days?`));
assert.match(p, /Towers, solar and crews/, 'the upkeep is paid from the order on');
assert.doesNotMatch(sec(), /--tx-red|--bad/);
};
ev(show);
const n = ev(`${Z}.sat.ready-S.day`);
assert.ok(n >= 1, 'GEO takes days to point: ' + n);
pending(n);
ev(ready + ';' + show);
assert.match(text(), /Homes online[^]*Served on the islands[^]*Revenue/);
assert.match(text(), /\d+% served/);
assert.doesNotMatch(text(), /come online in/);
// A spur alone takes weeks (months outside Change Freeze): the same, day after day, until it is lit.
ev("ACT.wispRm({z:'vanualevu'});ACT.wispRm({z:'vanualevu'});ACT.wispSpur({z:'vanualevu'});" + show);
const m = ev(`${Z}.sp.ready-S.day`);
assert.ok(m > 2, 'a spur takes weeks: ' + m);
pending(m);
days(ev, 1);
ev(show);
pending(m - 1);
// A circuit ordered beside it comes up first: the sooner of the two.
ev(VL + show);
pending(ev(`${Z}.sat.ready-S.day`));
// A zone whose circuit was cancelled before it came up: no link, no homes rows and no date.
ev("ACT.wispRm({z:'vanualevu'});ACT.wispRm({z:'vanualevu'});" + VL + "ACT.wispSatRm({z:'vanualevu'});ACT.wispSatRm({z:'vanualevu'});" + show);
assert.equal(ev(`!!${Z}&&!${Z}.sat`), true);
assert.match(text(), /No link yet/);
assert.doesNotMatch(text(), /Homes online|% served|come online in/);
assert.deepEqual(errors, []);
});
// The islands have no pie dish of their own (a zone is no city): once your crust flies, a zone's Starblink row says what
// is left for them, with or without a gateway in its city; a city's own gateway row keeps its pie dish advice.
test('once your own constellation flies, a zone\'s Starblink row points to GEO, MEO or a spur, never to a pie dish', (t) => {
const { ev, errors } = game(t, 'S.lvl=5;' + SUV + "ACT.teleLeo({city:'suv'});S.pieV=1;pieInit();S.pie.crusts.short.cohorts=[{n:CRUSTS.short.full,day:S.day,las:false}];compute();");
assert.equal(ev('leoRival()'), true);
const row = () => { ev("UI.sel={type:'city',id:'suv'};UI.tab='cust';UI.wz='vanualevu';renderAll()"); return ev("[...document.querySelectorAll('#panel .wisp .row')].map(r=>r.textContent).find(t=>/Starblink/.test(t))||''"); };
for (const gw of [true, false]) {
if (!gw) ev("delete S.pops.suv.leo;compute()");
assert.equal(ev("leoGw('suv')"), gw);
const why = ev("wispSatWhy('vanualevu','sb53',5)");
assert.match(why, /rival constellation/, 'gateway ' + gw);
assert.doesNotMatch(why, /pie dish/, 'gateway ' + gw);
const r = row();
assert.match(r, /rival constellation[^]*GEO or MEO capacity, or a spur cable/, 'gateway ' + gw);
assert.doesNotMatch(r, /pie dish/, 'gateway ' + gw);
}
assert.ok(!J(ev, "[...document.querySelectorAll('#panel .wisp [data-act]')].filter(b=>!b.disabled).map(b=>b.dataset.act)").includes('teleLeo'), 'no gateway to host');
assert.match(ev("leoGwWhy('suv')"), /pie dish/, 'a city\'s own gateway keeps its advice');
assert.deepEqual(errors, []);
});
// Real unrepeatered cables stop at a few hundred km; a spur here runs up to 1,400 km. And in French a "câble d'antenne"
// next to towers and radios is the towers' coax, not a branch cable under the sea.
test('the spur in words: no "unrepeatered" for cables up to 1,400 km in any language, and a branch cable in French', (t) => {
const { ev } = game(t);
assert.ok(ev('Math.max(...Object.values(WISP).map(W=>W.km))') > 650, 'spurs longer than any unrepeatered cable');
const dict = (f) => fs.readFileSync(path.join(__dirname, '..', f), 'utf8').split('\n');
for (const f of ['src/i18n/en.js', ...['de', 'es', 'fr', 'it', 'pt'].map((l) => `site/i18n/${l}.js`)]) {
const s = dict(f).find((l) => l.startsWith('"wisp.spur_lead":'));
assert.ok(s, f);
assert.doesNotMatch(s, /repeat|répét|repetid|ripetit/i, f);
}
assert.deepEqual(dict('site/i18n/fr.js').filter((l) => /^"wisp\./.test(l) && /câbles? d.antenne/.test(l)), []);
assert.match(dict('site/i18n/fr.js').find((l) => l.startsWith('"wisp.spur":')), /dérivation/);
});
test('the spur: level 3, never where one cannot be laid, the price of the day; lit, everyone signs up and the satellite stands by', (t) => {
const { ev, errors } = game(t, SUV + VL + "ACT.buildPop({city:'yfb'});");
ev('S.lvl=2');
assert.match(ev("wispSpurWhy('vanualevu')"), /level 3/);
ev('S.lvl=3');
assert.match(ev("wispSpurWhy('nunavut')"), /sea ice/);
const c0 = ev('S.cash');
ev("ACT.wispSpur({z:'nunavut'})");
assert.equal(ev('S.cash'), c0, 'refused');
ev("ACT.wispSpur({z:'vanualevu'})");
assert.equal(c0 - ev('S.cash'), ev("wispSpurCost('vanualevu')"));
assert.equal(ev("wispSpurCost('vanualevu')"), Math.round((150000 + 600 * 220) / 1000) * 1000, 'today\'s price, no market under Change Freeze');
assert.match(ev("wispSpurWhy('vanualevu')"), /laid already/);
ev(ready);
assert.ok(Math.abs(ev(`wispK('vanualevu',${Z})`) - ev("wispPool('vanualevu')")) < 1e-9, 'everyone may sign up');
assert.equal(ev(`wispLink('vanualevu',${Z}).sp`), true, 'the spur carries');
ev(`${Z}.d=5;compute()`);
assert.ok(ev('R.wisp.vanualevu.car') > 2 + 1e-6, 'more than the 2G circuit could');
assert.equal(ev('R.cost.sat'), ev("TPORT_MO+wispSatMo('kac1',2)"), 'the circuit standing by is still rented');
assert.equal(ev('R.cost.wisp'), ev("wispUpMo('vanualevu')+wispSpurMo('vanualevu')"));
ev("UI.sel={type:'city',id:'suv'};UI.tab='links';renderAll()");
assert.match(ev("document.getElementById('panel').textContent"), /Vanua Levu & Taveuni[^]*Standby/);
assert.deepEqual(errors, []);
});
test('the single-spur trap: a cut takes weeks; a satellite beside it carries the islands, without one they go dark and leave', (t) => {
const { ev, errors } = game(t, SUV + VL + "ACT.wispSpur({z:'vanualevu'});");
ev(ready + `;${Z}.d=5;compute()`);
// A spur that is lit and whole is something a failure can find; nothing else gives it a weight.
const opts = "(()=>{window.__opts=null;runNow(eval('('+failureRun.toString().replace('if(!opts.length)return;','window.__opts=opts.map(o=>o.join(\":\"));return;')+')')());return __opts;})()";
assert.ok(J(ev, opts).includes('wspur:1.5'));
ev('fireFailure("wspur")');
const inc = J(ev, "S.inc.find(i=>i.type==='wspur')");
assert.ok(inc && inc.z === 'vanualevu' && inc.ref === 'suv' && inc.cost === 250000);
assert.ok(inc.until - ev('S.day') >= 14, 'weeks for the repair ship');
assert.match(inc.msg, /The satellite circuit carries the islands meanwhile/);
assert.equal(ev("incTitle('wspur')"), 'Spur cut');
assert.ok(!J(ev, opts).some((o) => o.startsWith('wspur')), 'a cut spur is not cut again');
ev('compute()');
assert.ok(Math.abs(ev('R.wisp.vanualevu.car') - 2) < 1e-9, 'the 2G circuit carries what it can');
// The rush button charges the ship and mends it.
const c0 = ev('S.cash');
ev(`ACT.fixInc({id:${JSON.stringify(inc.id)}})`);
assert.equal(c0 - ev('S.cash'), 250000);
assert.equal(ev("wispCut('vanualevu')"), 0);
assert.ok(ev('R.wisp.vanualevu.car') > 2 + 1e-6, 'the spur carries again');
// Without a satellite: dark, and homes leave toward the floor.
ev("ACT.wispSatRm({z:'vanualevu'});ACT.wispSatRm({z:'vanualevu'});fireFailure('wspur')");
assert.match(J(ev, "S.inc.find(i=>i.type==='wspur')").msg, /offline until it is mended/);
ev('compute()');
assert.equal(ev('R.wisp.vanualevu.car'), 0);
assert.equal(ev('R.wisp.vanualevu.sf'), 0);
const d0 = ev(`${Z}.d`);
days(ev, 5);
assert.ok(ev(`${Z}.d`) < d0, 'homes leave');
assert.ok(ev(`${Z}.d`) >= ev("wispStart('vanualevu')") - 1e-9, 'never below the floor');
// The intern's repair order rushes it, once its budget is raised past the ship.
ev("ACT.opsHire({id:'kevin'});S.ops.floor=0;closeModal();S.ops.on.repair=true;S.ops.cap.repair=1e6;");
ev('opsDay(S.day)');
assert.equal(ev("S.inc.some(i=>i.type==='wspur')"), false, 'rushed');
// No spur at all: the failure has nothing to find.
ev("S.inc=[];ACT.wispRm({z:'vanualevu'});ACT.wispRm({z:'vanualevu'})");
assert.ok(!J(ev, opts).some((o) => o.startsWith('wspur')));
const n = ev('S.inc.length');
ev("fireFailure('wspur')");
assert.equal(ev('S.inc.length'), n, 'nothing to cut');
assert.deepEqual(errors, []);
});
test('IPv4: island homes are IPv6-only from day one, in the NAT64 pool, never behind CGNAT', (t) => {
const { ev, errors } = game(t, "S.rules=makeRules('oncall');" + SUV);
assert.equal(ev('ip4On()'), true);
const u0 = J(ev, 'ip4Use()');
ev(VL + `${Z}.d=3;compute()`);
const u1 = J(ev, 'ip4Use()');
assert.ok(Math.abs(u1.H6 - u0.H6 - 30) <= 1, `H6 grows by d×${ev('IP4_BB')}: ${u0.H6} → ${u1.H6}`);
assert.equal(u1.cg, u0.cg, 'no home behind CGNAT for it');
ev("selectCity('suv');UI.tab='cust';UI.wz='vanualevu';renderPanel()");
assert.match(ev("document.getElementById('panel').textContent"), /IPv6-only \(464XLAT\) from day one/);
assert.deepEqual(errors, []);
});
test('saves: zones and circuits survive a reload, broken ones are repaired, and the state stays canonical', (t) => {
const { ev, errors } = game(t, SUV + VL + "ACT.wispSpur({z:'vanualevu'});ACT.buildPop({city:'tbu'});ACT.buildPop({city:'yfb'});");
ev(ready + ";fireFailure('wspur');compute()");
const s0 = ev('JSON.stringify(S)'), s1 = ev('JSON.stringify(migrate(JSON.parse(JSON.stringify(S))))');
assert.ok(s0 === s1, 'a reload changes nothing: ' + firstDiff(s0, s1).join(', '));
// Broken saves.
const fix = (code) => J(ev, `(()=>{const s=JSON.parse(JSON.stringify(S));${code};return migrate(s);})()`);
let s = fix("s.pops.suv.wisp.bogus={day:0,d:1};s.pops.suv.wisp.vavau={day:0,d:1};s.pops.suv.wisp.constructor={day:0,d:1}");
assert.deepEqual(Object.keys(s.pops.suv.wisp), ['vanualevu'], 'unknown and misplaced zones go');
s = fix("s.pops.suv.wisp.vanualevu.sat.bird='is37'");
assert.equal(s.pops.suv.wisp.vanualevu.sat, undefined, 'a bird that does not see the islands');
s = fix("s.pops.suv.wisp.vanualevu.sat.bird='o3b'");
assert.equal(s.pops.suv.wisp.vanualevu.sat, undefined, 'MEO without tracking antennas');
s = fix("s.pops.suv.wisp.vanualevu.nxt=s.pops.suv.wisp.vanualevu.sat;delete s.pops.suv.wisp.vanualevu.sat");
assert.equal(s.pops.suv.wisp.vanualevu.sat.bird, 'kac1', 'a move without a circuit is the circuit');
assert.equal(s.pops.suv.wisp.vanualevu.nxt, undefined);
s = fix("s.pops.suv.wisp.vanualevu.sat.g=3;s.pops.suv.wisp.vanualevu.d='x'");
assert.equal(s.pops.suv.wisp.vanualevu.sat.g, 2, 'a size the orbit sells');
assert.equal(s.pops.suv.wisp.vanualevu.d, 0);
s = fix("s.pops.yfb.wisp={nunavut:{day:0,d:1,sp:{day:0,ready:5}}}");
assert.deepEqual(s.pops.yfb.wisp.nunavut, { day: 0, d: 1 }, 'no spur where none can be laid');
s = fix("delete s.pops.suv.wisp.vanualevu.sp");
assert.equal(s.inc.some((i) => i.type === 'wspur'), false, 'a cut without its spur goes');
s = fix("delete s.pops.suv.tele");
assert.equal(s.pops.suv.wisp.vanualevu.sat, undefined, 'no teleport, no circuit');
s = fix("s.pops.suv.wisp=[1]");
assert.equal(s.pops.suv.wisp, undefined);
// The gate flipping (below level 2) leaves the homes as they were, and nothing in the money.
const d0 = ev(`${Z}.d`);
ev('S.lvl=1;compute();dayTick()');
assert.equal(ev(`${Z}.d`), d0);
assert.ok(Number.isFinite(ev(`${Z}.d`)));
assert.equal(ev("'wisp' in R.rev||'wisp' in R.cost"), false);
assert.equal(ev("['cityWisp','wisp','wispL'].some(k=>k in R)"), false, 'and nothing in the routing results');
// An old save has no zones and runs as it did.
ev(`S=migrate(JSON.parse(${JSON.stringify(SAVE)}));compute()`);
assert.equal(ev("Object.values(S.pops).some(p=>'wisp' in p)"), false);
assert.equal(ev("['cityWisp','wisp','wispL'].some(k=>k in R)"), false, 'no zone, no new fields: R is what main routes (tests/route-fuzz.test.js)');
assert.equal(ev("'wisp' in R.cost||'wisp' in R.rev"), false);
assert.ok(ev('R.served') > 0);
assert.deepEqual(errors, []);
});
test('the teleport stays while a zone rides it; decommissioning the city closes its zones and their cuts at once', (t) => {
const { ev, errors } = game(t, SUV + VL + "ACT.wispSpur({z:'vanualevu'});ACT.buildPop({city:'syd'});");
ev(ready + ";fireFailure('wspur')");
ev("ACT.teleRm({city:'suv'})");
assert.equal(ev('teleOf("suv")'), 1, 'refused');
assert.match(ev("JSON.stringify(S.log.slice(0,3).map(e=>e.t))"), /Cancel its satellite circuit first/);
ev("UI.sel={type:'city',id:'suv'};UI.tab='links';renderAll()");
assert.ok(!J(ev, "[...document.querySelectorAll('#panel [data-act]')].map(b=>b.dataset.act)").includes('teleRm'), 'no close button');
ev("ACT.decomOpen({city:'suv'})");
assert.match(ev("document.getElementById('modalCard').textContent"), /Island Wi-Fi closes with it: Vanua Levu & Taveuni/);
ev('ACT.decomGo()');
assert.equal(ev('!!S.pops.suv'), false);
assert.equal(ev("S.inc.some(i=>i.type==='wspur')"), false, 'the cut goes with it');
assert.equal(ev('wispAll().length'), 0);
assert.equal(ev('R.cost.sat||0'), 0);
assert.deepEqual(errors, []);
});
test('gates: never in puzzles, the Architect or scenarios, and not below level 2', (t) => {
const { ev, errors } = game(t, SUV + VL);
ev(ready);
assert.equal(ev('wispOn()'), true);
ev("S.lvl=1;compute();UI.sel={type:'city',id:'suv'};UI.tab='cust';renderAll()");
assert.equal(ev('wispOn()'), false);
assert.doesNotMatch(ev("document.getElementById('panel').textContent"), /Island Wi-Fi/);
assert.equal(ev("wispFact('suv')+wispHtml('suv')"), '');
assert.equal(ev("'wispL' in R||'cityWisp' in R"), false, 'its homes are no demand');
assert.match(ev("wispSatWhy('vanualevu','kac1',2)"), /level 2/);
ev("ACT.startScn({id:SCN[0].id})");
assert.equal(ev('!!S.scn&&wispOn()'), false, 'scenarios');
ev("ACT.pzStart({id:PZ[0].id})");
assert.equal(ev("S.mode==='puzzle'&&wispOn()"), false, 'puzzles');
ev("ACT.pzArStart({id:'euro'})");
assert.equal(ev('!!S.ar&&wispOn()'), false, 'the Architect');
ev("ACT.pzLeave();ACT.modeSet({m:'sandbox'});ACT.start({});if(UI.pendGame)ACT.pitchSkip()");
assert.equal(ev("S.mode==='sandbox'&&wispOn()"), true, 'sandbox has them');
assert.deepEqual(errors, []);
});
test('Starblink: a gateway on your fiber in the zone\'s own city brings 90% of the islands online at about 30 ms', (t) => {
const { ev, errors } = game(t, 'S.lvl=5;' + SUV + "ACT.buildPop({city:'yfb'});ACT.teleBuild({city:'yfb'});");
assert.match(ev("wispSatWhy('vanualevu','sb53',5)"), /gateway/);
ev("ACT.wispSat({z:'vanualevu',bird:'sb53',g:5})");
assert.equal(ev(Z), null, 'refused without a gateway');
ev("ACT.teleLeo({city:'suv'})");
assert.equal(ev("wispSatWhy('vanualevu','sb53',5)"), '');
assert.equal(ev(`leoReachLL('suv',WISP.vanualevu.lat,WISP.vanualevu.lon)`), true);
const rtt = ev("Math.round(2*wispMs('vanualevu','sb53'))");
assert.ok(rtt >= 25 && rtt <= 45, `about 30 ms round trip, got ${rtt}`);
// Nunavut is past the shell: GEO only, whatever you build.
assert.ok(!J(ev, "wispBirds('nunavut')").includes('sb53'));
assert.match(ev("wispSatWhy('nunavut','sb53',5)"), /does not see both/);
const c0 = ev('S.cash');
ev("ACT.wispSat({z:'vanualevu',bird:'sb53',g:5})");
assert.equal(c0 - ev('S.cash'), ev("wispKit('vanualevu')+wispSatMo('sb53',5)"));
assert.equal(ev("wispSatMo('sb53',5)"), Math.round(ev("satMo('sb53',5)") * 0.6 / 10) * 10, 'a contended share of Starblink\'s own price');
ev(ready);
assert.ok(Math.abs(ev(`wispK('vanualevu',${Z})`) - ev("wispPool('vanualevu')*SAT_ORB.leo.wisp")) < 1e-9, 'about 90% over LEO');
ev(`${Z}.d=4;compute()`);
assert.ok(Math.abs(ev('R.wisp.vanualevu.car') - 4) < 1e-9);
assert.equal(ev('R.cost.sat'), ev("TPORT_MO*2+LEO_GW_MO+wispSatMo('sb53',5)"));
// The gateway's readout counts the islands landing there; it stays while they ride it.
ev("UI.sel={type:'city',id:'suv'};UI.tab='links';renderAll()");
const infra = ev("document.getElementById('panel').textContent");
assert.match(infra, /Landing here from orbit4\.0 Gbps/);
assert.ok(!J(ev, "[...document.querySelectorAll('#panel [data-act]')].map(b=>b.dataset.act)").includes('teleLeoRm'));
ev("ACT.teleLeoRm({city:'suv'});ACT.teleLeoRm({city:'suv'})");
assert.equal(ev("leoGw('suv')"), true, 'not while a zone rides it');
// A storm puts it in safe mode too, and a zone alone is enough for one to come.
assert.equal(ev('leoLive()'), true, 'a zone over LEO is in the sky');
ev('fireFailure("leostorm");compute()');
assert.ok(ev('S.ev.sky') > ev('S.day'));
assert.equal(ev('R.wisp.vanualevu.car'), 0, 'safe mode');
ev("UI.sel={type:'city',id:'suv'};UI.tab='cust';UI.wz='vanualevu';renderAll()");
assert.match(ev("document.getElementById('panel').textContent"), /Safe mode through a solar storm/);
ev('S.day=S.ev.sky;compute()');
assert.ok(ev('R.wisp.vanualevu.car') > 0, 'back after the storm');
// Once your own constellation carries, Starblink sells nothing new: no growth, no new zone; the circuit keeps running.
ev("S.pieV=1;pieInit();S.pie.crusts.short.cohorts=[{n:CRUSTS.short.full,day:S.day,las:false}];compute()");
assert.equal(ev('leoRival()'), true);
ev("ACT.wispSatSize({z:'vanualevu',g:10})");
assert.equal(ev(`${Z}.sat.g`), 5, 'no growth');
assert.match(ev("wispSatWhy('santo','sb53',5)"), /rival constellation|POP in/);
assert.ok(ev('R.wisp.vanualevu.car') > 0, 'the circuit already rented keeps carrying');
ev("ACT.wispSatSize({z:'vanualevu',g:5})");
// A reload without the gateway drops the LEO circuit; a GEO one stays.
const s = J(ev, "(()=>{const s=JSON.parse(JSON.stringify(S));delete s.pops.suv.leo;return migrate(s);})()");
assert.equal(s.pops.suv.wisp.vanualevu.sat, undefined);
assert.deepEqual(errors, []);
});
test('on a phone: the zones in the Customers tab, the order rows, the spur and the teleport rows, at 360 px', (t) => {
const { ev, errors } = game(t, SUV);
ev('window.innerWidth=360;window.innerHeight=740;window.dispatchEvent(new window.Event("resize"))');
assert.equal(ev('isPhone()'), true);
const text = (sel) => ev(`(document.querySelector('${sel}')||{}).textContent||''`);
const acts = (sel) => J(ev, `[...document.querySelectorAll('${sel} [data-act]')].map(b=>b.dataset.act)`);
// A city with zones and no POP: the chip and the teaser.
ev("UI.sel={type:'city',id:'tbu'};renderAll()");
assert.match(text('#panel'), /1 island zone/);
assert.match(text('#panel'), /Open a POP here to bring Wi-Fi to the islands around it: Vava’u & Ha’apai \(3\.\d Gbps of homes\)/);
// With a POP and no teleport yet, the teleport's reach counts the islands too.
ev("ACT.buildPop({city:'tbu'});UI.sel={type:'city',id:'tbu'};UI.tab='links';renderAll()");
assert.match(text('#panel'), /in reach at your level\.\s*Island Wi-Fi from this teleport: 1 island zone/);
// The zone, opened, before anything is bought: the birds, the kit, the spur.
ev("UI.sel={type:'city',id:'suv'};UI.tab='cust';renderAll();ACT.wispOpen({z:'vanualevu'})");
assert.equal(ev('UI.wz'), 'vanualevu');
assert.match(text('#panel'), /Island Wi-Fi[^]*No link yet[^]*Backhaul[^]*island kit[^]*Spur cable[^]*Lay the spur/);
assert.ok(acts('#panel').filter((a) => a === 'wispSat').length >= 4, 'sizes as buttons');
assert.ok(acts('#panel').includes('teleTrk'), 'MEO: the tracking antennas first');
ev(VL + ready + ';renderAll()');
assert.match(text('#panel'), /Homes online[^]*Served on the islands[^]*Towers, solar and crews/);
assert.ok(acts('#panel').includes('wispSatSize') && acts('#panel').includes('wispSatRm') && acts('#panel').includes('wispRm'));
// The same button folds it.
ev("ACT.wispOpen({z:'vanualevu'})");
assert.equal(ev('UI.wz'), null);
ev("ACT.wispOpen({z:'vanualevu'})");
const h = ev("[...document.querySelectorAll('#panel section')].filter(s=>/Island Wi-Fi/.test(s.querySelector('h3').textContent)).map(s=>s.innerHTML).join('')");
assert.match(h, /Homes online/);
assert.doesNotMatch(h, /width:\s*\d+px|min-width|color:var\(--bad\)/, 'no fixed widths, no red that dark mode cannot read');
for (const s of ['#panel', '#toasts']) assert.doesNotMatch(text(s), /wisp\.|satellites\.|undefined|NaN/, s);
// The teleport lists the zone's circuit, which opens the zone.
ev("UI.tab='links';renderAll()");
assert.match(text('#panel'), /Island Wi-Fi from this teleport:[^]*Vanua Levu & Taveuni/);
assert.ok(acts('#panel').includes('wispOpen'));
// The dashboard's cost row.
ev("ACT.wispSpur({z:'vanualevu'});" + ready + ";ACT.dash&&ACT.dash();renderDash&&renderDash()");
assert.equal(ev("tr('wisp.costs_row')"), 'Island Wi-Fi: towers and spurs');
assert.deepEqual(errors, []);
});