Medieval Engineers

Medieval Engineers

Not enough ratings
Porting a real life terrain into ME
By SicH
This guide is dedicated to real life terrain height map import. It allows to replicate any RL terrain in ME
   
Award
Favorite
Favorited
Unfavorite
1.1. Introduction
Mapping in ME seems to be the less complicated kind of modding, since it doesn't require tons of XML editing. However, making a proper map is really complicated - you need to edit literally everything from height map to where to place a forest. In this guide a process of simple map creation is described.

Requirements:
1. Image editing software (GIMP is used here). Skills in image editing would be nice too.
2. Example archive: https://drive.google.com/file/d/1OTml9-Sa8oay181NaJU6zJ4gjf2xsFWf/view?usp=sharing.
2.1. Some geometry
First of all, let's figure out how a map in ME works. Basically, map is just 12 images with 2048 x 2048 resolution. You could choose a 4192x4192 (automatically upscaled to 8k), or 8192x8192 for better resolution. First 6 contains height data, second 6 contains voxel data (biome data). Every "kingdom" has 2 pictures - heighmap and voxel data. By having these, game is able to generate a planet procedurally. You don't have to manually place every single tree.

Every ME planed has fixed radius defined in scenario .sbx file. To avoid serious XML business, it's better to just modify a vanilla one for now. Proceed to following file in your game folder:

Find two "Radius" lines

By editing it, you may vary any new created "Empty Planet" radius. Note that previously created planets radius will not change due to it. Your save files are safe from being modified that way.

If you want to have a 1:1 RL map in ME, you need to perform some calculations first. A single square equator kingdom is located in following sector:


You need to match this sector size with RL area size: kingdom width = 2 * pi * radius / 4.
If you know a RL area size, and you want to make a 1:1 ME replication, then you need to figure out a required ME planet radius: radius = 4 * kingdom width / (2 * pi)
2.2. Baking a heightmap
There is great site for baking a height map. It was designed for Cities:Skylines, but it works with ME too. Link to site: https://heightmap.skydark.pl/beta/

It doesn't work properly in some browsers (at least in Firefox). However, built-in Edge is able to open it properly.

Proceed to designated area and click on it. A grid will appear there. Click on "i" icon at left bar to open a height map baking settings:

  • Map size - width of square
  • Base level - where is "sea level" located. Click on calculator icon to calculate it for current terrain. Otherwise mountain rivers could not appear.
  • Height scale - 100% is 1:1 terrain copy. It's better to decrease this value for mountain terrain.
  • Water depth - a water area depth. 30 m is enough for most of the rivers.
  • Center of gravity - to fix a mountain rivers height difference. If your area is coastal one, then leave it "none". However, if your area is mountain terrain, pick a direction with highest river altitude. It will help to level a river.
  • Streams - leave checked for small rivers to appear

There are no universal setting or settings presets to bake every area correctly. Every area requires it's own settings. Anyway, let's start with first iteration of height map. Press a "Download PNG map" at toolbar. After it, change a layer to satellite one and press "Download image". Repeat it for "dark" layer too.

Create a similar folder with all baked files inside it:


Open a height map image using GIMP and scale it to 2048x2048 manually. Don't forget to export it as PNG file after it:


Then place an example map from .zip file to Mods folder in AppData. Open following subfolder:


There are "kingdom height and biomes" data. Only one kingdom is modified - "front". Other 5 kingdoms are just ocean. Replcae "front.png" by your scaled file and name it same.

After game launch, create a new world based on "Empty Planet" scenario. And add following mods before starting it:


Start a new world. After first load, a 'M' map may not update. Force it to do it by going to Shift-F12 -> Medieval -> Redraw Map. Proceed to appeared area and check if the height map was loaded correctly. It will look like:


Congratulations, you successfully imported a RL area to ME.
2.3. Biomes
Height is good, but what about trees and plains? Well, you may modify a "front_mat.png". Basically, every voxel is correspond to it's own color in this file. You may use this map as palette:
https://steamproxy.com/sharedfiles/filedetails/?id=2796090524



Open a GIMP and create a new 2048 x 2048 file. Drag'n'drop there "front_mat.png", and create extra layers for better biome management:

Use "dissovle" only! Otherwise some pixels may change alpha channel, leading to biome processing errors like sudden snow dots at beach, and such.

Biome placement is hardest part. Dark imagery helps to "fuzzy select" a water area and fill it by "ocean floor biome". Satellite imagery is big help in foliage placement - where to place plains, grasslands, and so on. Final "front_map" will look like:


If you are modifying not example map but another one, you may face a biome height transition issues. It's not seems like yellow steppe, right?

To avoid it, you need to modify all <MaterialGroup... in mod EarthSecond.sbc. There are transitions from grass terrain to stone slope. Transition conditions are <Slope Min=x degrees Max=y degrees /> and <Height Min=x (not meters!) Max=y />. Delete all transitions <Rule> and save only required <Rule>, such as forest, grass, and so on. Don't forget to edit following line to overwrite vanilla biomes in your map: replace <Definition xsi:type="PlanetGeneratorDefinition"> with <Definition xsi:type="PlanetGeneratorDefinition" Merge="Overwrite">.
Looks better now, isn't it?
(work in progress)
1 Comments
craigroaring 24 Jul, 2024 @ 10:31pm 
This is great!