A Flash Developer Resource Site

# Thread: Fractal Based Terrain - how would you attempt it?

1. http://www.gameprogrammer.com/fractal.html

down near the middle of the page, it discusses how you would create such terrain..

how would you set it up in flash?

just set how many divisions of the ground to make, then put a lot of numbers into arrays?

lets say you started with a multidimensional array called terrain, the 1st dimension stores a list of arrays, which contain the Y coordinated you use to buildthe land.. would this be an ideal way to set it up?

the page suggests putting random numers into the 1st array, then finding the midpoint between each point, etc etc.. my idea would be to put each new set of midpoints + the previous midpoints + the original, into the new arrays, so say terrain[0][0] contained 3 points, the next would contain 5 (2 midpoints + originals), the next would have 9, etc.

my Array manipulating skills arent so great .. so do you think you guys could help me with a function to get the midpoints into a new array? or am i thinking about this in an overly complicated way?

2. I read that link a little. I can not understand all of them. Anyway, I know he pick 4 cornors and a peak. Then diagonal and then edge.....etc.

If we want 16x16 terrain, we set random values for 4 corners and a central peak. Then we pick the points that row%8==0 and col%8==0; The next pass will be pick points that row%8==4 and col%8=4; (the module equals half of the width); Repeat this procedures but now row%4==0 and the next step row%4==2;(again, module equals half of the width);

The next problem is what values should be sum-ed and averaged ? It is different between edge point and diagonal points. But, if you see that box for hours, you will smell a fish and got the rules.

I would create a whole 16x16 array. And pick data and calculate them. To modify the dimension of array seems complicated.

I just make it work but slow. Maybe you can improve the speed.

http://dr_ericlin.tripod.com/forum/terrainF5.html
http://dr_ericlin.tripod.com/forum/terrainF5.zip

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap