Author Topic: Help with procedurally generates maps at runtime  (Read 34 times)

Fabrizio3k

  • Newbie
  • *
  • Posts: 3
    • View Profile
Help with procedurally generates maps at runtime
« on: October 11, 2019, 09:31:03 AM »
Hi all

First of all thank you for the great assets on the store. I did purchase world map strategy kit and grid 2d and I hope they’re enough to achieve what I have in mind.

The question is: what would be the best way to generate random maps at runtime? I mean a different one each playthrough.

I tried getting an instance to worldmapstrategykit and run
wmsk.editor.seed(12);
wmsk.editor.generateMap();
and as suspected,  nothing happened at runtime. I noticed that the maps generated with the internal editor are saved in a folder and loaded before they get to run.

Then I tried generating a Voronoi map with the Grid 2D asset and I’m stuck trying to import it in the latter.

Could you help me a bit more on the subject?

Thank you very much

F


Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4994
    • View Profile
Re: Help with procedurally generates maps at runtime
« Reply #1 on: October 11, 2019, 09:38:43 AM »
Hi,

In the case of WMSK, yes, the random map generator is Editor only. It generates and saves the map to the Resources folder (or whatever folder is configured in the asset as geodata output) so you can further customize it using the Map Editor functionality, etc.

I'd suggest starting from Demo18_RandomMap of Grids2D instead. It uses a voronoi + noise map + color ramp texture to create some islands in playmode.

Regards

Fabrizio3k

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Help with procedurally generates maps at runtime
« Reply #2 on: October 11, 2019, 01:00:27 PM »

Thank you very much for the quick answer. One last question: would it be hard to try to make wmsk and grids interoperate (‘export’ the map you suggested to wmsk, at runtime), or would it require heavy customization of the code?
Just to organize my journey :)

Thank you again

F

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4994
    • View Profile
Re: Help with procedurally generates maps at runtime
« Reply #3 on: October 11, 2019, 03:40:51 PM »
Well, WMSK also provides a grid feature, so you could try on WMSK directly.
1.- Check the "Don't Load Geodata At Start" toggle under Miscellanea section in WMSK inspector.
2.- Set the Earth style to some flat color or your own texture as background.
3.- Check "Show Grid" under Grid Settings to enable Hexagonal Grid.

Check out demo scene 003 Hexagonal Grid under 2D Map Examples.

Fabrizio3k

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Help with procedurally generates maps at runtime
« Reply #4 on: October 12, 2019, 02:08:28 AM »
one last question (I promise!) . you mentioned the demo 18 of Grid2D, but I actually purchased the Grid Terrain System (to my understanding, the Grid2D was a part of the grid terrain system asset). Now, the casual map starting from Vornoi is something I can do myself with a bit of work (it is not in the terrain grid system demo collection), but could you help me understand what is the added value of purchasing grid2d on top of the terrain grid system?

Thank you very much

f.
« Last Edit: October 12, 2019, 02:10:15 AM by Fabrizio3k »

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4994
    • View Profile
Re: Help with procedurally generates maps at runtime
« Reply #5 on: October 13, 2019, 10:49:46 AM »
Probably nothing. Grids 2D is mostly a subset of Terrain Grid System. It might have very small API differences based on what users request, but the core functionality are same. Terrain Grid System obviously adds terrain or mesh capabilities, so you can render the mesh over an irregular terrain or any other mesh (like a sphere or custom scenary made in Blender for example).

So, generally speaking, if you don't need to render the grid over terrain or any other mesh, you can stick with Grids 2D.