Repo link: https://github.com/Fx-Doo/RandomMapGen
This "map" actually consists of a blank smf/smt for a 8x8 sized map + gadgetry + some texture files
What this gadgetry does is generate the heightmap, place metal spots, add texture and add trees.
Heightmap generation is based on a modified Square-Diamond process, with some added factors: some cells can have higher height changes through the square-diamond process (ie "mountains"), some others will ponderate their and closes cells' weights differently (ie "roads").
Through this process, and after applying a certain symetry (central, vertical, horizontal, diagonals), we obtain a cells[x][z] = height value for every 8x8 worldspace square of the map and apply it via setheightmapfunc.
After that, we prepare a metalspots table (apply symetry to it) and setmetalamount. We also pick an "environment" (arctic, temperate, desert, moon...)
Once the map heights and metal maps are generated and the environment is set, we can move to adding the features: for now it only consists of trees (and the used trees make this version of the map dependant of BA >=10.12)
The last step is applying a texture to all this. It uses a modified version of Zero-K's terraform-related texture shifting tool.
The textures are applied depending on TestMoveOrder results (to fit the kbot/veh/none passability)
All these processes are made random by depending on settings that are set using math.random functions around certain ranges of values.
Because i wanted pleayers to be able to replay a certain rendered map, i added the map options: seed.
Before any math.random function is called, this map option will be checked.
If seed = 0, then seed = math.random(1,10000)
if seed = [1;10000] then seed = seed
That allows the map generating process to be deterministic when the seed is set via mapoptions, and random when not
The symtype map option allows to force a certain type of symetry function. When set to 0, the symetry is randomly picked, when set to 1 - 5, the symetry is respectively: central, vertical, horizontal, topleft diag, topright diag.
When you want to play a game on a map you have already rendered (and know the seed from looking into the infolog), you'll have to make sure both the seed and the symtype that are used are the same, otherwise the result will be different.
(ie: [f=-000001] Random Seed = 4733, Symtype = 1 means i have to set !seed 4733 and !symtype 1 to get the exact same map)
Note that the metal repartition might still change, as metal repartition is dependant on the number of teams involved in the game
dl link; https://springfiles.com/spring/spring-m ... mmapgen8x8
-- Known issues:
- Load Time
- Minimap/texture aren't very beautiful
- Terrain isn't always easy to play around