Map modding

本頁面所適用的版本可能已經過時,最後更新於1.4


Surround Map

Surround Mask

The Surround Mask controls how the clouds around the map look. The file that controls this can be found in gfx/map/surround_map/surround_mask.dds.

To make your own Surround Mask you need to open the surround_mask.dds in your favourite graphic editor. For this guide I use Photoshop CC 2018. The surround mask file is half the size of the provinces.bmp file. You can make the mask by guessing where the clouds should be or you can use your provinces.bmp to guide you in this process. For this guide I will use my provinces.bmp so I can make the cloud mask more precise.

Creating the Surround Mask

1. We start by opening the surround_mask.dds file. Fill the entire layer with #000000. The black color is the base color and can be seen as defining the canvas where the clouds can be rendered upon.

Darken Layer

2. Copy the provinces.bmp file and resize it by 50%. Place it at the center of the black layer and make sure the provinces.bmp is in it's own layer. Set the provinces.bmp layer to Darken so you can later in the process use this to paint the contour of the clouds.

3. Create a new layer on top of the black layer and fill it with #FFFF00. This color defines the light clouds on the map. See image Yellow Layer for the expected result.

Yellow Layer

4. Select the Eraser Tool(E), set Mode to Pencil. Opacity at 100% and Hardness at 100%. With the yellow layer selected paint over the map to define where you don't want the clouds to appear. If you do it right the provinces.bmp file should no longer be visible in the view as you most likely dont want clouds over the playable area.

5. Now for the heavy clouds you want to first select the yellow layer. With the yellow layer selected and using the Magic Wand Tool(W) set to tolerance 0 and Anti-alias disabled select the yellow part in the yellow layer. Now go to Select in the menu and look for Modify > Contract. I set the Contract By to 40 pixels but you can experiment with this. This defines the distance between the light cloud layer and the heavy cloud layer. Apply effect at canvas bounds should be left disabled.

6. Without deselecting anything click Create a new layer in the bottom right of the screen. This new layer should be automatically selected. Now you need to fill the selected area within this new layer with the color #FFFFFF. Use Ctrl+D to deselect everything. See image White Layer for the expected result.

White Layer

7. To make the transition from nothing to light clouds and from light clouds to heavy clouds lets start by first selecting the yellow layer. With the layer selected go to Filter in the menu and look for Blur > Gaussian Blur. Set the Radius to 40 px. Do the same for the white layer. See image Gaussian Blur for the expected result.

Gaussian Blur

8. The conclude remove the provinces.bmp layer. Select the black, yellow and white layer and merge the layers. Now save the file and start the game to see the result.

The result is good but some artifacts can be noticed. Such as in the image Square Lines.

Square Lines

This needs to be fixed in the common/defines/graphic/00_graphics.txt. The chapter Cloud Rendering will deal with this.

Cloud Rendering

Surround map

This file is rendered within a defined square. This square also has a central exclusion zone so it is not rendering in the center of the map. The file that controls this square and the exclusion zone can be found in common/defines/graphic/00_graphics.txt. Look for the below code in the file to alter the rendered area of the clouds.

SURROUND_MAP_INNER_RECT = { 2000.0 2760.0 2640.0 3100.0 } #x-start, y-start, x-end, y-end SURROUND_MAP_OUTER_RECT = { -10000.0 -10000.0 20000.0 20000.0 } #x-start, y-start, x-end, y-end

The INNER_RECT defines a square with the set coordinations where no clouds will be rendered. To make it easy you can set this to a very small area at the center of your map to make sure all the clouds are rendered and the rectangle does not interfere with your cloud mask as seen in the image Square Lines.

The OUTER_RECT defines the outer extend of the clouds. I have set this to a ludicrous high number to make sure it always fils the map to the edges.

The coordinates can be looked up when starting the game in -debug_mode via Steam.

Resources

NASA has high quality heightmaps available on their Visible Earth website. Here is a collection of links.