This thread is an extension of my previous Map Generation thread(Map Generator- Please Critique! - Blueprint Visual Scripting - Unreal Engine Forums.
I wanted to start a new thread to show my updated progress while leaving the earlier thread intact for people to reference.
Overview:
The Map Generator currently procedurally creates a map that factors in landmass creation, elevation generation, climate banding, precipitation regions, and coastal formations. There are currently 9 vegetation types with 3 elevations. All the rendered tiles are Instanced and invisible Collision Volumes are spawned on top of them to handle tile interaction. World Wrap is currently functioning in a basic manner. Everything scales to Map Size in increments of 10 with 10 being the smallest map. The terrain Seeds for the map shown below are completely random.
This baby took 1 minute 49 seconds to generate. At least 50 million iterations. Size 60 = 120x60 (7200 tiles, or 1/3 the size of a gigantic map). This is a pure random biome generation. Everything is seeded, but the seeds are randomly placed. Continents, Pangaea, etc will come in the future.
For reference:
Arctic = Snow
Tundra = Snowy grass
Boreal Forest = Snowy Evergreens
Coniferous Rainforest = Evergreens
Deciduous Forest = The average Green trees(The ones with the shading problems)
Jungle = Bluegreen Palm trees
Grassland = Green with a couple trees
Steppe = The browner grassland with no trees
Desert = The sand colored tiles
Arid Mountain = The red’ish rock mountain
Mountain = Rocky with snowy peak
Arctic Mountain = Completely snow covered with a little rock showing.
Marsh = Teal with ponds
Lake = Deep Blue
Coast = Blue Green
Ocean = Dark Blue
Overview:
Vector Field Generator - First Loop runs X. Second Loop runs Even Offset Y. Third Loop runs Odd Offset Y.
The Vector Field is Indexed as such:
After the Vector Field is generated, it can be Seeded. The Seeds are basically what determines how the map actually looks at the end of all the generation. Landmass shapes, how rocky/flat, how wet/dry, etc.
First, the Vector Field is seeded with Water and Land seeds and the vectors of those Seeds are stored in the Ocean and Earth Vector Arrays.
Second, the Earth Array is seeded with Elevation seeds for Plains, Hills, and Mountains, each of which create an Array.
Third, The Earth Array is seeded with Precipitation seeds for Arid, Semi-Arid, Moderate, and Wet climates, each of which create an Array.
Once all the Seeds are in place, it is time to grow them.
The Generic Biome Locator is the key Function behind growing the seeds. It finds the distance between the nearest seed and the current tile to be generated. Shortest Distance(Dist) gets set.
First, the Water and Land Seeds grow into the Oceans and Landmasses and fill the Sea Level Array.
Second, the 3 Elevation Arrays are run in the Land Array. Each is then compared to the Vector Field to set the proper equivalent Index in the Elevation Array.
Third, each Index in the Land Array is run against the Range Find function to see what Climate Band it is in and the Temperature Array is set accordingly.
Fourth, the 4 Precipitation Arrays are run against the Land Array. Each is then compared to the Vector Field to set the proper equivalent Index in the Precipitation Array.
Finally, the Water Depth Generator sets each Water tile next to Land as Coast, and the rest to Ocean.
By now, the 5 arrays responsible for holding all of the map information have been set. Now we need to actually spawn the map.
As you can see in the overview in the Map Spawner box, there are 3 sets of loops that spawn 3 sets of maps. This is to simulate a seamless world wrap, but will probably change in the future.
For each Index in the Vector Field the equivalent Index in each of the arrays must be referenced.
An Enum for each Array guides the flow to the correct Add Instance node.
The Plains, Hill, and Mountain Instance Spawners each look like:
Tile volumes are also spawned and are used for tile interaction since the instances don’t have individual collision responses(they act as a single entity for collision).
Here is a pic with the tile volumes made visible with a glass material. As you can see, hitting a volume and changing the underlying instance also changed the same Index on the shadow map to the west. All 3 maps had their instances cleared and regenerated with the update, which was basically seamless: