Still in need of a RIGGER!
Back to the forumHomeFAQMemberlistUsergroupsRegisterLog inSearch


 5 - Just Alittle Random

Go down 
CoreDev CEO
CoreDev CEO

Posts : 66
Join date : 2012-09-07
Location : Sydney, Australia

5 - Just Alittle Random Empty
Post5 - Just Alittle Random

Well upto the fifth blog post wow!

I have learned so much already just from teaching you guys/girls Smile

Now this is starting chapter 2.

In this chapter we will be looking at random terrain generation mostly, a fun playful thing.

This is how we dooooo it!

Alright, firstly I am going to show you a very basic example of how you could implement random generation within a chunk.

Open your project and your chunk script and in the CreateChunk function change the part that contains (line 22):

chunk[x,y,z] = 1;


chunk[x,y,z] = Mathf.Round(Random.Range(0.0,1.0));

I'm guessing you can figure out what this change does, just by playing the build. But I'll explain.
Firstly Mathf.Round rounds down the number to the nearest integer, we have this so that the block is still determined by "solid" or "air".
Random range then chooses a float between 0.0 and 1.0


As you can clearly see, this terrain is..... horrible. It needs to be smoother and much more interesting than just holes in the ground. This is where Simplex Noise comes in.

Now this is going to be a very hard chapter for me to write as I really have no idea on fractal, perlin or simplex noise. Thus I am probably going to make mistakes.

Where do we start

Well, there are two parts i can clearly see involved in creating a randomised terrain.

1. Generating the Values (Through Perlin, Simplex or Fractal Noise)

2. Applying the values (Reading and applying them to our chunk)

Let's work Backwards

Yes lets start with number 2.

We are firstly going to convert the Unity Procedual example's terrain from heightmap code to be voxel friendly.
Here :

By the end of this step we should be able to grab any random heightmap and turn it into a voxelised world.

So what we are aiming to do in this step is to make our chunk be able to accept a heightmap and generate a cubic world from its co-ordinates. On only one chunk.
More Coming Later!
Back to top Go down
View user profile
Share this post on: diggdeliciousredditstumbleuponslashdotyahoogooglelive

5 - Just Alittle Random :: Comments

No Comment.

5 - Just Alittle Random

Back to top 

Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
 :: Project Civil :: Voxel Engine Development Blog-
Jump to: