Keen:Planet Modding/In-game map: Difference between revisions

From Medieval Engineers Wiki
Jump to navigation Jump to search
m (CptTwinkie moved page Official Content/In-game map modding to Official Content/Planet Modding/In-game map without leaving a redirect)
mNo edit summary
Line 1: Line 1:
{{Version <!-- Do not change the version until the entire page is up-to-date -->
<noinclude>{{Version <!-- Do not change the version until the entire page is up-to-date -->
|release=0|major=4|minor=X|suppress=true}}
|release=0|major=4|minor=X|suppress=true}}
[[Category:Keen_Modding_Guides]]</noinclude>
==In-game map modding==
==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.
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.
Line 35: Line 36:
(I did not Kingdom view in its expanded form because it would take up too much space.)
(I did not Kingdom view in its expanded form because it would take up too much space.)


==Layers description==
===Layers description===
<source lang="xml"><Layer xsi:type="MyObjectBuilder_MapBackgroundLayer" /></source>
<source lang="xml"><Layer xsi:type="MyObjectBuilder_MapBackgroundLayer" /><!-- This layer draws the background. As generated based on chosen background definition. -->
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. -->
<source lang="xml">
<Layer xsi:type="MyObjectBuilder_AreaDevelopmentLayer">
   <Threshold BlockCount="10" Sprite="Textures\GUI\Map\SmallGrid.png"/>
   <Threshold BlockCount="10" Sprite="Textures\GUI\Map\SmallGrid.png"/>
   <Threshold BlockCount="30" Sprite="Textures\GUI\Map\MediumGrid.png"/>
   <Threshold BlockCount="30" Sprite="Textures\GUI\Map\MediumGrid.png"/>
Line 45: Line 44:
</Layer>
</Layer>
</source>
</source>
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.


[[File:Smallest Settlement.png|150px|frameless]]
[[File:Smallest Settlement.png|150px|frameless]]
Line 51: Line 49:
[[File:LargestSettlement.png|150px|frameless]]
[[File:LargestSettlement.png|150px|frameless]]
<source lang="xml">
<source lang="xml">
<Layer xsi:type="MyObjectBuilder_RegionFastTravelLayer" Name="FastTravel" Visible="false">
<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"/>
   <UnreachableColor R="255" G="255" B="255" A="128"/>
   <ReachableColor R="100" G="255" B="100" A="0"/>
   <ReachableColor R="100" G="255" B="100" A="0"/>
Line 57: Line 55:
   <BlockedByPlayerColor R="240" G="192" B="0" A="128"/>
   <BlockedByPlayerColor R="240" G="192" B="0" A="128"/>
</Layer>
</Layer>
</source>
<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 -->
This layer shows fast travel overlay for region, when fast travel button is pressed. You can define which colors are used for displaying accessibility.
<source lang="xml">
<Layer xsi:type="MyObjectBuilder_AreaOwnershipLayer">
   <AlliedBgColor Hex="#806464FF" />
   <AlliedBgColor Hex="#806464FF" />
   <PlayerBgColor Hex="#8064FF64" />
   <PlayerBgColor Hex="#8064FF64" />
   <EnemyBgColor Hex="#80DC6415" />
   <EnemyBgColor Hex="#80DC6415" />
</Layer>
</Layer>
</source>
<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. -->
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
<source lang="xml">
<Layer xsi:type="MyObjectBuilder_AreaUpkeepLayer">
     <TaxIcon>Textures\GUI\Map\TaxIcon.png</TaxIcon>
     <TaxIcon>Textures\GUI\Map\TaxIcon.png</TaxIcon>
</Layer>
</Layer>
</source>
</source>
This layer displays tax icon on areas that belong to you and require tax payment soon. Texture is 80x80 pixels, png.
[[File:Taxes.png|frameless]]
[[File:Taxes.png|frameless]]
<source lang="xml">
<source lang="xml">
<Layer xsi:type="MyObjectBuilder_PlanetMapPositionLayer">
<Layer xsi:type="MyObjectBuilder_PlanetMapPositionLayer"><!-- PlanetMapPositionLayer displays player icon above area where they are. -->
     <LocalPlayerImage>Textures\GUI\Map\PlayerPosition.png</LocalPlayerImage>
     <LocalPlayerImage>Textures\GUI\Map\PlayerPosition.png</LocalPlayerImage>
     <OtherPlayersImage>Textures\GUI\Map\AllyPosition.png</OtherPlayersImage>
     <OtherPlayersImage>Textures\GUI\Map\AllyPosition.png</OtherPlayersImage>
</Layer>
</Layer>
</source>
</source>
PlanetMapPositionLayer displays player icon above area where they are.
[[File:Ally.png|frameless]]
[[File:Ally.png|frameless]]
[[File:Player.png|frameless]]
[[File:Player.png|frameless]]
<source lang="xml">
<source lang="xml">
<Layer xsi:type="MyObjectBuilder_ActionTrackingLayer">
<Layer xsi:type="MyObjectBuilder_ActionTrackingLayer"><!-- Shows icon over an area on map with fighting / destruction. -->
     <ActionImage>Textures\GUI\Map\Action.png</ActionImage>
     <ActionImage>Textures\GUI\Map\Action.png</ActionImage>
</Layer>
</Layer>
</source>
</source>
Shows icon over an area on map with fighting / destruction.
[[File:AttackedArea.png|frameless]]
[[File:AttackedArea.png|frameless]]
<source lang="xml">
<source lang="xml">
<Layer xsi:type="MyObjectBuilder_CurrentMapSelectionLayer">
<Layer xsi:type="MyObjectBuilder_CurrentMapSelectionLayer"><!-- This is highlight of a region, that player selected with his mouse. -->
     <SelectionImage>Textures\GUI\Map\MapSelection.dds</SelectionImage>
     <SelectionImage>Textures\GUI\Map\MapSelection.dds</SelectionImage>
</Layer>
</Layer>
</source>
<Layer xsi:type="MyObjectBuilder_PlanetMapGridLayer"><!-- This layer sets which color is the grid drawn. -->
This is highlight of a region, that player selected with his mouse.
<source lang="xml">
<Layer xsi:type="MyObjectBuilder_PlanetMapGridLayer">
       <GridColor R="0" G="0" B="0" A="228"/>
       <GridColor R="0" G="0" B="0" A="228"/>
</Layer>
</Layer>
</source>
<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. -->
This layer sets which color is the grid drawn.
<source lang="xml">
<Layer xsi:type="MyObjectBuilder_KingdomFastTravelLayer" Name="FastTravel" Visible="false">
           <UnreachableColor R="255" G="255" B="255" A="128"/>
           <UnreachableColor R="255" G="255" B="255" A="128"/>
           <ReachableColor R="100" G="255" B="100" A="0"/>
           <ReachableColor R="100" G="255" B="100" A="0"/>
Line 109: Line 92:
           <BlockedByPlayerColor R="240" G="192" B="0" A="128"/>
           <BlockedByPlayerColor R="240" G="192" B="0" A="128"/>
</Layer>
</Layer>
</source>
<Layer xsi:type="MyObjectBuilder_RegionOwnershipLayer"><!-- RegionOwnershipLayer generates textures used to express ownership on regional map. -->
This layer shows fast travel overlay for kingdom, when fast travel button is pressed. You can define which colors are used for displaying accessibility.
<source lang="xml">
<Layer xsi:type="MyObjectBuilder_RegionOwnershipLayer">
   <PlayerIcon>Textures\GUI\Map\PlayerLandIcon.png</PlayerIcon>
   <PlayerIcon>Textures\GUI\Map\PlayerLandIcon.png</PlayerIcon>
   <AllyIcon>Textures\GUI\Map\AllyLandIcon.png</AllyIcon>
   <AllyIcon>Textures\GUI\Map\AllyLandIcon.png</AllyIcon>
Line 122: Line 102:
</Layer>
</Layer>
</source>
</source>
RegionOwnershipLayer generates textures used to express ownership on regional map.


==Background generator (trees, mountains, roads,...)==
===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).
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.
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.


<source lang="xml"><Id Type="MyObjectBuilder_MedievalMapBackgroundDefinition" Subtype="FundinhoDoMapinha"/></source>
<source lang="xml"><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
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
Make sure you create your own background with unique subtype
Line 137: Line 116:
<Resolution>4096</Resolution><
<Resolution>4096</Resolution><
Sets resolution of the generated in-game map.  
Sets resolution of the generated in-game map.  
<source lang="xml">
 
     <Features>
     <Features>
       <Feature Material="67">
       <Feature Material="67">
Line 161: Line 140:
</Definition>
</Definition>
</source>
</source>
==Map Coloring==
===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.
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.
<source lang="xml">
<source lang="xml">
Line 176: Line 155:
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.
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==
===Sprites===
Medieval Engineers map can also place sprites on map based on terrain shape. All the sprites are on one texture
Medieval Engineers map can also place sprites on map based on terrain shape. All the sprites are on one texture
<source lang="xml">
<source lang="xml">
Line 197: Line 176:
Note: Illustrates how sprite is defined on our spritesheet. Example sprite:
Note: Illustrates how sprite is defined on our spritesheet. Example sprite:
<Sprite Name="HillSmall" X="768" Y="192" Width="127" Height="64" />
<Sprite Name="HillSmall" X="768" Y="192" Width="127" Height="64" />
[[Category:Keen_Modding_Guides]]

Revision as of 19:26, 12 April 2018

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" />