Handmade Maps Update

Discussion in 'Planets & Playfields' started by binhthuy71, Dec 13, 2017.

  1. binhthuy71

    binhthuy71 Rear Admiral

    Joined:
    Oct 17, 2016
    Messages:
    1,072
    Likes Received:
    2,788
    After working on the import of handmade maps for some time now I have some conclusions.

    The good news: You can create a handmade map and import it into EGS.
    The bad news: In game, the map will bear little resemblance to your handmade map.

    Demonstration
    Reduced size copy of heightmap used to generate handmade map (Original is in IBM RAW format):
    hilo02.png
    Mesh generated in Blender from original heightmap (Red and green barriers added for orientation):
    hi_lo_render.png
    Planet map:
    NewGame_10_2017-12-12_14-36-49.png
    Terrain in game:
    NewGame_10_2017-12-12_14-37-15.png

    The heightmap should have generated a flat terrain with same-size low spots. The results shown above suggest that the game alters handmade maps before terrain generation. This is probably something simple like automatically adding some noise so that a plain landscape is detailed without having to sculpt the detail. In any case, after a few dozen trials I am unable to get the maps I created to import accurately into EGS.

    If anyone has any suggestions as to how I might get a map in-game to correspond with a handmade one I will be grateful to hear from them in this thread. The terrains I'm getting now are very interesting but I was hoping to make planets crisscrossed by rivers running through buttes, racetracks, HV jumps, etc.
     
    #1
    Kassonnade likes this.
  2. eLLe

    eLLe Captain

    Joined:
    Jun 17, 2017
    Messages:
    36
    Likes Received:
    189
    Amazing map, I want it in the game. I dream of a desert planet that is covered with riverside canyons, with small oasis holes. Or the whole covered with water with a couple of small islands, deep and shallow oceans. A planet with forests and volcanoes and ice, all in one.
     
    #2
    Devilmedic and binhthuy71 like this.
  3. Kassonnade

    Kassonnade Rear Admiral

    Joined:
    May 13, 2017
    Messages:
    2,816
    Likes Received:
    4,111
    There must be something wrong because my maps are almost perfect replicas of the heightmaps. I haven't tried it lately with the new terrains though. Let me check this and I come back tomorrow.
     
    #3
    binhthuy71 likes this.
  4. binhthuy71

    binhthuy71 Rear Admiral

    Joined:
    Oct 17, 2016
    Messages:
    1,072
    Likes Received:
    2,788
    Thanks. I think that it may be something in the Adobe RAW format. I'm going to try a couple of freeware converters. It's confusing because the map loads without hiccups.
     
    #4
  5. Kassonnade

    Kassonnade Rear Admiral

    Joined:
    May 13, 2017
    Messages:
    2,816
    Likes Received:
    4,111
    You may try to save as a .tiff and convert it to raw in ImageJ ? Or maybe you forgot to point to your own raw map in the playfield.yaml ?

    I had to re-make the list of textures (some are missing) from the doc Hummel-o-War put online some time ago, because trying to understand how the "terrain.ecf" relates to the playfield.yaml is not easy, and finding which texture goes where is easier when they are listed by number (instead of "ground category"). This only took a little time yesterday after I answered you here. I will make a test map this morning and get back to you.
     
    #5
    binhthuy71 likes this.
  6. binhthuy71

    binhthuy71 Rear Admiral

    Joined:
    Oct 17, 2016
    Messages:
    1,072
    Likes Received:
    2,788
    I tried .tiff. .png, EXR, all of which support the 16 bit grayscale needed for the raw maps. You're right: something is wrong with the way I point to the playfield. I did some testing and the game is not loading my map. I'll have to go back and try to figure what I did wrong in the .yaml's. I haven't worked with them before so I must have made an error somewhere.
     
    #6
    Kassonnade likes this.
  7. Kassonnade

    Kassonnade Rear Admiral

    Joined:
    May 13, 2017
    Messages:
    2,816
    Likes Received:
    4,111
    I am almost done with my "tutorial" but I can confirm that everything is working fine. I even adjusted a few things with the Empyrion Playfield Designer (old version) and it works OK, although it adds long series of dumb numbers in some places with no effect - I simply erased them to get normal decimal values.

    Here is a "rough" of the tutorial, a heads up just for you :

    ----------------------------------------------------------------------------------------------------------------------------------------------------------

    To make the 16-bit grayscale heightmap I will use an old version of Photoshop and a free program called ImageJ, which can be found here:

    https://imagej.nih.gov/ij/

    If you don't have Photoshop you may try working with Gimp, which is free, or any other program that will allow you to save a TIFF file in 16 bits grayscale format.

    I make all my tests in a very simple custom scenario.

    In Empyrion - Galactic Survival\content\scenarios I create a folder with the name of my scenario (here, "KassWorld") so it looks like this:

    Empyrion - Galactic Survival\Content\Scenarios\KassWorld

    In this "KassWorld" folder I create the following (empty) folders:

    Configuration
    Extras
    Playfields
    Prefabs
    Sectors
    Terrains


    I also make a short txt file in notepad and save it here as "Description.txt". Later when I will be in my game I will take a screenshot and put this image in here as "preview.jpg". This image will be 1280 x 720 maximum size. You can look in other scenarios to see what are the usual folders and files present.

    In the "Extras" folder I create a folder named "PDA" but it is empty for now.

    In the "Sectors" folder I copy the "sectors.yaml" from the Empyrion - Galactic Survival\content\Sectors folder to my scenario folder "KassWorld\Sectors\Sectors.yaml". I open it in Notepad++ and edit it so it looks like this:


    Code:
    ---
    
    - Coordinates: [0, 30, 0]
      Color: 0, 0, 0
      Playfields:
      - ['0, 0, 0', Sun, Sun]
    - Coordinates: [92, 5, 117]
      Color: 0.04, 0.3, 0.37
      Icon: Circle
      OrbitLine: True
      Playfields:
      - ['0, 0, 0', Kass01 Orbit, SpaceAsteroidFieldRing]
      - ['0, 0, 0', Kass01, KassPF, 'Human:1']
    That is all of it. So the name of my playfield (planet) will be KassPF, and I will create a folder in my scenario for it:

    Empyrion - Galactic Survival\Content\Scenarios\KassWorld\Playfields\KassPF

    Now I choose what planet type I will use, and for the example here I will take Omicron. I copy "playfield.yaml" and "terrain.ecf" from "Empyrion - Galactic Survival\Content\Playfields\NewDesert" to my scenario's folder "KassWorld\Playfields\KassPF".


    MAP CREATION ********************************


    Make a 8192 x 4096 grayscale image (tga) of the terrain as a "heightmap". Knowing that the maximum altitude supported in game is 500 meters, I use the "hue, saturation, brightness" color tool to set the shades of gray in percentage (brightness) when drawing the map, so "100%" will be 500 meters altitude, "50%" will be 250 meters, etc. This will be useful to adjust biomes later and also to make coherent splatmaps. When satisfied with the completed image, change image mode to 16 bit, flip the image in vertical (switch up & down), save as "tiff" with no compression, IBM PC byte order. Also make 2 copies of the heightmap as tga files, rgb color, to be used for making the 2 splatmaps. Each splatmap is a tga file (rgb + Alpha, 4 channels, 32 bits) 2048 x 1024 pixels.

    (I will discuss these and their relation with the "terrain.ecf" file in more details later, but here's an overview of them (thanks to @Needleship):

    - The ecf defines 5 different textures (='childs'), but the game is able to use 8 texture channels (=the number values, e.g. SplatMap_1: "(0.0, 0.9, 0.0, 0.0)").
    These channels are shown in the terrain editor (te) at the bottom.

    - Those channels correspond to each a 'colour' of the two RGBA-splatmaps.
    The values of 0.0 to 1.0 are the amount the 5 texture 'childs' of the ecf are mixed to the those channels: '1' means this texture is mixed in to 100%, '0.5' means 50%.
    If you turn a texture to zero, and there is no other texture to fill that 'gap', the result will be a featureless and black patch.
    (It is possible to add all 5 textures on top of each other if you set in each child the same spot in of a splatmap to 1. The brightness and saturation of the textures will be added, too. So the result of this will be probably white and unsightly.)

    - Splatmaps with 'mixed' RGBA-colours mix the texture channels automatically by overlap.
    E.g. a 'Pink' region in splatmap01 has an amount of both texture channels/'childs' corresponding to splat01-R and splat01-B.


    Back to our heightmap now:

    Here is the (fake) grayscale heightmap I made:
    KassterrainSHOW.jpg
    The two red lines show the position (approximate) of the pole barriers. There is also no real "up" or "down" but I use this image for testing precise POI placement. 1 pixel of the heightmap corresponds to 1 meter in game, so the width of the playfield is 8192 meters, and from North to South pole it is 4096 meters. The origin ( 0,0,0 ) is at the exact center of the map, so going west from that point will be negative values up to -4096 meters before hitting the green wall, and going East will be 4096 meters. Going North or South from the center, South is negative values, North is positive, and the polar barriers are at (plus or minus) 1342 meters from the origin/ center.

    Here are the 2 splatmaps made from this grayscale image :
    splatmap 1:

    KassterrainSHOW_splat1.jpg

    Splatmap 2:

    KassterrainSHOW_splat2.jpg


    Open the 16 bit tiff "heightmap" in ImageJ to edit if wanted; I usually only do 1 pass of "smooth" (to remove steps since the original image was drawn in 8 bit) and save the tiff. I open it back in Photoshop then save as raw. To save the image as raw (file - save as - "RAW data...") in ImageJ, first go to Edit - options - input/output and make sure that "Save TIFF and raw in Intel byte order" is checked before saving the file, or else the image will get noise added everywhere.

    To open a raw in ImageJ :

    Image type: 16-bit Unsigned
    Width: 8192
    Height: 4096
    Offset to first image: 0
    Number of images: 1
    Gap between images: 0

    Little-endian byte order


    (leave the 3 other options blank)
    ----------------
    Make sure the grayscale heightmap image is flipped vertical relative to the splatmaps!
    ----------------


    Save the raw heightmap in Empyrion - Galactic Survival\content\terrains, as well as the 2 splatmaps.



    PLAYFIELD ADJUSTMENTS ****************************************************

    In the custom playfield.yaml, in this section :

    ### Terrain and Decorations
    # Terrain and Local Decoration
    Terrain:
    Name: Kassterrain


    write the name of your raw file (without the extension) after "Name: " - beware of extra spaces in the yaml : only one space before your custom map name!

    In the terrain.ecf file, at the very beginning :

    { Material Name: Kassterrain

    HeightMapMax: "400"


    SplatMap_1: "Kassterrain_splat1.tga"


    SplatMap_2: "Kassterrain_splat2.tga"


    Here I just changed the name of the splatmaps to match my own, and I also changed the maximum altitude from 255 to 400.


    NOTES **********************************************************************


    Since I am using Omicron as a template, it is possible that the different biomes will not match the splatmaps / heightmap defined in the playfield.yaml, but this can be adjusted later, as many other details and deco, with the (EPD) Empyrion Playfield Designer (thanks to @jmcburn ) which can be found here:

    https://empyriononline.com/threads/tool-empyrion-playfield-designer-v1-36-1.9789/

    The present terrain is just an example to show basic usage of heightmaps. Using the EPD I gave a breathable atmosphere to Omicron, lowered the radiation level and raised the oxygen presence from 0.1 to 0.2. I also raised the water level to 100.

    The two splatmaps are used by the game to assign textures to specific zones defined by each color channel (Red, Green, Blue, Alpha). These textures are defined in the "terrain.ecf" file, and assigned to color channels of the splatmaps. To have an idea of what these textures are I use the document made by @Hummel-o-War listing textures & deco found in the game (some of the latest ones are missing). The document can be found here:

    https://empyriononline.com/threads/handbook-playfield-reference-sheet-v0-1.12646/#post-193698

    Since both my splatmaps cover all terrain, there are "texture overlaps" so to avoid having too much brightness I simply reduced the amount of color in each channel before saving the splatmaps (ex. red is reduced to 50%, green to 40%, etc).

    Here is a screenshot of this planet :

    NewGame_5_2017-12-13_17-29-31.png

    The "map" view :

    NewGame_5_2017-12-13_17-29-39.png
     
    #7
    Last edited: Dec 14, 2017
  8. binhthuy71

    binhthuy71 Rear Admiral

    Joined:
    Oct 17, 2016
    Messages:
    1,072
    Likes Received:
    2,788
    Brilliant work! You laid out everything completely and logically. I was glad that I took a break from RL and read your write up, it will save me a lot of trouble later this evening when I set up a new test solar system. Thank you. I was beating my head against the wrong wall. :D
     
    #8
    Kassonnade likes this.
  9. Kassonnade

    Kassonnade Rear Admiral

    Joined:
    May 13, 2017
    Messages:
    2,816
    Likes Received:
    4,111
    Thank you kind Sir ! :)

    This is still a work-in-progress though, as I wish to make some roads through forests, a (POI) bridge over a chasm, a partly sunk volcano with a lake in the crater with a small river going out of it, show how to make East - West border seamless, etc. I will make the tutorial with more steps, images & accurate measures if I can, with more explanations on how to draw coherent splatmaps, how to make a custom ecf file and adjust the yaml accordingly.

    To make the alpha channel for each splatmap, simply select whatever will be this 4th channel and in the select menu choose "save selection" and save as "channel" with the name "Alpha" and it should add itself to the channels list, at least in Photoshop it works that way. I will check for an easy way to make this.

    Edit : I corrected a few small things here, be sure to check the section about the ecf file ( { Material Name: Kassterrain).
     
    #9
    Last edited: Dec 14, 2017
    Sofianinho, eLLe and binhthuy71 like this.
  10. binhthuy71

    binhthuy71 Rear Admiral

    Joined:
    Oct 17, 2016
    Messages:
    1,072
    Likes Received:
    2,788
    Looking forward to it! I'm working up a test scenario. Once I get that sorted I'll try modeling some of the things you mentioned. It's high time I became comfortable with .yamls anyway.
     
    #10
  11. eLLe

    eLLe Captain

    Joined:
    Jun 17, 2017
    Messages:
    36
    Likes Received:
    189
    I'm thrilled with the impatience to try your works. Everyone honors you both ...
     
    #11
    binhthuy71 and Kassonnade like this.
  12. Kassonnade

    Kassonnade Rear Admiral

    Joined:
    May 13, 2017
    Messages:
    2,816
    Likes Received:
    4,111
    Let's just hope we are not wasting our time on something that will be deprecated when or IF they change the playfields for "bigger / round planets"...
     
    #12
  13. binhthuy71

    binhthuy71 Rear Admiral

    Joined:
    Oct 17, 2016
    Messages:
    1,072
    Likes Received:
    2,788
    Thank you! We're mostly guessing our way into this. Without the work of Kassonade and jmcburn I'd still be scratching my head.
     
    #13
    jmcburn and eLLe like this.
  14. Kassonnade

    Kassonnade Rear Admiral

    Joined:
    May 13, 2017
    Messages:
    2,816
    Likes Received:
    4,111
    A few strange things I am trying to sort out...

    Here on Akua (NewTemperate) at the bottom of the big lake, I see the "base texture" that is defined in the YAML, "Cliff2", but also the sand texture which is defined in the ECF file. This is altitude 0 where the ground can't be dug anymore, and some grass appeared when I removed the 1 meter thin layer over the bottom of the lake. Did not find a clue in both splatmaps why such a thing shows in game :

    NewGame_0_2017-12-14_19-34-56.png
    And here, on the beach beside that lake, I dug a hole all the way to the bottom of the map (altitude 0) to see if this was just a superficial mix of sand / rock at the surface. It looks like the "main playfield texture" defined in the YAML can be overridden by another texture all the way down. I would have expected to have just a layer of sand over a thick layer of "Cliff2" since this is the texture that underlies the whole terrain:

    NewGame_0_2017-12-14_21-02-48.png
     
    #14
    Sofianinho and binhthuy71 like this.
  15. binhthuy71

    binhthuy71 Rear Admiral

    Joined:
    Oct 17, 2016
    Messages:
    1,072
    Likes Received:
    2,788
    Interesting. So the ECF overrides the .yaml?
     
    #15
    Kassonnade likes this.
  16. Kassonnade

    Kassonnade Rear Admiral

    Joined:
    May 13, 2017
    Messages:
    2,816
    Likes Received:
    4,111
    I am not sure yet which file overrules the other one and in what aspects. From the in-game terrain editor I can at least have the right textures images that are not in the reference sheet made by Hummel-o-War.

    ECF-5-textures.png

    From this I know that "Sandbeach" is #33, and in the ECF file I see it is also defined as "UnderTerrain" while all other textures have the Cliff2 under them. An error ?

    Code:
    { Child 2
      Brightness: "1"
      Saturation: "1"
      RGB: "(1, 1, 1)"
      AddCol: "1"
      ReliefStrength: "0.1"
      NearScale: "0.4"
      DistantScale: "0.06"
      TerrainId: "33"
      TerrainLayers: "0"
      UnderTerrainId: "33"
      SplatMap_1: "(0.1, 0.0, 1.0, 0.0)"
      SplatMap_2: "(0.0, 0.2, 0.0, 0.0)"
    To make a "terrain profile" I took a strip of terrain in all "layers" to help me see the relation between the various biomes, the textures, slopes, etc :

    4-Part_maps.png

    All biomes and textures are "present" in this part of the terrain. In the YAML the various deco items defined in biomes are assigned to "slopes" ranges, but also to splatmaps. I will have to strip down each biome and see how this works to make sure trees don't spawn underwater and cliffs are textured correctly.
     
    #16
    Last edited: Dec 15, 2017
    binhthuy71 likes this.
  17. binhthuy71

    binhthuy71 Rear Admiral

    Joined:
    Oct 17, 2016
    Messages:
    1,072
    Likes Received:
    2,788
    I think that "Under Terrain" is an error based on the fact that SandBeach seems more like a surface terrain.
     
    #17
    Kassonnade likes this.
  18. Kassonnade

    Kassonnade Rear Admiral

    Joined:
    May 13, 2017
    Messages:
    2,816
    Likes Received:
    4,111
    You can see the SandBeach texture is assigned to splatmap 1 "blue" channel with a strength of 1.0. The "water" biome is the lowest one, starting at altitude 0 up to 65 on Akua. This shows that to prevent the "main" texture from being overruled by another one it should be defined in the ECF rather than in the YAML and assigned to a color channel that covers all the map. The "top" texture layer defined in the YAML (GrassCliff) is not in the ECF.

    I am not even sure it is useful at all to define these textures in the YAML... We can at least have 1 more texture there, but why not simply put it in the ECF if the game can support up to 8 textures, each with an "UnderTerrain" defined ?
     
    #18
    Last edited: Dec 15, 2017
  19. binhthuy71

    binhthuy71 Rear Admiral

    Joined:
    Oct 17, 2016
    Messages:
    1,072
    Likes Received:
    2,788
    Good point. The only thing I can think of is that the YAML seems like a solution for procedural maps while the ECF seems designed to work with handmade ones. I just returned to the project today and I should have some results this weekend - RL permitting.
     
    #19
    eLLe and Kassonnade like this.
  20. Kassonnade

    Kassonnade Rear Admiral

    Joined:
    May 13, 2017
    Messages:
    2,816
    Likes Received:
    4,111
    Something odd caught my attention on the latest Akua map and made me curious to see how the map was "wrapped" at the East-West meeting point, so I took a slice of each border of the splatmap #1 to compare them...

    Mirror.png

    It is perfectly symmetrical. The map is simply "mirrored" at the edges... I went in game and it became obvious :

    NewGame_1_2017-12-15_22-32-34.png

    It is also obvious on the small map where I added a white line to show the position of the "green wall":

    NewGame_1_2017-12-15_22-31-13.png

    Not a very "elegant" solution... o_O
     
    #20
    eLLe and binhthuy71 like this.

Share This Page