Keen:Planet Modding/In-game map

From Medieval Engineers Wiki
Jump to navigation Jump to search



Version: 0.4

In-game map modding

Maps in Medieval Engineers are generated based on terrain and buildings on it. This means that they will work for any modded planet in their default form. That being said, the way map is generated is also fully moddable.

We definitions for map are located in Content\Data\Screens\MapDefinition.sbc. To mod maps you will have to alter/add definitions in this file, all vanilla textures for maps can be found in Content\Textures\GUI\Map. Feel free to use/alter any of them for creation of mods for Medieval Engineers. Map content modding (Friend/foe display, tax notifications,... In Medieval Engineers there are 2 view modes of map. Kingdom view which is showing entire kingdom and region view which is zoomed part of a kingdom map. Region is 1kmx1km large on 10 km diameter planet. Both views display different elements. What is shown in these views depends on what layers it contains

<Definition xsi:type="MyObjectBuilder_PlanetMapDefinition">
  <Id Type="MyObjectBuilder_PlanetMapDefinition" Subtype="Main"/>
  <BackgroundGenerator Type="MyObjectBuilder_MedievalMapBackgroundDefinition"        Subtype="FundinhoDoMapinha"/>
  <RegionView>
    <Layers>...</Layers>
  </RegionView>
  <KingdomView>
    <Layers>...</Layers>
  </KingdomView>
</Definition>

BackgroundGenerator refers to a definition of background texture that serves as a background on top of which all the map elements are placed.

  <RegionView>
    <Layers>...</Layers>
  </RegionView>

The three dots in middle represent layers of elements that show in region view. List and description of all layers is in next section of this document.

  <KingdomView>
    <Layers>...</Layers>
  </KingdomView>

The three dots in middle represent layers of elements that show in kingdom view. List and description of all layers is in next section of this document. (I did not Kingdom view in its expanded form because it would take up too much space.)


Layers description

<Layer xsi:type="MyObjectBuilder_MapBackgroundLayer" /><!-- This layer draws the background. As generated based on chosen background definition. -->
<Layer xsi:type="MyObjectBuilder_AreaDevelopmentLayer"><!-- This layer displays icons based on amount of blocks there is in an area. You can set the block thresholds, or mod the textures. It is also possible to add more thresholds. 80x80 px, png. -->
  <Threshold BlockCount="10" Sprite="Textures\GUI\Map\SmallGrid.png"/>
  <Threshold BlockCount="30" Sprite="Textures\GUI\Map\MediumGrid.png"/>
  <Threshold BlockCount="60" Sprite="Textures\GUI\Map\LargeGrid.png"/>
</Layer>

Smallest Settlement.png Medium Settlement.png LargestSettlement.png

<Layer xsi:type="MyObjectBuilder_RegionFastTravelLayer" Name="FastTravel" Visible="false"><!-- This layer shows fast travel overlay for region, when fast travel button is pressed. You can define which colors are used for displaying accessibility. -->
  <UnreachableColor R="255" G="255" B="255" A="128"/>
  <ReachableColor R="100" G="255" B="100" A="0"/>
  <BlockedByTerrainColor R="0" G="0" B="0" A="224"/>
  <BlockedByPlayerColor R="240" G="192" B="0" A="128"/>
</Layer>
<Layer xsi:type="MyObjectBuilder_AreaOwnershipLayer"><!-- This layer defines color overlay over map areas based on ownership. You can mod which color is used for allies, your own areas or for enemies -->
   <AlliedBgColor Hex="#806464FF" />
   <PlayerBgColor Hex="#8064FF64" />
   <EnemyBgColor Hex="#80DC6415" />
</Layer>
<Layer xsi:type="MyObjectBuilder_AreaUpkeepLayer"><!-- This layer displays tax icon on areas that belong to you and require tax payment soon. Texture is 80x80 pixels, png. -->
    <TaxIcon>Textures\GUI\Map\TaxIcon.png</TaxIcon>
</Layer>

Taxes.png

<Layer xsi:type="MyObjectBuilder_PlanetMapPositionLayer"><!-- PlanetMapPositionLayer displays player icon above area where they are. -->
    <LocalPlayerImage>Textures\GUI\Map\PlayerPosition.png</LocalPlayerImage>
    <OtherPlayersImage>Textures\GUI\Map\AllyPosition.png</OtherPlayersImage>
</Layer>

Ally.png Player.png

<Layer xsi:type="MyObjectBuilder_ActionTrackingLayer"><!-- Shows icon over an area on map with fighting / destruction. -->
     <ActionImage>Textures\GUI\Map\Action.png</ActionImage>
</Layer>

AttackedArea.png

<Layer xsi:type="MyObjectBuilder_CurrentMapSelectionLayer"><!-- This is highlight of a region, that player selected with his mouse. -->
     <SelectionImage>Textures\GUI\Map\MapSelection.dds</SelectionImage>
</Layer>
<Layer xsi:type="MyObjectBuilder_PlanetMapGridLayer"><!-- This layer sets which color is the grid drawn. -->
      <GridColor R="0" G="0" B="0" A="228"/>
</Layer>
<Layer xsi:type="MyObjectBuilder_KingdomFastTravelLayer" Name="FastTravel" Visible="false"><!-- This layer shows fast travel overlay for kingdom, when fast travel button is pressed. You can define which colors are used for displaying accessibility. -->
          <UnreachableColor R="255" G="255" B="255" A="128"/>
          <ReachableColor R="100" G="255" B="100" A="0"/>
          <BlockedByTerrainColor R="0" G="0" B="0" A="224"/>
          <BlockedByPlayerColor R="240" G="192" B="0" A="128"/>
</Layer>
<Layer xsi:type="MyObjectBuilder_RegionOwnershipLayer"><!-- RegionOwnershipLayer generates textures used to express ownership on regional map. -->
  <PlayerIcon>Textures\GUI\Map\PlayerLandIcon.png</PlayerIcon>
  <AllyIcon>Textures\GUI\Map\AllyLandIcon.png</AllyIcon>
  <EnemyIcon>Textures\GUI\Map\EnemyLandIcon.png</EnemyIcon>
  <PlayerAllyIcon>Textures\GUI\Map\PlayerAllyLandIcon.png</PlayerAllyIcon>
  <PlayerEnemyIcon>Textures\GUI\Map\PlayerEnemyLandIcon.png</PlayerEnemyIcon>
  <AllyEnemyIcon>Textures\GUI\Map\AllyEnemyLandIcon.png</AllyEnemyIcon>
<PlayerAllyEnemyIcon>Textures\GUI\Map\PlayerAllyEnemyLandIcon.png</PlayerAllyEnemyIcon>
</Layer>


Background generator (trees, mountains, roads,...)

Map background is where all the trees, mountains, hills are drawn. It is also capable of coloring map based on what is in planet’s material map (this is how we make roads for example). All settings for map background are in MedievalMapBackgroundDefinition. The definition also in Content\Data\Screens\MapDefinition.sbc. I will go through various parts of the definition.

<Id Type="MyObjectBuilder_MedievalMapBackgroundDefinition" Subtype="FundinhoDoMapinha"/>
Type of the definition says that this map background definition. Subtype is name of this specific background definition. If create your own background with unique subtype
Make sure you create your own background with unique subtype


<DrawHeightmap>false</DrawHeightmap>
When set on “true” planet’s heightmap is drawn under the map.
<Resolution>4096</Resolution><
Sets resolution of the generated in-game map. 

    <Features>
      <Feature Material="67">
        <Color R="75" G="30" B="0" A="255"/>
      </Feature>
      <Feature Biome="60">
        <Color R="130" G="100" B="42" A="80"/>
      </Feature>
    </Features>

    <SpriteSheet Texture="Textures\GUI\Map\BackgroundSprites.png" BaseSize="64">
      <SpriteCount>100</SpriteCount>
      <Sprite Name="HillSmall" X="768" Y="192" Width="127" Height="64" />
      <Sprite Name="ForestSparse" X="0" Y="320" Width="64" Height="64" />

      <HeightSprite AltitudeDiff=".09" Altitude=".20" Priority="1">
        <Sprite>HillSmall</Sprite>
      </HeightSprite>
      <BiomeSprite Biome="60" Density=".1" Priority="6">
        <Sprite>ForestSparse</Sprite>
      </BiomeSprite>
    </SpriteSheet>
</Definition>


Map Coloring

You can use colors in material or biome map of a planet to appear on the game map. (roads for example). You define map coloring in a node called ”Features”. The coloring uses colors from planet material texture. You can learn more about material texture in biomes modding and surface material modding.

    <Feature Material="67">
      <Color R="75" G="30" B="0" A="255"/>
    </Feature>

This specific feature is used for painting roads on map with dark brown color. In Color you define which color will be the in-game map colored. Material=”67” decides where will be the color applied and refers to a red channel value on planet material texture.

    <Feature Biome="60">
      <Color R="130" G="100" B="42" A="80"/>
    </Feature>

This specific feature is used for painting forests on map with opaque brown. In Color you define which color will be the in-game map colored. Biome=”60” decides where will be the color applied and refers to a green channel value on planet material texture.


Sprites

Medieval Engineers map can also place sprites on map based on terrain shape. All the sprites are on one texture

<SpriteSheet Texture="Textures\GUI\Map\BackgroundSprites.png" BaseSize="64">
      <SpriteCount>100</SpriteCount>
      <Sprite Name="HillSmall" X="768" Y="192" Width="127" Height="64" />
      <Sprite Name="ForestSparse" X="0" Y="320" Width="64" Height="64" />

      <HeightSprite AltitudeDiff=".09" Altitude=".20" Priority="1">
        <Sprite>HillSmall</Sprite>
      </HeightSprite>
      <BiomeSprite Biome="60" Density=".1" Priority="6">
        <Sprite>ForestSparse</Sprite>
      </BiomeSprite>
</SpriteSheet>

AtlasCoordinateUsage.png

Note: Illustrates how sprite is defined on our spritesheet. Example sprite: <Sprite Name="HillSmall" X="768" Y="192" Width="127" Height="64" />


View the full Planet Modding Guide