Post your mapgen questions here (modding or engine)
-
- New member
- Posts: 4
- Joined: Wed Aug 17, 2016 11:48
procedural map
Using Lua, how do I procedurally generate a map? I copy-pasted some examples from wiki into init.lua but they don't work (don't create map or something like this)
For example (I might use not proper minetest's names)
1)
y = 1 => sand
y < 1 => rock
y > 1 => air
2) Then let's say every 3rd block in x- and z- coordinate will be dirt (y = 1; z, x = 3, 6, 9, 12, ...)
For example (I might use not proper minetest's names)
1)
y = 1 => sand
y < 1 => rock
y > 1 => air
2) Then let's say every 3rd block in x- and z- coordinate will be dirt (y = 1; z, x = 3, 6, 9, 12, ...)
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
burli,
This is a lua mapgen? Operating in singlenode mapgen or adding to another? Can you link to your code?
The sand is probably the seabed sand from the defined biomes, this does appear sometimes in core mapgens down to y = -112 and is caused by overgeneration of large caves.
This is a lua mapgen? Operating in singlenode mapgen or adding to another? Can you link to your code?
The sand is probably the seabed sand from the defined biomes, this does appear sometimes in core mapgens down to y = -112 and is caused by overgeneration of large caves.
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
procedural_map,
You create a lua mapgen using the lua voxel manipulator, an example simple mapgen is here https://github.com/paramat/noise23
You create a lua mapgen using the lua voxel manipulator, an example simple mapgen is here https://github.com/paramat/noise23
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
Re: Post your mapgen questions here (modding or engine)
What is the best way to check if an area is generated a plain?
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
You mean detect a grassland biome?
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
Re: Post your mapgen questions here (modding or engine)
Yes, I do not want to create decorative items. I want to create structures such as villages.
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
So you're looking for a fairly flat area too?
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
Re: Post your mapgen questions here (modding or engine)
Here's an example. This looks like a smooth behavior of the perlin noise.
- Attachments
-
- exemplo.jpg (104.01 KiB) Viewed 1323 times
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
Easiest way is to use the 'mapgen object heightmap' and scan it for a small height variation.
For biome hopefully soon we will have a 'get biome at point' API (hmmmm intends to write it), until then you'll have to use the mapgen's heat- and humidity- (and in mgv6 tree-) noises and check for values that result in grassland.
For biome hopefully soon we will have a 'get biome at point' API (hmmmm intends to write it), until then you'll have to use the mapgen's heat- and humidity- (and in mgv6 tree-) noises and check for values that result in grassland.
-
- Member
- Posts: 4276
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: Post your mapgen questions here (modding or engine)
That was my original intention as well, but it didn't prove to be practical. Most horizontal areas will not be large enough for your village anyway. And it's not exactly cheap to locate such areas. In the end, just changing the terrain in a believable way and pretending it had always looked like that (minus the village of course :-)) works pretty well. The additional advantage is that there's less dependency on the mapgen actually used.BrunoMine wrote: Yes, I do not want to create decorative items. I want to create structures such as villages.
A list of my mods can be found here.
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: Post your mapgen questions here (modding or engine)
I did the same with primitive villages, cities, even metal-rich soil for ferns. If you're looking for something, it's always easier to find if you put it there yourself.Sokomine wrote:That was my original intention as well, but it didn't prove to be practical. Most horizontal areas will not be large enough for your village anyway. And it's not exactly cheap to locate such areas. In the end, just changing the terrain in a believable way and pretending it had always looked like that (minus the village of course :-)) works pretty well. The additional advantage is that there's less dependency on the mapgen actually used.BrunoMine wrote: Yes, I do not want to create decorative items. I want to create structures such as villages.
Believe in people and you don't need to believe anything else.
Re: Post your mapgen questions here (modding or engine)
I think, with the default mapgens it is not possible. They don't provide any informations about the map. Even with heightmap and biome you have still have the problem, that you need to check a lot, e.g. if there are trees in the way.
Structures like buildings should be placed before any other decoration. But this is currently not possible for mods because they run after everything is done. That's why I suggested some kind of Mapgen API a few weeks ago to split map generation in different steps and execute lua mapgens between the steps from the C++ mapgen or replace entire steps
I read a bit about map generation and there are some different types of methodes. Using noises is one of the easiest, but as I mentioned you don't have much information and no control about your map.
I think about something like a "geome" map, geological regions similar to biomes, but with different land shapes like different kind of mountains, mesa, highlands, hills, plateaus, canyons, plains, lakes, of course oceans or even (nearly) flat regions for a village "geome" without any decoration
Structures like buildings should be placed before any other decoration. But this is currently not possible for mods because they run after everything is done. That's why I suggested some kind of Mapgen API a few weeks ago to split map generation in different steps and execute lua mapgens between the steps from the C++ mapgen or replace entire steps
I read a bit about map generation and there are some different types of methodes. Using noises is one of the easiest, but as I mentioned you don't have much information and no control about your map.
I think about something like a "geome" map, geological regions similar to biomes, but with different land shapes like different kind of mountains, mesa, highlands, hills, plateaus, canyons, plains, lakes, of course oceans or even (nearly) flat regions for a village "geome" without any decoration
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: Post your mapgen questions here (modding or engine)
If you know biome you can avoid trees, or if there are trees you can remove them for a 'vilage in a forest' effect.
Re: Post your mapgen questions here (modding or engine)
Of course can I avoid trees, but it is just easier if you have a "village biome"
Removing trees has two problems. It costs time to generate and remove them and removing may result in half cutted tree.
Removing trees has two problems. It costs time to generate and remove them and removing may result in half cutted tree.
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
Re: Post your mapgen questions here (modding or engine)
viewtopic.php?f=9&t=15382
This was my attempt to create something. I used the height of the land and avoiding trees (simply canceling the placement of the village). The code is not very clean, but the results are very interesting.
This was my attempt to create something. I used the height of the land and avoiding trees (simply canceling the placement of the village). The code is not very clean, but the results are very interesting.
Re: Post your mapgen questions here (modding or engine)
Needed 30 seconds to find an example in BrunoMine's mod. That can always happen if you place trees firstburli wrote:Removing trees has two problems. It costs time to generate and remove them and removing may result in half cutted tree.
- Attachments
-
- screenshot_20160820_223952.jpg (326.71 KiB) Viewed 1323 times
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
Re: Post your mapgen questions here (modding or engine)
This should be a check failure, it should not happen.
Re: Post your mapgen questions here (modding or engine)
I flew around for a few minutes and I found lots of examples. Here is a tree decayingBrunoMine wrote:This should be a check failure, it should not happen.
- Attachments
-
- screenshot_20160820_225001.jpg (528.89 KiB) Viewed 1323 times
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
Re: Post your mapgen questions here (modding or engine)
I performed the necessary corrections. The houses are not built in place of trees.
I checked for 1 minute and found the error.
Download again DEV version of the project.
I checked for 1 minute and found the error.
Download again DEV version of the project.
Re: Post your mapgen questions here (modding or engine)
Even if it works it takes additional time while map generation and you can't build a house or village in a forest
It's like building a house from the roof down to the cellar. It may work, but it takes more time and the result might be different from what you want
If I would write a mapgen I would place the buildings first, then the trees
It's like building a house from the roof down to the cellar. It may work, but it takes more time and the result might be different from what you want
If I would write a mapgen I would place the buildings first, then the trees
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: Post your mapgen questions here (modding or engine)
Write that mapgen!burli wrote:Even if it works it takes additional time while map generation and you can't build a house or village in a forest
It's like building a house from the roof down to the cellar. It may work, but it takes more time and the result might be different from what you want
If I would write a mapgen I would place the buildings first, then the trees
Seriously, there's nothing stopping you from placing everything yourself. Gael de Sailly did it, and valleys mapgen was very popular when I discovered minetest. (Sadly, I think I scuttled it when I converted it to C, even though you can still place all the valleys decorations on top of the C mapgen.)
Yes, it's going to take more CPU time, but if you're doing any modifications via voxelmanip, you've already spent most of that time. Anyway, liquid and light handling are the worst time wasters for me, no matter where the bits and pieces are being placed. Gael de Sailly had it right. Do everything yourself as long as you're doing any of it and save the time the regular mapgen would take.
If I were really clever, I'd write the basics (or steal them from valleys) with single node setting and overload the voxelmanip functions so that all other mods worked through my framework, so that data was only read and written once, and lighting and liquid calculations happened once at the end of the process. Cut the C mapgens out altogether!
But I'm blithering again...
Believe in people and you don't need to believe anything else.
Re: Post your mapgen questions here (modding or engine)
We both know that there is an ugly 1GB limit, if you would like to do this in Lua. I don't think that it is possible to write the mapgen I have in mind in Lua and I don't have the C++ skills to write a native mapgen.duane wrote: Write that mapgen!
Seriously, there's nothing stopping you from placing everything yourself. Gael de Sailly did it, and valleys mapgen was very popular when I discovered minetest. (Sadly, I think I scuttled it when I converted it to C, even though you can still place all the valleys decorations on top of the C mapgen.)
Yes, it's going to take more CPU time, but if you're doing any modifications via voxelmanip, you've already spent most of that time. Anyway, liquid and light handling are the worst time wasters for me, no matter where the bits and pieces are being placed. Gael de Sailly had it right. Do everything yourself as long as you're doing any of it and save the time the regular mapgen would take.
If I were really clever, I'd write the basics (or steal them from valleys) with single node setting and overload the voxelmanip functions so that all other mods worked through my framework, so that data was only read and written once, and lighting and liquid calculations happened once at the end of the process. Cut the C mapgens out altogether!
But I'm blithering again...
Nevertheless I will write my own mapgen, but more to get programming skills than to make an actual mapgen
Re: Post your mapgen questions here (modding or engine)
How do I create a voronoi diagram and how do I use it?
- qwertymine3
- Member
- Posts: 202
- Joined: Wed Jun 03, 2015 14:33
- GitHub: Qwertymine
- In-game: qwertymine3
Re: Post your mapgen questions here (modding or engine)
You can either generate it pixel by pixel, by testing the distance to each point near the pixel and finding the closest.burli wrote:How do I create a voronoi diagram and how do I use it?
Here is a good explanation of how to do this: http://web.archive.org/web/201604190631 ... l-noise-2/
Or you can generate a diagram of vectors which bound the 'cells', using an algorithm such as fortunes algorithm. To use this, you would then have to use an algorithm to render the polygons.
For minetest mapgen, the former method is fast enough for 2d noise. 3d noise is very hard to optimise with the former method, and would requires some advanced algorithms with the latter method.
Avatar by :devnko-ennekappao:
Who is online
Users browsing this forum: No registered users and 1 guest