1)In a simplex noise map like my editor,darkfrei's mid point displacement map or voronoi algorithm how do I add rivers and trees to the map?
2)How do I make a voronoi map tile based from the polygons?
Adding trees and rivers to procedural map and voronoi to tiles
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Gunroar:Cannon()
- Party member
- Posts: 1139
- Joined: Thu Dec 10, 2020 1:57 am
-
- Prole
- Posts: 37
- Joined: Thu Jun 24, 2021 5:49 pm
Re: Adding trees and rivers to procedural map and voronoi to tiles
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:
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.
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
Hopefully you find this helpful; I've literally never worked with voronoi anything so I won't offer up any misinformation there lol.
- Gunroar:Cannon()
- Party member
- Posts: 1139
- Joined: Thu Dec 10, 2020 1:57 am
Re: Adding trees and rivers to procedural map and voronoi to tiles
Thanks alot for this . Yeah, I'm not to hot on voronoi really. Can you post any screenshot to show a map in action?
-
- Prole
- Posts: 37
- Joined: Thu Jun 24, 2021 5:49 pm
Re: Adding trees and rivers to procedural map and voronoi to tiles
Sure! I recently implemented a few different "tilesets" for forests, volcanos, and caves.
cave:
forest:
volcano:
Edit: Here, go ahead and poke through my source if you like.
https://github.com/applebappu/wizard-tower
cave:
forest:
volcano:
Edit: Here, go ahead and poke through my source if you like.
https://github.com/applebappu/wizard-tower
- Gunroar:Cannon()
- Party member
- Posts: 1139
- Joined: Thu Dec 10, 2020 1:57 am
Re: Adding trees and rivers to procedural map and voronoi to tiles
Wow, looks neat! I like ascii and roguelikes Do those have rivers?
-
- Prole
- Posts: 37
- Joined: Thu Jun 24, 2021 5:49 pm
Re: Adding trees and rivers to procedural map and voronoi to tiles
Not as such right now. There's nothing forcing water tiles to spawn next to each other. Though I think that's simple enough to make happen, with some post processing.
Like after you generate the initial noise map, you could iterate back over it smoothing it out with some probabilities. Say, if noise_map[x][y] == "water tile" then uhhhh roll dice, with a weight towards putting more water next to it. Or something.
The way I've made "forests" and such is to just put more copies of that tile into the map_pieces table lol.
EDIT: oh, did you mean like, do roguelikes in general have rivers? yeah, absolutely. Nethack and ADOM both have water features for sure.
Like after you generate the initial noise map, you could iterate back over it smoothing it out with some probabilities. Say, if noise_map[x][y] == "water tile" then uhhhh roll dice, with a weight towards putting more water next to it. Or something.
The way I've made "forests" and such is to just put more copies of that tile into the map_pieces table lol.
EDIT: oh, did you mean like, do roguelikes in general have rivers? yeah, absolutely. Nethack and ADOM both have water features for sure.
- Gunroar:Cannon()
- Party member
- Posts: 1139
- Joined: Thu Dec 10, 2020 1:57 am
Re: Adding trees and rivers to procedural map and voronoi to tiles
Thnx, and haha, no, I meant rivers in yours, but it's still good to know. Also if you count dwarf fotress adventure mode as a roguelike I guess it also has rivers
-
- Prole
- Posts: 37
- Joined: Thu Jun 24, 2021 5:49 pm
Re: Adding trees and rivers to procedural map and voronoi to tiles
Gotcha lol. Yeah I do sometimes accidentally get rivers, but there's nothing in the code saying "make rivers" per se.
Who is online
Users browsing this forum: Bing [Bot] and 2 guests