2
\$\begingroup\$

I'm trying to generate random terrain for my game (In Unity3D, C#). All I need is water and grass. No height to it (no mountains or hills.) I'd preferably like to do it by placing individual cubes. On top of that the terrain needs to be infinite.

I've searched every where for even a hint on how to do it, but everything I found had either height to it, didn't use individual cubes (edited the terrain as a whole), or wasn't infinite.

Any help would be much appreciated! :)

EDIT: I'm looking for something somewhat similar to a game called Factorio. Here's a screenshot: http://i.ytimg.com/vi/Uns15OfPWbo/maxresdefault.jpg As you can see there is a big body of water, and a ton of land. I want to create something that randomly does that every time (random bodies of water and random land shapes). Something like Minecraft without all the height.

I've heard about something called Perlin noise, but because of a lack of tutorials and documentation, I can't figure out for the life of me on how to use it to generate random terrain.

\$\endgroup\$

closed as too broad by Anko, MichaelHouse Mar 21 '15 at 19:33

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ What I'd suggest is to use one of the algorithms you found that has height, and instead of using the height, set a threshold above which height the terrain is "grass", and which under that threshold the terrain is "water". \$\endgroup\$ – Alexandre Vaillancourt Mar 21 '15 at 17:55
  • \$\begingroup\$ This is quite a broad question. Could you indicate a little more precisely what sort of effect you're looking for? What have you tried, and in what way was it insufficient? \$\endgroup\$ – Anko Mar 21 '15 at 18:18
2
\$\begingroup\$

Check noise generation algorithms like simplex or perlin noise(http://en.wikipedia.org/wiki/Perlin_noise). By combining them you can create intricate fractal noise and by additional processing(like cutting by threshold) you will create distinctive feature maps for grass and lakes(and height maps. So you will definitely accomplish both tasks) to sample against by coordinates which is very handy if you are working with discrete elements like cubes or tiles. More information: https://stackoverflow.com/questions/6091468/how-is-a-3d-perlin-noise-function-used-to-generate-terrain There is nice question too about 2D noise generation: https://stackoverflow.com/questions/8659351/2d-perlin-noise

Btw, things can't be infinite because computing is limited by storage space and datatype resolution used by coordinate system.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.