Author Topic: "Hexify" province/country borders in editor?  (Read 253 times)

JDSweetMeat

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
"Hexify" province/country borders in editor?
« on: July 06, 2019, 09:32:35 PM »
The military and economy systems of my current project are based on the hex grid (i.e. each tile in a province can host urban zones, industrial zones, military bases, etc, and military units maneuver on a per-hex basis).

I created a basic in-game editor that allows you to move cells back and forth between provinces, create new provinces, etc. However, recreating or modifying all of the current geodata by hand through the in-game editor would be tedious and annoying. It would be nice if there was an option in the editor to make province and country borders conform to the hex grid. Specific features I'd need are:

1.) Option to make province borders conform to the hex grid on a per-province basis.

2.) Option to make the borders of all provinces in a selected country conform to the hex grid.

3.) Option to make the borders of all provinces of all countries conform to the hex grid.

Thanks!

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4994
    • View Profile
Re: "Hexify" province/country borders in editor?
« Reply #1 on: July 10, 2019, 10:33:44 AM »
Added a new option "Hexify Countries" to Map Editor. This is accesible from the gear icon of Map Editor inspector, next to other options like "Equalize Provinces":


This operation can take some time, depending on the grid size. Using maximum grid dimensions of 2048x1024 took around 5 minutes on the development iMac (i7) I'm using. However this is a one-time operation - once it's finished, you can save the frontiers as usual.

Currently it only works with countries frontiers. Not sure if it's worth to also apply this algorithm to provinces due to their smaller sizes.

Btw, it took a few days to implement this; this is the third iteration/algorithm which seems to be more robust. I'm thinking of releasing 2 or 3 map variations for different grid sizes so you can just pick the geodata files you want/need ;)

JDSweetMeat

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: "Hexify" province/country borders in editor?
« Reply #2 on: July 10, 2019, 09:15:27 PM »
Added a new option "Hexify Countries" to Map Editor. This is accesible from the gear icon of Map Editor inspector, next to other options like "Equalize Provinces":


This operation can take some time, depending on the grid size. Using maximum grid dimensions of 2048x1024 took around 5 minutes on the development iMac (i7) I'm using. However this is a one-time operation - once it's finished, you can save the frontiers as usual.

Currently it only works with countries frontiers. Not sure if it's worth to also apply this algorithm to provinces due to their smaller sizes.

Btw, it took a few days to implement this; this is the third iteration/algorithm which seems to be more robust. I'm thinking of releasing 2 or 3 map variations for different grid sizes so you can just pick the geodata files you want/need ;)

Thanks! You have such amazing support, I've recommended this asset to like, 6 other developers just because you'll get back to us and consider our requests. Continued support is surprisingly rare in Unity assets.

Performance isn't a big issue for hexification, really. I expected it to take a while (especially for larger grids).

As far as hexification (?) of provinces goes, it will be a necessary feature for my game. Size-wise, most provinces are large enough for this to matter because I've merged the existing provinces into larger provinces (for gameplay performance reasons). For example, I've merged France into about 20 large provinces. The UK has been merged into 10 or so, and Ireland has been merged into 4. Germany has been merged into 15 provinces, Poland about 8, etc.

If it's possible to add a province hexification button, that would be useful (though I'm sure I could probably modify the algorithm you use to hexify provinces easily enough if you're too busy).

(Also, off-topic, but I was wondering if you've considered selling more extension assets like flag packs, themed unit packs, or unique geodata files/map textures -- it would probably help fund continued development of the main asset itself because a lot of us would buy these extensions. Just a thought).

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4994
    • View Profile
Re: "Hexify" province/country borders in editor?
« Reply #3 on: July 11, 2019, 11:46:25 AM »
Beta 5 now applies the hexifying algo to provinces as well (if Layers is set to Countries + Provinces).
Here's a demo video: https://youtu.be/mHfLC3EtFWQ
Cheers

JDSweetMeat

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: "Hexify" province/country borders in editor?
« Reply #4 on: July 11, 2019, 11:57:44 AM »
Beta 5 now applies the hexifying algo to provinces as well (if Layers is set to Countries + Provinces).
Here's a demo video: https://youtu.be/mHfLC3EtFWQ
Cheers

Thanks!

Zarkow

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: "Hexify" province/country borders in editor?
« Reply #5 on: July 27, 2019, 06:45:15 AM »
As JDSweetMeat did the work that I am also doing (modifying and merging regions to get them to playable and equal levels through all countries), perhaps one could do it backwards instead:

Hexify all regions against countries, and then in a second pass, hexify the regions to a set size, applying the name of the hex as inherited from the region that mostly covers it -- especially if one set 1 hex - 1 region name (there would be regions that would cover many hex, and in that case all those hex merely have the name of the same region - is merely a string-piece of data, unless one want to link specific data to regions only - and that could be covered as 'this region has these sets of tiles' by the dev instead when needed.