Map script based on tectonics lines

frutiemax

Warlord
Joined
Jan 19, 2015
Messages
118
I've made a map script that is based on tectonics lines, here is the algorithm:
  1. Put random tectonic lines on the map
  2. Put random volcanoes on the map (to-do)
  3. Iterate through X iterations and raise the land using averaging of sibling plots
  4. Iterate through Y iterations and lower the land using averaging of sibling plots
The resources, player placement and other stuff is the same as the fractal map.

Right now, I've put some random variables to test the valid range of the parameters. It can create huge mountains lines or islands. I have yet to do the step 2 i.e. add some random volcanoes on the map. I have some questions:
  • How do you add configurable parameters to the map?
  • What options should I create? I'm thinking about a map type option i.e. pangea, islands, continents etc.

upload_2021-7-1_17-44-2.png


upload_2021-7-1_17-44-29.png


upload_2021-7-1_17-44-55.png


upload_2021-7-1_17-51-9.png
 
How do you add configurable parameters to the map?
Generally you need to add an xml file to specify what options your map script supports.

It will need to look something like this:
Code:
<GameInfo>
  <Maps>
    <Row File="YourMapScript.lua" Name="Your Map Script" Description="It's your map script!" SortIndex="42"/>
  </Maps>
  <Parameters>
    <Row ParameterId="LandType" Name="Land Type" Description="Not sure if the UI ever renders this description" Domain="LandTypeDomain" ConfigurationId="landType" DefaultValue="2" SortIndex="300" Key1="Map" Key2="YourMapScript.lua" ConfigurationGroup="Map" GroupId="MapOptions" Hash="0"/>
  </Parameters>
  <DomainValues>
    <Row Domain="LandTypeDomain" Value="1" Name="Continents"  Description="Adds continents to the map"  SortIndex="10"/>
    <Row Domain="LandTypeDomain" Value="2" Name="Islands"  Description="Adds islands to the map"  SortIndex="11"/>
  </DomainValues>
</GameInfo>

Quick rundown:
  • The Maps section makes your map script selectable as a map type.
  • The Parameters section defines what options exist for your map type.
  • Each parameter has a ConfigurationId which your script will use to look-up the user's selection for that option. For this example your script would call MapConfiguration.getValue("landType").
  • The DomainValues section associates selectable values with dropdown options via the Domain attribute.
  • The Name and Description attributes can also be references to localization tags in a separate xml file, which is structured as follows
    • Code:
      <GameData><LocalizedText>
        <Row Tag="LOC_NAME_EXAMPLE" Language="en_US">
          <Text>Foobar</Text>
        </Row>
      </LocalizedText></GameData>
What options should I create? I'm thinking about a map type option i.e. pangea, islands, continents etc.
Maybe also add World Age or something to control the number and/or length of tectonic lines.
 
Thanks for the info Scrum Lord.
I just added generating hills on coast lines so now it can generate cliffs.

upload_2021-7-4_19-0-37.png
 
Scrum Lord, how do you add the xml file to the mod?

upload_2021-7-4_19-52-58.png


This doesn't add the parameters to the list, any way to debug this?

EDIT - Ok, no need to use the AddMap action, just use the UpdateDatabase action with the xml file.

EDIT2 - Now it complains it cannot find my lua script...
 
Last edited:
Scrum Lord, how do you add the xml file to the mod?
You can just directly edit your .modinfo file to include the new xml file, like this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="your-mod-steam-uuid" version="42.0">
    <Properties>
        ...
    </Properties>
    <Settings>
        <Custom id="YourMod_Config">
            <Items>
                <File>YourMod_Config.xml</File>
            </Items>
        </Custom>
        <LocalizedText id="YourMod_Config_Text">
            <Items>
                <File>YourMod_Text.xml</File>
            </Items>
        </LocalizedText>
    </Settings>
    <Components>
        <ImportFiles id="YourMod_FileImport">
            <Items>
                <File>YourMod.lua</File>
                <File>add-every-lua-file-from-your-mod-to-this-list</File>
                ...
            </Items>
        </ImportFiles>
    </Components>
    <Files>
        <File>YourMod.lua</File>
        <File>YourMod_Config.xml</File>
        <File>YourMod_Text.xml</File>
        <File>GotLakes_AdvancedSetup_Text.xml</File>
        <File>add-every-file-from-your-mod-to-this-list</File>
        ...
  </Files>
</Mod>
 
Just a question/idea: For now it seems, that all tectonic lines generate mountain ranges. Is this true? That would imply, that the continental plates are converging on all tectonic lines, while in reality, some of the plates would be diverging. In game, this could be fixed by adding flat lands, marshes and lakes on the diverging lines.

-edit- This page has some nice simulation for ideas: https://davidson16807.github.io/tectonics.js/
 
Top Bottom