This commit introduces detailed documentation for modifying the Fantasy Map Generator's population system to create more realistic settlement sizes suitable for medieval fantasy settings.
Key features of the documentation:
- Complete analysis of current population calculation system in burgs-and-states.js
- Detailed code modifications to reduce city populations from ~250k to ~30k
- Hierarchical scaling that maintains realistic population gradients
- Military impact analysis showing proportional army size reductions
- Step-by-step implementation guide with exact line numbers
- Testing procedures and validation methods
- Troubleshooting section for common issues
- Rollback instructions for safe implementation
The proposed changes will create settlement populations of:
- Capitals: 25-35k (down from 200-300k)
- Large ports: 20-30k (down from 150-250k)
- Regional centers: 10-20k (down from 100-150k)
- Towns: 2-8k (down from 20-50k)
- Villages: 0.5-3k (down from 1-5k)
Military forces will scale proportionally, creating more historically accurate medieval army sizes where capitals field 60-120 troops instead of 500-1000.
The documentation preserves all existing functionality while providing a complete reference for population system modifications.
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
- Added X_World and Y_World columns in meters to CSV export
- Enhanced distance unit conversion with support for multiple units (km, m, mi, yd, ft, leagues)
- Renamed existing X,Y columns to X_Pixel, Y_Pixel for clarity
- World coordinates account for proper Y-axis orientation (negative for downward direction)
- Maintains backward compatibility with existing latitude/longitude columns
- Implement proper coordinate transformation from pixels to world meters
- Add comprehensive metadata to all GeoJSON exports including map settings, scale, and units
- Support multiple distance units (km, miles, yards, feet, leagues, meters)
- Calculate bounds in meters for proper geospatial reference
- Include CRS information as Fantasy Map Cartesian system
- Fix marker notes export to correctly reference note IDs
- Improve coordinate precision and consistency across all export types
The id field for geojson export was not consistent with csv exports.
Removes the prefix on routes, rivers and markers geojson, and on
markers csv, to make them all use only an integer as id.
This makes it easier to import and do joins in other software.