Azgaar / Fantasy-Map-Generator

Web application generating interactive and highly customizable maps
https://azgaar.github.io/Fantasy-Map-Generator
Other
4.48k stars 636 forks source link

Make water cells consistent in size #1073

Closed pryvyd9 closed 4 months ago

pryvyd9 commented 4 months ago

Problem Water cells' size is inconsistent. When creating a map mod from it the unit locators are too scattered or too dense. As you can see from the generated province/water province maps water has huge cells that I wish I could downsize to regular cell size. I understand that the use case is very specific but it would be nice to have.

зображення зображення зображення

Solution Add generation option "Consistent cells"

DeuzeksMcKinna commented 4 months ago

This ocean cell merging is done to reduce resource consumption. You could export the [grid cells] element and read the vertexes from there as a workaround.

pryvyd9 commented 4 months ago

I currently read cells from cell geojson. Do vertices from grid cells not match those in geojson?

DeuzeksMcKinna commented 4 months ago

I currently read cells from cell geojson. Do vertices from grid cells not match those in geojson?

Ocean cells don't. The GeoJson uses the [Pack Cells] element, as far as I can recall. Hence the merged cells.

pryvyd9 commented 4 months ago

what do p,v,c stand for in vertices? {"i": 90,"p": [819,377],"v": [119,111,30],"c": [363,362,402]},

DeuzeksMcKinna commented 4 months ago

In order: grid.vertices.p: number[][] - vertices coordinates [x, y], integers grid.cells.v: number[][] - indexes of vertices of each cell grid.cells.c: number[][] - indexes of cells adjacent to each cell (neighboring cells)

You can check these at https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Data-model

pryvyd9 commented 4 months ago

Thank you! I'll give it a try.

Azgaar commented 4 months ago

As @DeuzeksMcKinna said, it was done intentionally to save resources. However you can create a fork that wont have it, look at reGraph function in main.js, you can remove the restrictions.

pryvyd9 commented 4 months ago

Removing deep ocean filter worked like a charm. Now my ships will move more or less straight зображення