jeheydorn / nortantis

Nortantis is a fantasy map generator. It uses a simple tectonic plate simulation to create islands and continents with trees, rivers, and mountains. The result has the appearance of an old-fashioned hand-drawn map.
GNU Affero General Public License v3.0
78 stars 23 forks source link

Feature Request - Regional Maps #28

Open n8atnite opened 2 months ago

n8atnite commented 2 months ago

Currently, I maintain multiple copies of a map, each with different levels of detail. I then crop the high-detail copies to the bounds of each region. However, I lose the border detail from the full-scale map.

Proposal for a feature to take a region of a map and create a new map, i.e.:

  1. Select an area from a map by drawing a bounding box around a region of the map (like Snipping Tool in Windows)
  2. Create a new "regional map" from the selection
  3. Preserve previous geography, political regions, icons, and text from the selection

This would help greatly in tabletop games in which, as a GM, I want to provide regional maps for players without revealing a whole continent or providing players with different levels of detail based on story context.

Thanks for continuing to update this project! I just started using Nortantis and it is already shaping up to be the most user-friendly mapping tool I have tried to date.

jeheydorn commented 2 months ago

This is a feature I've been considering creating for a while now, so I'm glad to see I'm not the only one who would use it. I should give a disclaimer though by saying that it's not the highest on my priority list, so it might be a while before I get to it. But I would like to run some ideas past you.

I originally thought it would be nice to have some kind of sub map tool that allows you to select a zoomed in area and only renders that part of the region, but like you said, the main use case for creating region maps from another map would be to add more detail into the new region map (and make map borders easier to manage), so I agree that it makes sense to have the new region map be a separate map (a new nort file) so you can freely add more detail to it without affecting the main map.

The big question then, in my opinion, is how to enable the new map for more detail and still preserve the coastline shape and region boundary shape of the old map. Nortantis uses a polygon grid to draw on, and region boundaries and coastlines follow the edges of those polygons. The question then is what polygon grid should the region map use. Options:

1) The same polygon grid as the original map, just zoomed in. This would be the only way to get exactly the same coastlines and boundaries unless I think of something creative. But it also means the polygons on the region map would be huge in the region map because they're zoomed in. That would mean that on the region map you have very little control over the shape of coastlines and region boundaries, and the Icons tool would place mountains, hills, and dunes far apart when adding new icons.

2) Use a new polygon grid that has approximately the same shape. As much as this sounds appealing though because it would be easy to develop, I'm guessing that realistically the region map wouldn't be close enough to the original shape to be acceptable. But maybe it's worth a try.

3) Subdivide polygons in the original grid to make smaller polygons in the region map. By this, I mean split each polygon into 2, 4, 8, or 16 polygons. Although this would not give exactly the same region boundary and coastline shape as the original map because edges between polygons are drawn using curves or noisy edges, but it might be closer than using a new grid.

Similarly, for mountains, hills, trees, and dunes, I'm thinking the region map creator would need to split them down into many smaller icons. The way I would do that would depend on the option chosen above.

I would want to preserve text, like you said, although it would be the same font size as the original map (although I would scale it some depending on the world size of the region map), meaning it is relatively smaller on the region map. I would remove text it would be at least part way off the edge on the region map.

I realize this is a lot of information, and I don't mean to make you feel like you have to make a decision here. I'm mostly just brainstorming. I'll probably need to try a few things and see how they work before I make this decision, and there's probably more details to consider that I haven't thought of yet.

n8atnite commented 2 months ago

My thoughts on the polygon grid problem:

  1. This is a good placeholder option for development while implementing other components of the feature, such as area selection and creating the new .nort file.
  2. Use the original polygon grid as a mask over the new grid, then assign land/water values to each cell of the new grid by some simple metric like: new cell value = argmax(mask coverage of new cell). This would allow you to generate a new grid and not worry about the shape of the old one. If you aren't satisfied with the look of the new map, you could just replace the grid cell assignment metric with something more sophisticated (like edge smoothing/anti-aliasing).
  3. Subdividing the original grid would provide the most accurate representation of the previous land mass, but would still require some algorithm to add additional detail within the subdivided cells. That algorithm is not obvious to me and sounds nontrivial, likely involving curve estimation and tracking neighboring cell values for each cell in the grid.

I'm not familiar with your grid algorithm so I don't know which would be more effective to implement. Option 2 would be my first choice personally.

As for text, I assume that if you scale the new map's resolution proportionally to the text font(s), then the new map's text can stay the same size and still look fine.

jeheydorn commented 2 months ago

I like your idea of using option 2 as a placeholder for now, although I don't want to actually release the feature until it works well, as releasing an experimental version could lead to people emailing me with questions about why it doesn't seem to work. (99.9% of the dev on this project is just me, and it doesn't make money, so I have limited time.)