Modding Help Terrain files. How do they work?

Discussion in 'Starbound Modding' started by Broconut, May 3, 2016.

  1. Broconut

    Broconut Cosmic Narwhal

    I need help from someone who is experienced with .terrain files or has at least dabbled enough with them to sort of know what they're doing. I'm trying to make a lake sub-biome that uses an infinite water source (like the ocean biome) and has a slightly bumpy terrain that dips down below the planet's divider. Here is a crappy MS Paint drawing and a screenshot to show what I'm trying to do and what I have so far.

    This is what I'm trying to achieve:

    Green = Garden biome terrain
    Blue = Water
    Light Brown = Planet Divider
    Brown = Lake biome terrain

    [​IMG]

    This is what I have so far:

    [​IMG]

    I've got the water at the height I want, but I still need to figure out how to get the terrain (specifically, the bottom of the lake) to behave the way I want. Right now, the terrain turns into a 90 degree wall that drops straight to the first cave layer (very far down) and the bottom of the lake is completely flat. This is because I have the terrain set to "empty".

    Whenever I try to make land that dips down using my own terrain file, it never seems to do it no matter which modifier I change. Really, I'd like to know what the settings in the terrain files do.

    Here's flatssurface.terrain.

    Code:
    {
      "name" : "flatsSurface",
    
      //surface roughness
      "type" : "displacement",
      "xType" : "perlin",
      "xOctaves" : 2,
      "xFreq" : 0.07,
      "xAmp" : 3,
      "xXInfluence" : 0.3,
      "xYInfluence" : 0.3,
      "yType" : "perlin",
      "yOctaves" : 1,
      "yFreq" : 0.1,
      "yAmp" : 1,
      "yYInfluence" : 0,
    
      "source" : {
        //low hills
        "type" : "displacement",
        "xType" : "perlin",
        "xOctaves" : 2,
        "xFreq" : 0.01,
        "xAmp" : 0,
        "yType" : "perlin",
        "yOctaves" : 1,
        "yFreq" : 0.015,
        "yAmp" : 20,
        "yClamp" : [-60, 10],
        "yClampSmoothing" : 5,
        "yYInfluence" : 0.2,
    
        "source" : {
          //slower, lower hills
          "type" : "displacement",
          "xType" : "perlin",
          "xOctaves" : 2,
          "xFreq" : 0.01,
          "xAmp" : 0,
          "yType" : "perlin",
          "yOctaves" : 1,
          "yFreq" : 0.005,
          "yAmp" : 10,
    
          "source" : {
            "type" : "flatSurface",
    
            "adjustment" : 0
          }
        }
      }
    }
    
    What impact do modifiers like xOctaves, xAmp, xFreq, etc, have on the terrain and how can I modify them in a way that'll allow me get the terrain in the drawing above?
     
  2. The | Suit

    The | Suit Agent S. Forum Moderator

    How good are you in math? http://flafla2.github.io/2014/08/09/perlinnoise.html

    Code:
    octaves - Number Number of waves to add for Perlin noise
    frequency -  Number Initial frequency of wave for Perlin noise, doubled for each octave
    amplitude - Number Initial amplitude of wave for Perlin noise, halved for each octave
    alpha Number -  Perlin "Noisieness" - The closer this is to 1, the noisier the noise is
    beta Number - Controls wave offset of successive octaves for Perlin noise
    
    Otherwise if you just want to make a lake. Make a mini dungeon lake instead - its far easier and you can design it exactly like you want it.
     
  3. Broconut

    Broconut Cosmic Narwhal

    Oh wow, that Perlin Noise article you posted looks quite daunting, but the images with the amplitude and frequency examples look very handy so thanks for sharing.

    As for the mini dungeon suggestion, I could do that, but I'm going to keep experimenting with the modifiers and see if I can get something closer to what I want before I resort to doing that.

    UPDATE: I think I've pretty much got it to how I want it but with a few hiccups.

    This bit of code at the bottom was causing the problem for me.

    Code:
          "source" : {
            "type" : "flatSurface",
    
            "adjustment" : 0
          }
    
    It seems that giving "adjustment" a positive value increases the elevation while a negative value decreases it. I'm assuming this works across the board for all .terrain files. I set it to -85 for my lakesurface.terrain file.

    The results.


    I lowered the water level a bit.

    [​IMG]

    There's still some issues with things like trees occurring from the standard garden biome during the transition, although I'm not sure if there's much I can do about that.

    [​IMG]

    The lake is more shallow and the terrain is no longer flat on the lake bed.

    [​IMG]

    Sometimes the water acts a bit strange near the edges, but again, I'm pretty sure it has to do with the biome transition, so I'm not sure much can be done about this either.

    [​IMG]

    x2 zoom to show about how deep the lake is on average.

    [​IMG]

    Overall, I think it turned out pretty nice but there's still some problems with it that I may not be able to fix.
     
    Last edited: May 3, 2016
    The | Suit likes this.

Share This Page