94 Commits
Author SHA1 Message Date
adrien a33dfe8132 Chose one of two main-menu backgrounds at launch 2026-09-21 12:57:57 +02:00
adrien d73ea4735d Grew the economy at a constant rate and forecast the budget
GDP per capita had no natural growth, so a nation's economy only moved
when population, buildings or war did. The summary stats also offered
inconsistent hover text: a native browser tooltip for popularity and none
at all for the budget.

- Every land tile now gains a constant 0.01% of the GDP per capita it
  opened with, once a day. Because the amount is fixed the relative growth
  rate tapers over the years. Each tile's opening figure is snapshotted
  once and shipped to the browser, so the tile panel and the GDP-per-capita
  map mode stay in step with the server.
- The population, GDP and GDP/capita tooltips show the relative growth:
  against 1 January 2000 through the first year, then year on year. The
  monthly captures now keep a rolling thirteen months for the baseline.
- Every summary stat explains itself through the same custom bubble.
  Popularity's native title moved onto it, and Budget forecasts the next
  calendar month at the current hourly net, as a compact figure such as
  "+€3.28B/mo" (hoursInNextMonth follows the real calendar).
- The tile GDP breakdown shows gains with a plus sign (natural growth,
  ports) rather than the old minus.

Added tests for the constant daily gain, the falling relative rate, the
first-year and year-on-year baselines, the snapshot baseline, the budget
forecast and the calendar month length.
2026-09-21 12:27:11 +02:00
adrien 8e2232936e Let the political view spread its labels further
A country's name is fitted to the shape of its holding without ever
squashing the letters, so a large holding with a short name ran out of
kerning before it filled the space.

- Raised MAX_KERNING from 2 to 5, letting the run open up further across
  broad holdings.
- Noted at the top of the file that these figures are meant to be tuned by
  hand and must not change how the tests behave.
2026-09-21 11:40:47 +02:00
adrien bd9b206708 Gave the new buildings real effects
The catalogue had grown a barracks, wartime shelters, an air-defense
battery, a warm-water port and a shipyard, but only as data: infantry
still trained without a barracks, shelters did nothing, and an airport was
just an airbase. Each building now names the rule it grants with a
`mechanic` id, so the simulation and the city panel describe the same
thing without magic strings.

- Barracks and shipyards open one more production line each. A line sticks
  to one entry at full rate, so two units build at once rather than the
  head absorbing every line; the base behaviour (one queue, overflow
  carrying into the next entry) is unchanged.
- Wartime shelters keep 10% of civilians per level safe from bombardment
  and are very hard to knock down, and ranged fire can now destroy a
  building level outright, with no refund. Each building rolls its own
  chance per point of damage, from a generator seeded off the world so a
  bombardment replays identically.
- Air defense fires one volley at a hostile aircraft the moment it enters
  the city tile, scaled by its level; a plane shot down never drops its
  bombs.
- A port adds 1000 GDP per capita per level, per adjacent sea tile, to
  every tile in its region.
- An airport draws a daily trickle of people from every other airport city
  in the world, scaled by the destination's level.
- Wired the new effects into the city panel and taught the repeatable
  Industrial Automation to satisfy other technologies' prerequisites.

Added tests for each mechanic and for the parallel lines.
2026-09-21 11:38:01 +02:00
adrien 4b634e4561 Rebuilt the fog of war a tile at a time
Marching into enemy territory changes visibility every step, and each change
rebuilt the whole on-screen fog band. A tile's fog depends only on its own
level and its six neighbours', so the exact dependency radius is one tile, far
tighter than the vision radius.

- Every tile owns a fixed slot in one fog buffer, so rebuilding a tile never
  shifts another's vertices and only the touched row spans are re-uploaded.
  _applyKnowledge now diffs the visible/explored sets and hands the renderer
  the changed tiles; buildFogTiles rebuilds them with their rings. On a 100x100
  map a frontier patch is ~3-4 ms against ~80 ms for the band.
- A pan that leaves the built rows now builds only the newly exposed rows, and
  the escape margin scales with the viewport, so dragging rebuilds rarely.
- _frame schedules the next animation frame before doing any work and catches
  an error, so a one-off failure can no longer stop the frame loop for good.
- Added tests for the per-tile patch and the incremental pan.
2026-09-21 11:06:44 +02:00
adrien bb097ea601 Built the map fog for the visible rows only
Marching into unexplored or enemy land reveals a tile every step, and each
reveal rebuilt the whole-map fog mesh: about 1.8M vertices and 50 MB on a
160x160 map, regenerated at the rebuild throttle. Walking through
already-explored home land reveals nothing, which is why the stutter only
showed up on a border crossing, with a single unit.

- buildKnowledge now takes a row range and builds only the rows on screen; the
  row table stays full length so the existing row-banded draw keeps working.
- _flushFog rebuilds on a visibility change or a pan to a new row band, still
  coalesced, and the draw clamps to the band that was built.
- A mode/zoom change schedules the band rebuild instead of building the whole
  mesh, and uniform interior tiles skip the per-vertex blur kernel.
2026-09-21 09:46:34 +02:00
adrien b2ab4d76eb Sped up large battles and trimmed snapshot traffic
- The bombardment overlay was rebuilt every animation frame, and each barrage
  scanned the whole army to find its target (O(strikes x units)). It now
  redraws at most at the renderer's 24 fps, reuses its SVG/DOM nodes, and
  resolves garrisons from one per-snapshot tile index, so a high-refresh
  display no longer makes a big battle worse.
- Route truncation had the same shape: every step of every route rescanned
  every unit. The snapshot now buckets the army by tile once.
- Idle units no longer have identical left/top rewritten every frame, and the
  whole-map fog buffer is rebuilt less often.
- Snapshot traffic: cityStats and visible are delta-encoded like territory and
  population, city stats carry a content-hash version, tile ethnicity is
  memoised, and a city's economy is derived once per broadcast instead of
  twice. A per-peer civ change now forces a full snapshot, since the visible
  set is per-viewer.
2026-09-21 02:23:04 +02:00
adrien dc0432a60a Put the key art behind the main menu 2026-09-21 01:08:42 +02:00
adrien ede258d39f Added warfare depth, focused research and a reworked HUD
- Tile improvements (fortifications, radar towers, coastal cannons), trenches,
  zone of control, support-unit capture and launch transports, with parabolic
  barrage arcs drawn between attacker and target.
- Focused research that pours points straight into the chosen technology, with
  per-technology progress kept when the focus changes, plus repeatable levels.
- Popularity reworked to integer points, war and pillage effects, minority
  policies and month-over-month arrows on the nation summary.
- City progress bars, square improvement buttons, a technology tab of wide
  short cards with progress bars, transport cargo readout and double-click to
  open a city panel.
2026-09-21 01:07:36 +02:00
adrien e71b1b1aa4 Added buildable roads and railways drawn as winding textured links 2026-09-20 20:43:10 +02:00
adrien 84dd4473fd Logged the WebGL setup and held the loading screen until the map is ready 2026-09-20 17:20:59 +02:00
adrien bf4fc6d6a0 Added a tundra fringe and ragged polar ice edges to the map generator 2026-09-20 17:20:46 +02:00
adrien b29be13799 Added a capability report when the WebGL map renderer is unavailable 2026-09-20 09:41:41 +02:00
adrien 34e755d1a4 Optimised snapshot traffic and map rendering 2026-09-20 01:07:03 +02:00
adrien b385679e52 Sped up the flat map modes and added a boot-style loading log 2026-09-19 22:56:12 +02:00
adrien eca9e39760 Added political and economic map modes 2026-09-19 22:40:24 +02:00
adrien 187c7a7ed8 Added coastal water wavelets with a Voronoi normal map 2026-09-19 22:03:58 +02:00
adrien 2c022d0cbb Reworked terrain relief, the ocean and the borders 2026-09-19 21:40:37 +02:00
adrien 2126129515 Added a seeded terrain heightmap with relief lighting and LODs 2026-09-19 20:19:12 +02:00
adrien 45dabed2c7 Split the bottom HUD into tile and unit panels 2026-09-19 19:45:49 +02:00
adrien b514a19ecc Added a tilted orthographic camera looking north 2026-09-19 19:37:17 +02:00
adrien 08f1b2d154 Added textured terrain, procedural water and a blurred fog of war 2026-09-19 17:16:41 +02:00
adrien 3b4e19b451 Added a WebGL map renderer with a DOM fallback 2026-09-19 10:34:04 +02:00
adrien aa2a8f6e69 Reworked the tile panel header and collapsed the GDP/capita modifiers 2026-09-19 00:43:32 +02:00
adrien 8a7db56b59 Added the approval summary and fixed the panel layout and propaganda curve
- the nation summary shows own-government approval, white in the neutral 40-60% band, red below and green above
- the city and government panels keep a fixed size per tab, dock below the summary and no longer cover it, and their tab bar wraps instead of being clipped
- propaganda campaigns grow exponentially harder near their opinion ceiling or floor, so the last percent are the hardest to win
- memoised city, nation and matrix approval against the politics version, invalidated by territory redraws, so snapshots stop recomputing it every frame
- extracted the duplicated modal tab wiring into modals/tabs.js
- tests: campaign-difficulty, approval-colour and cache-invalidation cases (513 pass)
2026-09-19 00:36:06 +02:00
adrien 256b4d3468 Added politics: opinions, ethnicities, propaganda and minority policies 2026-09-19 00:17:29 +02:00
adrien cf75b31e68 Fixed air strikes against garrisons and the round-trip fuel model
- a strike is accepted only when the whole round trip (out to the target, then
  home to a friendly airport) fits the remaining fuel, and the browser mirrors
  the check so an unreachable target is refused with its distance and the
  plane's effective range
- a bomber that bombs between hourly ticks turns for home at once instead of
  idling and crashing on an empty tank; a plane with a runway lands on fumes
- aircraft may now target a garrison inside a hostile city: they bomb it and
  turn away, and captures skip aircraft so the city is never taken
- bomber/jet endurance and mission-range tuning
2026-09-18 22:46:19 +02:00
adrien 1a9d48cdc9 Added aircraft sorties, artillery bombardment and local testing mode
- aircraft attack orders fly a sortie to the target, bomb once, return to a
  friendly airport and re-arm (two-day cooldown, charged per aircraft); rebasing
  is bounded by fuel rather than the 10-tile combat radius
- artillery and warships open a sustained hourly bombardment on a standing
  target, drawn as a red dashed line and ring while either endpoint is selected
- a game launched from localhost can enable a testing mode whose train and build
  rows offer free, instant orders; the server only honours them for a loopback
  admin in a testing game
- an open city panel now unlocks aircraft as soon as an airport finishes
2026-09-18 21:55:30 +02:00
adrien 7ed6fe065f Sped up the test suite with a parallel runner and a world cache
- run_tests.js discovers and runs each *_test.js in its own worker process
  (--jobs N to cap the pool, --file <name> for a single suite)
- GameState caches the deterministic terrain, city sites and road network by
  (seed, mapConfig, civ count), rebuilding only the mutable per-game state
- the snapshot ships mapConfig and the client rebuilds terrain from it, so the
  DOM tests can use the small map fixture and a non-default config renders right
- shortestPaths can stop once every target city is settled
2026-09-18 21:25:02 +02:00
adrien 825cff7fa5 Fixed city unit training display 2026-09-18 20:47:32 +02:00
adrien d8928e1220 Added ranged attacks and fixed right-clicking unit icons 2026-09-18 20:33:48 +02:00
adrien 2377489d4a Added building icons, ports, airports, shipyards and air/naval units 2026-09-18 20:00:09 +02:00
adrien c28b2be9a0 Unified city production queue and one city panel with a regional budget 2026-09-18 19:16:09 +02:00
adrien 3acd2487df Added roads, regional taxation and a reworked budget view
Roads are pre-generated between cities with a greedy geometric spanner and flatten unit movement cost. City improvements now only affect the tiles their region controls, with per-region tax collection and a Cities tab. The budget is a grouped, scrollable table with 25%/year tax and a 10%-of-GDP opening treasury. Also merged the tile info into the city panel, kept conflict and budget expansion state across snapshots, added join notifications, filled border corners, drew battle sides as stacks and made tab overflow scroll.
2026-09-18 07:11:59 +02:00
adrien da1d443807 Improved tile information, optimized stack pathfinding 2026-09-18 05:56:54 +02:00
adrien b9527e004b Reworked building costs 2026-09-17 22:48:16 +02:00
adrien 168c365b87 Refactoring and clean-up 2026-09-17 22:35:42 +02:00
adrien 6a4ce1ca5f Split shared data, game state and UI into modules 2026-09-17 22:05:53 +02:00
adrien 4e2eae3306 Better map generation 2026-09-17 22:01:30 +02:00
adrien b08074a2f3 Visual improvements 2026-09-17 00:56:59 +02:00
adrien bc727c408f Visual improvements 2026-09-17 00:28:17 +02:00
adrien dd75a545e4 Added missing icons 2026-09-16 22:42:28 +02:00
adrien 06df4be96f Artillery + encirclement + budget 2026-09-16 22:41:57 +02:00
adrien 0b8c5bee68 Switched to HTML5 2026-09-16 19:59:18 +02:00