| 06-30-2008, 05:40 AM | #1 |
Hokay. I've been poking around, and what i'm after is some form of algorithms or something which will generate a random island shape. Basically, i need something which will take square\grid placement X. It will then build an island (or polygon, if you want to look at it like that) of a random shape from that, i need to be able to control how many corners the island has and how many grid spaces wide\tall it can be at minimum and maximum. Anyone know anything that can help me, or can point me in the right direction? I've taken a look at some random polygon generating algorithms, but none of them look like they could be adapted to what i want. |
| 06-30-2008, 03:13 PM | #2 |
Use a fractal. Start with a square. Cut corners with random lengths. Add corners with random lenghs. Repeat (smaller). Check out the mountain range example on wikipedia. http://en.wikipedia.org/wiki/Fractal_landscape Code:
start with a square ----- | | | | | | | | ----- cut some outside corners ---- -| | | --| | | | | --- add some inside corners ---- -| | | -| | -| | | --- etc |
