I had to deal with something similar in my own game, actually. Your implementation may vary, but basically what I did was use the initial output of the noise map to then choose tiles from a table of potential selections, and then tweaked the table and the noise function until I was getting stuff I liked.
To make certain swaths of the map be rivers or trees, for instance, you might write it so that a particular number output from the noise map puts a tree or a river tile there.
Simplex noise outputs non-integer values, so you'll probably need to use math.floor to round it down to integers, or other permutations until you get it just right. Experimentation is key.
Here's my own map generation code, for your reference and adaptation:
Code: Select all
RandomMap = function(self)
local noise_map = {}
local up_stairs = {
x = math.random(2,37),
y = math.random(2,19)
}
local down_stairs = {
x = math.random(2,37),
y = math.random(2,19)
}
for i = 1, self.board_size.x do
noise_map[i] = {}
self.map_table[i] = {}
for j = 1, self.board_size.y do
noise_map[i][j] = math.floor(10 * ( love.math.noise( i + math.random(), j + math.random() ) ) ) + 1
self.map_table[i][j] = map_pieces.tiles[noise_map[i][j]]
if i == 1 or j == 1 then
self.map_table[i][j] = "#"
end
if i == self.board_size.x or j == self.board_size.y then
self.map_table[i][j] = "#"
end
if i == up_stairs.x and j == up_stairs.y then
self.map_table[i][j] = "<"
end
if i == down_stairs.x and j == down_stairs.y then
self.map_table[i][j] = ">"
end
end
end
end
My map is somewhat simpler than a diamond square generation, as you can see. Basically I'm just taking some simplex noise, making sure I get integer values out of it, then feeding that into my map_pieces table (not pictured here, but it's just a list of string "tiles" to choose from, for drawing to the screen). Then I shove in some fixed values I know I always want, like a border around the outside and some up and down stairs, and call it a day.
Hopefully you find this helpful; I've literally never worked with voronoi anything so I won't offer up any misinformation there lol.