• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Marron

Minecraft Terrain Generator

7 posts in this topic

Hello !

 

I have recently seen a video on YouTube showcasing a bit of play-around with MineCraft's terrain generator:

https://www.youtube.com/watch?v=oLnz640_LDk

 

Can someone give me some guide-lines on creating a voxel terrain generator similar to MineCraft's ? I have searched a ton on Google, but nothing I found explained 'noise' noise 'lerp' or how to use them to get a MineCraft-like terrain generator. Any guidelines would be helpful.

 

 

Anticipated thanks.

 

 

0

Share this post


Link to post
Share on other sites

The idea of using noise to generate game terrain has been around for a while and making it look decent is one of the most challenging and in my mind, rewarding task I have encountered in game programming.

 

http://freespace.virgin.net/hugo.elias/models/m_perlin.htm has a very good introduction into what fractal Brownian motion (the page has it wrong) is, and how you can make it with examples in simple pseudo-code. Take note of the idea of using several 'octaves' of the same noise signal and summing them with different amplitudes. If you consider higher frequency noise (lots of changes for a small change in sample position) you can consider that to make rough/spikey ground. If you consider the lower frequency noise (much less change for large change in sample position) then this gives a very smooth terrain on the same scale. If take the low frequency noise and multiply it with a large number, you would get mountains and valleys, then by adding a small amount of higher frequency noise you would get smaller details in the mountains like small bumps. If you do this with enough octaves with appropriate amplitude values you can generate interesting looking terrain.

 

A similar technique called the Diamond-square algorithm can also be used to generate interesting terrain (I prefer this for the close in detail). An example can be found at

http://www.gameprogrammer.com/fractal.html. An iteresting thing to note about this one is that if you set the first level or two's values, you can force the algorithm to fill in the blanks of a terrain which you have set the vague shape of. That is if you lowered some of the points, a valley/river/depression would be formed there and the close in detail will be randomly generated for you. Using this idea you could actually use the perlin noise above to generate set heights for every kilometer for example, then use diamond squares to fill in the higher resolution details down to 1m scale.

 

In the end, generating whatever kind of terrain you want is all about combining different types or noise and how you choose to use the values they generate. Making it look good is the result of fine tuning the amplitudes, roughness factors, scales, etc. until you get something that looks appropriate and can be used in your environment.

 

Edit'd to stop perpetuating the fractal Brownian motion/perlin noise mistake. Thanks Bacterius.

 

-BiT

Edited by RnaodmBiT
2

Share this post


Link to post
Share on other sites

The idea of using noise to generate game terrain has been around for a while and making it look decent is one of the most challenging and in my mind, rewarding task I have encountered in game programming.

 

 

If you are doing it realtime, it can be really challenging. Otherwise, just go nuts.

The hardest thing for me was always making this kind of world look good when rendered. So few resources, so many vertices and so much stuff you can't know is hidden until one frame later.

Otherwise, I just try to one thing at a time, or I will go insane.

Good luck with all your projects, and just message me if you want to talk about procedural generation things. Not that I know what I'm doing or anything.

 

At least it looks ok http://fbcraft.fwsnet.net/morning.png but the FPS is really bad.

 

Anyways,

the first thing to do when doing terrain generation is to make 2 steps:

 

1. create a function that returns an ID for each integral (x, y, z)

this is the procedural generation function, unless you aren't doing things realtime, in which case you can do several steps including volumetric fills etc for lakes

you basically use noise to generate density, and where density is < 0 add dirt (or stone, preferrably dirt as we will see later), otherwise AIR

if the value was AIR but the Y coordinate value was less than WATERLEVEL (eg. 64 blocks) just return water instead

 

2. postprocess the terrain from top to bottom to make it natural

start at the top, for each air block all the way down you have "atmospheric light" with you, so any dirt turns into grass

after you hit ground after a certain amount of blocks you should fake pressure by converting dirt into stone so that the world is layered

you can use noise here to emulate pressure differences

 

before postprocess create a 2d noise value:

use to create some variance in the seabed height, so that some green terrain is underwater, and other places have long beaches

use to create some forest boundries, use the inverse to add more dense ground foliage.

looks very natural now

 

use volumetric fill on randomly picked stones to quickly add minerals

 

3. Realize too late that the world scale is all wrong

My world is basically a giants version of a real world (I guess?) which makes it look really small when high up.

World scale is important! And don't write your generator in a dead language, like me.

 

I have collected some useful noise functions in my (new) generator (which doesn't generate anything yet):

https://github.com/fwsGonzo/generator/tree/master/terrain/noise

Edited by Kaptein
1

Share this post


Link to post
Share on other sites
http://freespace.virgin.net/hugo.elias/models/m_perlin.htm has a very good introduction into what perlin noise is, and how you can make it with examples in simple pseudo-code. Take note of the idea of using several 'octaves' of the same noise signal and summing them with different amplitudes. If you consider higher frequency noise (lots of changes for a small change in sample position) you can consider that to make rough/spikey ground. If you consider the lower frequency noise (much less change for large change in sample position) then this gives a very smooth terrain on the same scale. If take the low frequency noise and multiply it with a large number, you would get mountains and valleys, then by adding a small amount of higher frequency noise you would get smaller details in the mountains like small bumps. If you do this with enough octaves with appropriate amplitude values you can generate interesting looking terrain.

 

Note this isn't Perlin noise, but fractal brownian motion (abbrv. fBm). It's often joked that this page is probably the source of most confusion regarding Perlin noise. Fractal brownian motion can still be used towards the same goal (creating nice procedural landscapes, etc..) but just keep in mind the author is mislabeling the algorithm he is describing, so you don't perpetuate the mistake smile.png

0

Share this post


Link to post
Share on other sites

 

 

 

Note this isn't Perlin noise, but fractal brownian motion (abbrv. fBm). It's often joked that this page is probably the source of most confusion regarding Perlin noise. Fractal brownian motion can still be used towards the same goal (creating nice procedural landscapes, etc..) but just keep in mind the author is mislabeling the algorithm he is describing, so you don't perpetuate the mistake smile.png

 

 

fbm is really good for creating terrain types, like http://jpdict.ath.cx:8181/files/biome2d.png

 

I also invented my own noisetype that is probably really bad, but worked out in some cases:

http://fbcraft.fwsnet.net/cnoise_v2_2.png

0

Share this post


Link to post
Share on other sites

I also invented my own noisetype that is probably really bad,...

I like it. Your screenshots look nice.

Here some additional resources. JTippets has a couple of journal entries about Minecraft style terrain generation:

http://www.gamedev.net/blog/33/entry-2227887-more-on-minecraft-type-world-gen/
http://www.gamedev.net/blog/33/entry-2249106-more-procedural-voxel-world-generation/

He uses his self-rolled noise library:

http://accidentalnoise.sourceforge.net/

Comes with a nice LUA interface. IIRC he even has an example script for such terrain.

Alternatively, there's this noise library:

http://libnoise.sourceforge.net/

If speed is a problem, it is of course possible to generate noise on the GPU (don't know of any library, though).
0

Share this post


Link to post
Share on other sites

I would also like to mention the use of sampling a 3D noise function using fBm sampling to generate a 'density' function (even just combining several 2D samples can look good). If you then subtract a threshold value from the function you can say that any where the density is less than 0, you have open space and larger than 0 indicates solid ground. This can be used to generate voxel fields or as input for the marching cubes algorithm to generate some nice terrain with the advantage of the ability to specify open spaces 'under ground', ie. caves.

 

-BiT

1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0