Commit graph

1649 commits

Author SHA1 Message Date
barrulus
fecbae826c Added 100k to 1M cells in options.js and index.html 2025-08-24 14:56:51 +01:00
barrulus
c85db3b3e1 Fix TinyMCE loading to use script element instead of dynamic import
Replace dynamic import() with traditional script loading for TinyMCE editor
to resolve module loading issues. Adds loadScript helper function that
creates script elements and handles onload/onerror events properly.
2025-08-17 19:32:27 +01:00
barrulus
11977a42fc Add world coordinates to regiment exports for GIS integration
Regiment CSV Export Enhancements:
- Add X_World (m) and Y_World (m) columns using meters per pixel conversion
- Include both current and base position world coordinates
- Rename existing coordinate columns to X_Pixel/Y_Pixel for clarity
- Add getMetersPerPixel() helper function supporting km, m, and miles units

GeoJSON Regiment Export:
- Create new saveGeoJsonRegiments() function in export.js
- Export regiments as Point features with Fantasy Map Cartesian coordinates
- Include all military unit data, state information, and position metadata
- Add regiments button to GeoJSON export UI section

This enables direct import of regiment data into QGIS using the custom
Fantasy Map Cartesian CRS with proper world coordinate positioning.
2025-08-17 19:30:25 +01:00
barrulus
83573c8936 Enhance population counting accuracy and add comprehensive geoJSON exports
Population System Fixes:
- Fix province, culture, and religion population calculations to exclude rural population from cells without burgs
- Burgs now represent ALL population for their cells (both urban and rural components)
- Eliminate double-counting where cell populations were incorrectly added to burg populations

Export Enhancements:
- Add complete geoJSON export for burgs with all settlement properties
- Enhance routes geoJSON export to include type and feature metadata
- Add missing length and width properties to rivers geoJSON export
- Fix burg coordinate system to match CSV export format with xWorld/yWorld fields

UI Improvements:
- Add burgs export button to geoJSON export interface
- Fix vite module loading issue by adding type="module" to notes-editor.js script tag

Documentation:
- Create comprehensive QGIS Style Conversion guide with route types, burg features, and relief rendering methods
- Add WKT coordinate reference system definition for Fantasy Map Cartesian CRS
- Include rule-based styling examples and data processing workflows
2025-08-15 19:00:03 +01:00
barrulus
9e8bc6e689 Add procedural directory to gitignore 2025-08-15 14:16:35 +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
8ec53293b7 Fix rural population calculation to only count small burgs
Rural population now correctly counted only from burgs with ≤100 people.
Eliminates double-counting and ensures consistent statistics across
charts and CSV exports.
2025-08-13 23:35:26 +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
334ef2b58b Add comprehensive population scaling documentation
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.
2025-08-13 08:05:19 +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
barrulus
51572e34a8 Add world coordinate export for burgs with improved unit conversion
- 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
2025-08-12 18:30:21 +01:00
barrulus
bcce33e046 Add fantasy world coordinate system to GeoJSON exports
- 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
2025-08-12 12:03:31 +01:00
barrulus
dea7f604f9 Enabled larger maps with more burgs 2025-08-11 18:21:33 +01:00
barrulus
9001091720 separated projects 2025-08-07 06:25:43 -04:00
barrulus
27b616dff7 some tasks 2025-08-06 08:15:18 +01:00
barrulus
7f31969f50 more porting work 2025-08-05 13:12:07 -04:00
barrulus
37391c8e8b massive rework continues 2025-08-04 13:35:23 -04:00
barrulus
d1b07fff01 Significant work done porting to headless engine 2025-08-04 00:01:48 +01:00
Ender-Emp
ab08dc9429
fix regex of 'and' adjectivization rule (#1225) 2025-08-02 13:48:10 +02:00
Azgaar
d06ebe5ac8 fix(v1.108.11): add external icons to export in base64 format 2025-07-18 02:31:10 +02:00
Azgaar
738732364e fix(ui): correct marker note lookup by adding prefix 2025-07-02 00:52:41 +02:00
Azgaar
c26827bfe5 fix(markers-overview): correct note lookup by marker id 2025-07-01 23:16:07 +02:00
Nekomantikku
a3dcc8d2c4
Merge pull request #1212 from Nekomantikku/master
Add shell script to launch local HTTP server and open browser (GNU/Linux)
2025-06-20 00:18:57 +02:00
Azgaar
d9391d6d97
Merge pull request #1211 from Azgaar/ollama
Ollama: local AI text generation
2025-06-14 16:13:59 +02:00
Azgaar
c891689796 feat(ai-generator): update supported AI models list 2025-06-14 15:24:23 +02:00
Azgaar
d96e339043 chore: update version to 1.108.8 2025-06-14 15:20:41 +02:00
Azgaar
bba3587e50 refactor: ollama generation 2025-06-14 15:20:01 +02:00
Krory
fe2fa6d6b8
Ollama integration as a new AI provider (#1208)
* ollama implementation

* ollama implementation

* Update ai-generator.js

* Update README.md

* Create OLLAMAREADME.MD

* Update OLLAMAREADME.MD

* Update notes-editor.js

* Update index.html

* Update OLLAMAREADME.MD

* Update ai-generator.js
2025-06-14 14:03:06 +02:00
Greger
004097ef93
Make id field in exports more consistent. (#1210)
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.
2025-06-11 00:42:31 +02:00
Azgaar
a6f66e9828 fix: grid layer to not be clickable 2025-03-09 13:29:45 +01:00
Ruichka
8131f25456
Allow data URI scheme for custom images (#1196)
* Allow data URL external images

* fix

* removed inconsistency
2025-03-08 14:51:48 +01:00
Azgaar
f859439fc8 refactor: drawReliefIcons, v1.108.4 2025-02-15 18:13:45 +01:00
Azgaar
4dd34e13d1 refactor: drawReliefIcons, v1.108.4 2025-02-15 18:03:54 +01:00
Azgaar
791347b1ee feat: generate less water ice, v1.108.3 2025-02-15 17:45:16 +01:00
Azgaar
12b8b941e3 fix: remove old lake paths on drawFeatures, v1.108.2 2025-02-15 15:09:39 +01:00
Azgaar
d98ef5717e perf: set text-rendering to optimizeSpeed, v1.108.1 2025-02-15 14:43:51 +01:00
Azgaar
764993b680 fix: remove old feature masks, v1.108.0 2025-02-15 13:06:14 +01:00
Azgaar
e39ca793f2 feat: add growthRate to safe file 2025-02-13 02:54:37 +01:00
Azgaar
e526646076 fix: notes editor size to be relative to canvas size 2025-02-10 12:41:14 +01:00
Azgaar
51c47a18d2 fix: external icons - battle screen 2025-02-10 01:39:21 +01:00
Azgaar
01a69fd40b Merge branch 'master' of https://github.com/Azgaar/Fantasy-Map-Generator 2025-02-08 15:13:23 +01:00
Azgaar
22636b1b62 fix: data integrity checks - better Stripping issue detection, v1.107.1 2025-02-08 15:12:57 +01:00
Azgaar
92b0b4d306
Merge pull request #1187 from Azgaar/linked-icons
Custom images for Markers and Regiments
2025-02-08 14:21:44 +01:00
Azgaar
0be14790d2 feat: rerender affected layers on auto-update 2025-02-08 14:15:59 +01:00
Azgaar
33a02aeea0 chore: cleanup 2025-02-08 14:06:33 +01:00
Azgaar
d51deffdac feat: make lined icons work for all elements, v1.107.0 2025-02-08 14:05:28 +01:00
Issac411
7b8ffd025f
custom pictures for regiments (#1183)
* forms and ajustements

* variable size for style as requested
2025-01-19 23:29:27 +01:00
Azgaar
5bb33311fb fix: 1.106.7 - rivers starting width calc 2024-12-17 17:11:13 +01:00
Azgaar
04c6fb3ee7 feat: like temp likeness, 1.106.6 2024-12-17 12:48:41 +01:00
Azgaar
f15bccd610 style: increase dialog buttons size 2024-12-16 14:30:11 +01:00