Commit graph

1217 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
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
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
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
Azgaar
c891689796 feat(ai-generator): update supported AI models list 2025-06-14 15:24:23 +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
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
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
0be14790d2 feat: rerender affected layers on auto-update 2025-02-08 14:15:59 +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
6d4c9f6b18 fix: sumap - clip routes by bbox 2024-12-14 15:12:38 +01:00
Azgaar
ced7b88054 fix: submap - generate in current canvas size 2024-12-13 13:15:01 +01:00
Azgaar
50ee5150c1 fix: #1174 2024-12-13 11:58:53 +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
610a2d9ae6 chore: update supporters 2024-11-28 12:19:05 +01:00
Azgaar
03c7db32ef fix: #1172 2024-11-27 12:21:36 +01:00
Azgaar
fa03b2d705 fix: #1170 2024-11-24 15:02:56 +01:00
Azgaar
8db9dc9bed chore: supporters update 2024-11-15 15:53:41 +01:00
Azgaar
8d621ba9ce
AI Claude support (#1167)
* Add Claude AI support (#1165)

* feat: ai generator - add support for claude

* feat: ai generator - add claude support

* refactor: clean up API calls

---------

Co-authored-by: Azgaar <maxganiev@yandex.com>

* feat: ai - claude support

---------

Co-authored-by: aesli <37640637+aesliva@users.noreply.github.com>
Co-authored-by: Azgaar <azgaar.fmg@yandex.com>
2024-11-14 02:05:34 +01:00
Dyxang
ca8e723006
Temperature parameters can be customized (#1162)
* Temperature parameters can be customized

* fix typo

* update to 1.105.22

* Update index.html
2024-11-07 14:23:38 +01:00
Ángel Montero Lamas
91dc16878e
Stroke dash to cells (#1159)
* style.js sorted items alphabetically

* style.js added strokeDash to "cells"
2024-10-26 14:40:43 +02:00
Azgaar
1706fa0981 fix: add p to priority queue 2024-10-26 14:29:52 +02:00
Ryan D. Guild
d7f5cae229
Removed priority queue in favor of FlatQueue (#1157)
* removed priority queue in favor of simple array extension as it will be easier to migrate to esm

* patch: bump version

* spacing

* moved references to globalThis

* demonstrate module interop

* added version to priority-queue and moved to utils to follow dom loading pattern

* removed PriorityQueue in favor of FlatQueue

* update index.html

* never mind that force push I don't know how to amend commits right

* missing capitalization

* priority set to 0 on 541

---------

Co-authored-by: RyanGuild <ryan.guild@us-ignite.org>
2024-10-26 14:26:59 +02:00
Azgaar
54491cfd09 feat: zones editor - don't close other editors on open 2024-10-22 23:04:57 +02:00
Azgaar
5ac99d180d chore: parse DEBUG setting as an object 2024-10-22 14:45:25 +02:00
Azgaar
6d69eb855f fix: zones editor - legend to be toggable 2024-10-19 14:02:04 +02:00