Thanks micha. It is possible, that there are less caves, not smaller only less? Beause when I generate a world with 50% caves, it looks little stranges...
And the seed of love.math.noise can't work, it has no seed. Can I anywhere else set the seed of love.math.noise?
how to create an 2d block-world?
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
Re: how to create an 2d block-world?
the value(s) you pass into love.math.noise() are the seed:Luke100000 wrote:Thanks micha. It is possible, that there are less caves, not smaller only less? Beause when I generate a world with 50% caves, it looks little stranges...
And the seed of love.math.noise can't work, it has no seed. Can I anywhere else set the seed of love.math.noise?
Code: Select all
local w, h = 100, 100
local world = {}
for x = 1, w, 1 do
world[x] = {}
for y = 1, h, 1 do
world[x][y] = love.math.noise(x, y)
end
end
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: how to create an 2d block-world?
And as for less caves, that was the threshold micha was talking about. You can then increase the scale, otherwise the caves would become smaller as well.
Help us help you: attach a .love.
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
Re: how to create an 2d block-world?
I think I understood this.
Re: how to create an 2d block-world?
I updated my demo a bit, so you can play around with the values.
Press up/down/left/right to change the scale of the noise (similar to zooming in and out)
Press w/s to change the threshold value (=ratio of green to blue blocks)
Press a/d to change the seed.
Edit: Press space to set x-scale and y-scale to the same value.
As the others pointed out already, love.math.noise does not have a random seed. What I did instead is added a third argument to the function call. That means that in reality I use a three-dimensional noise, but fix one of the three values. That way I get a two-dimensional noise and I can use the third value as a seed.
Press up/down/left/right to change the scale of the noise (similar to zooming in and out)
Press w/s to change the threshold value (=ratio of green to blue blocks)
Press a/d to change the seed.
Edit: Press space to set x-scale and y-scale to the same value.
As the others pointed out already, love.math.noise does not have a random seed. What I did instead is added a third argument to the function call. That means that in reality I use a three-dimensional noise, but fix one of the three values. That way I get a two-dimensional noise and I can use the third value as a seed.
- Attachments
-
- randomBlock2.love
- (707 Bytes) Downloaded 135 times
Check out my blog on gamedev
Who is online
Users browsing this forum: No registered users and 5 guests