I wanted to do something unusual to me (working on a space simulator) and decided to do something with these terrains.
A Unity Terrain in work.
These terrains are mainly used to create game levels with an open-world (sort of).But assigning variables like Terrain.terrainData to a terrain data (Captain Obvious) allows switching to other level without loading screens. So, I decided to generate those TerrainData's with a Perlin Noise (That's a noise with random illusion, like world generation in Minecraft, Seems random, but in fact worlds have seed values, and when you create two worlds with the same seeds, they will be the same.)
Here is a kind of this thing, but here we do have a Multiplier, X seed, Y seed and height*. So, entering these 4 values instead of randoms will result in exactly equal terrains, no matter what you do.
Okay, ready with theory, let's do that!
It's a pretty easy code, but it's hard to get what does what.So comments are required to navigate in such of code.
First of all, we generate random (absolutely random) values for our seed variables, except of width and length of the world.
Then we generate a heightmap of a perlin noise function.And then just applying it to our terrain using Terrain.terrainData = our heightmap.
P.S.The method doesn't involves heightmap images, it uses an array of height floats instead.
The result you already seen.
Thanks, JetFly.
@randomusername no, you can download only assets that have been uploaded using your version and below, but nowadays almost all assets that can work in unity 4 are shared with unity 5 or 2018. But updating only for 6 png's is a stupid decision
@randomusername When i want juat a skybox, it wants me to update.Update just for 6 .png's!6 PNG FILES, omg you need an update! (I use Unity 4.1.2 because of PC limitations)
@randomusername I hate Unity just because this asset store
@WNP78 aaah, missed one "=" sign
it needed to be JetFly,longStoryShort(1) == "blahblahblah"
@JetFly I'm just on about the title xD
@WNP78 but it works
random.range is a method too
But you can assign to it
Cool stuff
@WNP78 I was thinking the same thing, it couldn't be an array so what would it be? lol
Also you can't assign to the result of a method xD
I played around with procedural terrain a while ago. I never finished it because I moved on to other projects first. I had fairly decent speed on a PC with the terrain generating in the background. Here's some images of what it's like. Note that the biomes are quite small. They are scaled down so I don't have to spend ages flying between them across tiles to see them all. Also the mountains look pretty horrible :\
@PhantomBladeCorp Yes, that's pretty easy, but settings are really mad.
P.S. Made on Unity 4.2.0
I've actually seen a tutorial on YT where a guy explained this very well and even showed it off on spot. It's not as hard as it seems, though the setting up part left me a bit in the air, I have to admit :)
Also, I had idea on generating infinite world's by changing seed in real time.But, as I says before, generation takes five seconds.
@randomusername @Roswell
Terrain generation on Android will be very battery consuming and long, because even on PC generation takes around five seconds.
If u are masochist, then yes, it's possible.
And no, I'm not going to upload it, because maybe yes.
Android definitely not, I don't want to download Eclipse and mess with input to generate an APK once in my life.
Sorry guys.
Two questions :1. are you going to upload it? :1. and will the map be for Android?