Page 1 of 1

Need help with world generation

Posted: Sun Nov 15, 2020 2:08 pm
by patfre
So what i need help with is to make it so the hole world is water with 1 tile in the middle that is grass where the player spawns and also has 1 tree.
I do know how to make a custom world gen but not a world like what i want. How would i make that?

Re: Need help with world generation

Posted: Sun Nov 15, 2020 4:33 pm
by patfre
Guess no one so far knows how :|

Re: Need help with world generation

Posted: Sun Nov 15, 2020 9:11 pm
by Bilka
How/where do you want to apply the map generation? Force it by default? Just a map gen preset? Or on surface creation? If on surface creation, control stage only or is data stage okay?

Re: Need help with world generation

Posted: Mon Nov 16, 2020 2:06 pm
by PFQNiet
Not something I've experimented with, but based on this rather in-depth guide I think this should work:

Code: Select all

local noise = require("noise")
data:extend{
  {
    type = "noise-expression",
    name = "point",
    intended_property = "elevation",
    expression = noise.define_noise_function(function(x, y, tile, map)
      return 0.5 - tile.distance
    end)
  }
}
This will add a new "Terrain type" (alongside "Normal" and "Island") that is an endless sea with a single tile at {0,0}.

Planting a tree can be done in control.lua.

Code: Select all

script.on_init(function()
  game.surfaces.nauvis.create_entity{
    name = "tree-01",
    position = {0.5,0.5},
    force = game.forces.neutral
  }
end)
Hope this helps!

Re: Need help with world generation

Posted: Mon Nov 16, 2020 3:32 pm
by patfre
PFQNiet wrote: Mon Nov 16, 2020 2:06 pm Not something I've experimented with, but based on this rather in-depth guide I think this should work:

Code: Select all

local noise = require("noise")
data:extend{
  {
    type = "noise-expression",
    name = "point",
    intended_property = "elevation",
    expression = noise.define_noise_function(function(x, y, tile, map)
      return 0.5 - tile.distance
    end)
  }
}
This will add a new "Terrain type" (alongside "Normal" and "Island") that is an endless sea with a single tile at {0,0}.

Planting a tree can be done in control.lua.

Code: Select all

script.on_init(function()
  game.surfaces.nauvis.create_entity{
    name = "tree-01",
    position = {0.5,0.5},
    force = game.forces.neutral
  }
end)
Hope this helps!
Thanks this works just as what i wanted

Re: Need help with world generation

Posted: Sat Dec 28, 2024 3:09 am
by gm.steeldragon
The 2.0 release has broken this, local noise = require("noise") specifically. Noise.lua is no longer included in the lualib.

I've looked in the new core/lualib folder, but I can't see where the new noise functions are...

Any suggestions on how to fix this?

PFQNiet wrote: Mon Nov 16, 2020 2:06 pm Not something I've experimented with, but based on this rather in-depth guide I think this should work:

Code: Select all

local noise = require("noise")
data:extend{
  {
    type = "noise-expression",
    name = "point",
    intended_property = "elevation",
    expression = noise.define_noise_function(function(x, y, tile, map)
      return 0.5 - tile.distance
    end)
  }
}
This will add a new "Terrain type" (alongside "Normal" and "Island") that is an endless sea with a single tile at {0,0}.

Planting a tree can be done in control.lua.

Code: Select all

script.on_init(function()
  game.surfaces.nauvis.create_entity{
    name = "tree-01",
    position = {0.5,0.5},
    force = game.forces.neutral
  }
end)
Hope this helps!