Terrain Layout Script Location?

Does anyone know where the “terrain_layout_script” .lua files for either the pre-made generated random maps or mods downloaded from the in-game workshop are located? I’ve managed to find the “map_gen_layout” .xml file by searching for the map’s name (e.g. dry_arabia) and in each of these .xml files, it lists a “terrain_layout_script” reference (e.g. skirmish_maps\dry_arabia). However, when I search “dry_arabia” in the AoE4 folder, I only get the aforementioned .xml file.

Likewise, when I checked my mods folder (not the one in the main AoE4 steam folder), I only see a .sga file. I obviously can check the files of the mods I created in the AoE4 Content Editor in the location I saved them, but I haven’t managed to find any other .lua scripts.

I just want to look at the “terrain_layout_script” .lua files of the pre-made random maps so I have a better idea of how Relic coded them and how I can apply that knowledge to custom generated maps.

Hi,

There are few ways to accomplish what you are looking for:

  1. Through the editor you can open the archive and be able to open all the .lua files used to create the generated maps.
    So if you create a new Generated Map mod from the Tools wizard, then do File → Open and go to your Steam folders \Steam\steamapps\common\Age of Empires IV\cardinal\archives then select the Data sga file to open it.
    You can navigate to scar\terrainlayout\skirmish_maps\ and open the .lua file you want or go to ugc folder and find that ugc_sample_1.lua.

  2. You can create a new generated map and select the advanced mode which will give you a lua file with lots of comments to understand how to make a map and modify that one.

  3. Also, you can take a look at our documentation that gives detail of how we are making the content.
    https://support.ageofempires.com/hc/en-us/sections/4409136290324-Generated-Maps

Hope this helps,
Seabass

2 Likes

Thank you! This is exactly what I was looking for! Thanks for the quick response.

Alternatively there is a new mapping series on Youtube featuring the topic of map generation! Any1 Can Map - Even you can make a generated map in Age of Empires IV! - YouTube

2 Likes

I have found those tutorial videos helpful, too! Thanks for your hard work. :slight_smile: