Commit graph

29 commits

Author SHA1 Message Date
barrulus
c4663e7b9b fix: sky port behavior, default sky altitude, Sky Realm robustness, and unfly state restore
Summary

Ground burgs with sky ports keep land capabilities and land routes.
Only truly flying burgs join the Sky Realm; turning off “flying” restores the ground state.
Replace magic altitude 1000 with a DOM-configurable default.
Guard state hover/pin logic for geometry-less Sky Realm to prevent console errors.
Watabou link uses sky settings only for flying burgs.
Details

Land routing with sky ports:

Change: include sky ports in land road/trail networks; exclude only flying burgs.
Why: sky ports should not impose flying/land restrictions on a ground burg.
File: modules/routes-generator.js
Sky port toggle does not move state:

Change: toggling skyPort no longer assigns the burg’s state to the Sky Realm or reassigns cell ownership.
Why: sky port ≠ flying city; it’s just air connectivity.
File: modules/ui/burg-editor.js
Flying toggle and state restore:

Change: enabling “flying” assigns the burg to the Sky Realm but does not overwrite the cell’s ground state; disabling “flying” restores the burg’s state to the underlying ground state (pack.cells.state[burg.cell]).
Change: when relocating, assign Sky Realm only if the burg is placed over water; ground placements keep ground state.
Why: fixes bug where reverting to ground left burg in Sky Realm and preserves ground sovereignty.
File: modules/ui/burg-editor.js
Default sky altitude via DOM (no more magic 1000):

Change: add hidden input #burgDefaultSkyAltitude (default 1000 m) and read it everywhere altitude is defaulted (editor and “add burg on water” flow).
Why: centralizes default, documents units, and makes it configurable without touching code.
Files: index.html, modules/ui/burg-editor.js, modules/ui/burgs-overview.js
Sky State creation robustness:

Change: initialize a neutral diplomacy row for the new Sky State and extend existing states’ diplomacy arrays.
Change: do not forcibly set the anchor cell ownership to Sky state when creating the Sky Realm.
Why: prevents UI/editor crashes that assume diplomacy is rectangular; avoids accidental land transfer to Sky Realm.
File: modules/ui/editors.js
State hover/pin guards for Sky Realm:

Change: skip fog/hover/highlight when the target state has no geometry (e.g., Sky Realm) or the path is missing.
Why: fixes console errors in State hover and Pin feature.
Files: modules/dynamic/editors/states-editor.js, modules/ui/diplomacy-editor.js, modules/ui/military-overview.js
Watabou integration:

Change: only treat burgs as “sky” for city links when flying is true (not when only skyPort is set).
Why: ground burgs with sky ports should still have gates/roads/hubs/shanty, etc.
File: modules/ui/editors.js
User-visible Effects

Ground cities can have sea port + sky port + roads/trails simultaneously.
Toggling flying on shows altitude row; default altitude is read from the DOM.
Toggling flying off restores the burg to its ground state affiliation.
No more console errors when interacting with state hover/pin around the Sky Realm.
Potential Impacts

Land route generation may produce additional roads because sky-ported (but ground) burgs are now included.
Diplomacy arrays gain a neutral column for the Sky Realm when first created (non-breaking, UI-aligned).
Test Plan

Set sky port on a ground burg: verify roads/trails remain; sea port and other features unaffected.
Toggle flying on: burg state switches to Sky Realm; cell remains with ground state; altitude defaults from #burgDefaultSkyAltitude; air routes generate.
Toggle flying off: burg state returns to the ground state; altitude row hides; routes regenerate.
Hover/fog/pin states with the editors open: no errors with Sky Realm selected or hovered.
Open Watabou (city generator) links:
Ground + sky port: uses ground settings (gates/roads/hubs/shanty allowed).
Flying: uses sky settings (no farms/gates/hub etc. as appropriate).
Files Changed

modules/routes-generator.js
modules/ui/burg-editor.js
modules/ui/burgs-overview.js
modules/ui/editors.js
modules/dynamic/editors/states-editor.js
modules/ui/diplomacy-editor.js
modules/ui/military-overview.js
index.html
2025-09-08 15:09:59 +01:00
barrulus
7292c73d10 routes: fold sky/flying exclusion into guard; ui: remove redundant false arg in createMfcgLink call 2025-09-08 15:06:10 +01:00
barrulus
c075e704fd Sky burgs + air routes: layer, editor toggles, styling, altitude, icons, and generators 2025-09-08 15:05:41 +01:00
barrulus
73ab86b957 sky-burgs-sky-routes 2025-09-05 21:07:42 +01:00
barrulus
21df872ca2 efficiency 2025-09-04 10:13:01 +01:00
barrulus
82eb441845 Implement tiered route system with enhanced CSV export
This commit introduces a comprehensive tiered route generation system that replaces the basic route categories with specific route types based on medieval transportation networks:

Route System Changes:
- Major Sea Routes (majorSea): Long-distance maritime trade routes connecting capitals and major ports across water bodies, simulating Hanseatic League-style trade networks
- Regional Sea Routes (regional): Shorter routes within specific water bodies for high-traffic local maritime trade
- Royal Roads (royal): Capital-to-capital connections for diplomatic and military movement using minimum spanning tree algorithm
- Market Roads (market): Regional trade networks connecting market towns with 15-30km spacing based on medieval market day travel distances
- Local Roads (local): Village-to-market connections linking settlements to their nearest commercial centers
- Footpaths (footpath): Hamlet paths with 3-8km range for local community connections

Implementation Details:
- Removed fallback calls to legacy route generation functions to ensure clean tiered system operation
- Routes now include both 'group' (general category) and 'type' (specific tier) properties for detailed classification
- Enhanced route generation uses settlement hierarchy and geographic constraints for realistic medieval transportation patterns
- Route cost modifiers applied based on route type importance (royal and majorSea routes have priority routing)

CSV Export Enhancements:
- Added 'Type' column to routes CSV export to distinguish between route tiers
- Updated routes overview UI to display both group and type information
- Enhanced header layout to accommodate new type column
- Routes can now be analyzed by both general category and specific function

Technical Changes:
- Fixed route ID assignment conflicts between immediate and background processing phases
- Improved route data structure consistency across generation phases
- Updated routes overview display to show detailed route type information
- Enhanced CSV export function to include route type data from pack.routes
2025-08-14 23:47:14 +01:00
barrulus
e669549390 Fix population aggregation system to eliminate double-counting
- Fixed core issue where cells.pop and burg.population were both being counted
- Changed aggregation logic across all modules to use either burg OR cell population, never both
- If cell has burg: count only burg population (represents all people in that area)
- If cell has no burg: count only cells.pop (represents scattered population)

Files modified:
- modules/burgs-and-states.js: Fixed state population aggregation
- modules/ui/provinces-editor.js: Fixed province population aggregation
- modules/dynamic/editors/cultures-editor.js: Fixed culture population aggregation
- modules/dynamic/editors/religions-editor.js: Fixed religion population aggregation
- modules/ui/biomes-editor.js: Fixed biome population aggregation
- modules/ui/zones-editor.js: Fixed zone population calculations (2 locations)
- modules/military-generator.js: Redesigned military generation to use only burg populations

Military system changes:
- Removed rural military generation (all forces now come from settlements)
- Only burgs with 500+ people can maintain military forces
- Military strength based on actual burg population (2.5% mobilization rate)

Result: Population totals now consistent across all CSV exports (~2M total vs previous 40x discrepancy)
2025-08-13 18:54:32 +01:00
barrulus
9c090894f2 Implement hierarchical burg placement and route generation system
Major Changes:
- Enhanced burg placement system with three-tier hierarchy:
  * Primary centers (capitals + large ports) connected by main roads
  * Regional centers (plaza burgs) connected by secondary roads
  * Local settlements connected by trails to existing network

Burg Placement Improvements (burgs-and-states.js):
- Added identifyLargePorts() function to mark coastal settlements as major population centers
- Implemented placeRegionalCenters() function for strategic plaza burg placement
- Enhanced placeTowns() with hierarchical scoring based on distance to major centers
- Updated population calculations to respect settlement hierarchy
- Modified defineBurgFeatures() to guarantee plazas for regional centers

Route Generation Overhaul (routes-generator.js):
- Created hierarchical route system eliminating overlapping routes:
  * Main roads connect primary population centers (capitals + large ports)
  * Secondary roads connect plaza burgs to main network and each other
  * Trails connect isolated settlements to nearest existing routes
- Added filtered burg categorization to prevent duplicate connections
- Implemented intelligent pathfinding that integrates with existing routes
- Fixed getLength() function with fallback calculation for DOM timing issues

CSV Export Enhancement (routes-overview.js):
- Updated routes CSV export to include new "secondary" route type
- Added documentation for supported route types in export function

Technical Features:
- Distance-based population gradients radiating from major centers
- Urquhart graph algorithm for optimal route networks
- Integration with existing pathfinding cost system
- Proper route merging and connection tracking
- Robust error handling for route length calculations

Result:
- Realistic settlement hierarchy with proper population distribution
- Non-overlapping transportation network with clear purpose for each route type
- Radial patterns from major centers through regional hubs to local settlements
- Enhanced world-building with economically logical settlement placement
2025-08-12 22:44:54 +01:00
Azgaar
66d22f26c0
[Draft] Submap refactoring (#1153)
* refactor: submap - start

* refactor: submap - continue

* Merge branch 'master' of https://github.com/Azgaar/Fantasy-Map-Generator into submap-refactoring

* refactor: submap - relocate burgs

* refactor: submap - restore routes

* refactor: submap - restore lake names

* refactor: submap - UI update

* refactor: submap - restore river and biome data

* refactor: submap - simplify options

* refactor: submap - restore rivers

* refactor: submap - recalculateMapSize

* refactor: submap - add middle points

* refactor: submap - don't add middle points, unified findPath fn

* chore: update version

* feat: submap - relocate out of map regiments

* feat: submap - fix route gen

* feat: submap - allow custom number of cells

* feat: submap - add checkbox submapRescaleBurgStyles

* feat: submap - update version hash

* chore: supporters update

---------

Co-authored-by: Azgaar <azgaar.fmg@yandex.com>
2024-12-12 13:11:54 +01:00
Azgaar
877afa546d fix: remove route if it has <2 points 2024-09-21 13:43:46 +02:00
Azgaar
5904e9e7c6 fix: routes (v1.104.3) 2024-09-20 14:16:07 +02:00
Azgaar
ec993d1a9b fix: #1129 2024-09-12 12:55:31 +02:00
Azgaar
da8c4f1e4a fix: rotues - isCrossroad 2024-08-19 14:09:38 +02:00
Azgaar
9c97711a99 fix: routes id after removing all 2024-08-16 13:15:00 +02:00
Azgaar
f19b891421
Urquhart routes (#1072)
* feat: routes generation

* feat: routes rendering

* feat: searoutes fix, changing reGraph

* feat: searoute - change pathfinding algo

* feat: routes - cleanup code

* feat: routes - change data format

* feat: routes - add routes to json export

* feat: edit routes - start

* feat: edit routes - main

* feat: edit routes - EP

* feat: edit routes - remove route

* feat: route - generate names

* feat: route - continue

* Refactor route merging logic for improved performance

* feat: routes - show name in tooltip

* feat: routes - create route dialog

* feat: update data on control point remove

* feat: routes editor - split route

* feat: add join route functionality to routes editor

* feat: Add join route functionality to routes editor

* feat: Update join route tooltip in routes editor

* feat: routes overview - sort by length

* feat: routes overview - fix distanceScale value

* feat: routes overview - create route

* Refactor getMiddlePoint function to getCloseToEdgePoint

* feat: routes - change data format, fix issues

* feat: routes - regenerateRoutes

* feat: routes - add route on burg creation

* chore - remove merge conflict markers

* chore - remove merge conflict markers

* feat: routes name - no unnamed burg names

* feat: routes - lock routes

* fix: routes - split routes

* feat: routes - tip correction

* feat: routes - auto-update part 1

* feat: routes - return old rePacj logic to not break auto-update

* feat: routes - auto-update - add connections

---------

Co-authored-by: Azgaar <azgaar.fmg@yandex.com>
2024-08-15 15:46:55 +02:00
Azgaar
f2fcef0284 routes - don't break if feature is not found 2022-04-09 21:52:37 +05:00
Azgaar
460bb29e49 replace old iife by a simpler ones 2021-08-04 23:49:02 +03:00
Mészáros Gergely
c11f9cb4ae Modified main road network to handle impassable terrain 2021-07-28 23:54:02 +02:00
Azgaar
af1d369e31 addOverseaRoute 2021-06-13 19:57:00 +03:00
Bryce Kabat
f4efedcf9d
Added Logging Options to Improve Performance (#529)
* Added Logging Options to Improve Performance

* Requested Changes

Co-authored-by: Onyx Azryn <brycekabat@onyxazryn.com>
2020-10-22 01:32:57 +03:00
Evolvedexperiment
044ea1d345 Added cell info to elevation profile and corrected some spelling 2020-06-26 19:08:54 +00:00
Azgaar
617e8d4306 v1.4.09 2020-05-09 23:51:14 +03:00
Azgaar
d1c795494d v1.3.04a 2020-03-28 23:48:56 +03:00
Azgaar
c8f758ab3c v1.3.03a 2020-03-27 17:52:23 +03:00
Azgaar
bc6b8cdafe v1.22.31 2019-12-23 20:06:43 +03:00
Azgaar
aadae58072 1.1.14 2019-10-16 23:25:48 +03:00
Azgaar
cab429a346 v1.0 2019-08-31 12:16:36 +03:00
Azgaar
2d5d008fe8 v 0.8.24b 2019-05-28 21:41:21 +03:00
Azgaar
680044ddd6 v 0.8.0b 2019-04-21 21:55:13 +03:00