I want to create an infinite 2d world, made of blocks ( you see the world from the side!). I split the world into 16*16 chunks and I generate them if the player needs them. My problems are caves. How I can generate caves totally randomly, maybe sometimes dirt on the ground and something like that. The same problem with bigger dungeons.
My idee: Creating a second map with caves, dungeons, villages and other big stuff and save them. When the chunk is creating, it also load the save of the second map.
Please help!
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?
I don't know if this belongs in Projects and Demos.
Anyway, that has a LOT to do with several things: how many caves you want; what you want them to look like; etc.
This article might help for generating the "cave" part. As for the land generation, I can't find anything too useful, but most of it has to be "custom" to how you want it to be, from my understanding.
Anyway, that has a LOT to do with several things: how many caves you want; what you want them to look like; etc.
This article might help for generating the "cave" part. As for the land generation, I can't find anything too useful, but most of it has to be "custom" to how you want it to be, from my understanding.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
Re: how to create an 2d block-world?
It's a Project of me.davisdude wrote:I don't know if this belongs in Projects and Demos.
Anyway, that has a LOT to do with several things: how many caves you want; what you want them to look like; etc.
This article might help for generating the "cave" part. As for the land generation, I can't find anything too useful, but most of it has to be "custom" to how you want it to be, from my understanding.
The caves should look like Minecraft, only 2d.
I can't create caves wich goes over some chunks.
On the page of this link is a methode, but I can't use it...
- Sheepolution
- Party member
- Posts: 264
- Joined: Mon Mar 04, 2013 9:31 am
- Location: The Netherlands
- Contact:
Re: how to create an 2d block-world?
This board is to show what you made. If you need help with what you're making, you post it on Support and Development.Luke100000 wrote: It's a Project of me.
- DaedalusYoung
- Party member
- Posts: 413
- Joined: Sun Jul 14, 2013 8:04 pm
Re: how to create an 2d block-world?
Use love.math.noise to create your caves. This will give you simplex noise, similar to what Minecraft uses/used to use to create terrain.
Re: how to create an 2d block-world?
Sounds like the link Davisdude posted should be of some use to you.
Also check out this which was used by a fellow love2d user to create this module.
Also check out this which was used by a fellow love2d user to create this module.
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
Re: how to create an 2d block-world?
Thanks, this is cool, but I want a generator who can create some chunks now and some chunks maybe tomorow and create another part of the same cave.Jampiles wrote:Sounds like the link Davisdude posted should be of some use to you.
Also check out this which was used by a fellow love2d user to create this module.
love.math.noise is not math.random, isn't? When I say print(love.math.noise(1,1)) it returns the same value when I type print(love.math.noise(1,1)) another time?Use love.math.noise to create your caves. This will give you simplex noise, similar to what Minecraft uses/used to use to create terrain.
I think, this was what I wanted.
oh. Ok, next time I will know where I ask my questions.Luke100000 wrote:It's a Project of me.
This board is to show what you made. If you need help with what you're making, you post it on Support and Development.
Re: how to create an 2d block-world?
You are right. love.math.noise is deterministic. That means each time you call it with the same input, you will get the same output. For your purpose this is probably the easiest way to introduce "random but reproducible" noise.Luke100000 wrote:love.math.noise is not math.random, isn't? When I say print(love.math.noise(1,1)) it returns the same value when I type print(love.math.noise(1,1)) another time?
I think, this was what I wanted.
Check out my blog on gamedev
Re: how to create an 2d block-world?
It should still be under support and development. You don't have anything to show yet. Yet.Luke100000 wrote:It's a Project of me.
You could just subtract blocks from a certain area to make the cave.Luke100000 wrote:I can't create caves wich goes over some chunks.
On the page of this link is a methode, but I can't use it...
As for your problem, this article seems to have an answer you want, but it's not in Lua.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Re: how to create an 2d block-world?
I just wanted to test myself how difficult it would be to generate a 2d block-world from love.math.noise. Here is what I came up with.
The .love is not interactive, but you can play around with the values in the source code:
In each point it simply uses the love.math.noise and checks if it is larger than a threshold. If so, then soil type 1 is assigned, otherwise it is soil type 2.The .love is not interactive, but you can play around with the values in the source code:
- You can play around with the values for the threshold. With it you can control how much of one soil type you have. It should be between 0 and 1.
- You can also change the scale factor, which controls how big the clusters are. You could even introduce two scale factors for x- and y-direction to create an anisotropic world.
- Also you can change the seed value. If you run the game with the same seed, you will always get the same field.
- Attachments
-
- randomBlock.love
- (452 Bytes) Downloaded 210 times
Check out my blog on gamedev
Who is online
Users browsing this forum: No registered users and 4 guests