How do I Random Islands Generator

Get help using Construct 2

» Thu Mar 30, 2017 5:02 am

I wanted to know how to create a simple system for generating random islands.
Like this image, for example:

B
16
S
5
G
1
Posts: 37
Reputation: 1,632

» Thu Mar 30, 2017 6:39 am

It is not so easy.
Two main approach is to use or a noise-based techniques or if you are more advanced - polygonal techniques.
this noises good for map generating.

You can can reed some useful stuff here:
http://www.redblobgames.com/articles/no ... ction.html
http://www.redblobgames.com/
http://www-cs-students.stanford.edu/~am ... eneration/

One way (and probably the most easy way) to implement it:
*Create two dimensional array the size of your map (lets say 2000 horizontally by 1000 vertically),
*Assign there random values (lets say from -10 to 20).
*Smooth the surface values: the stronger the smooth you will have less islands and but more pretty shapes, if weaker - more islands, more chaotic surfaces.
*One way to smooth the surface - make same size 2000x1000 array, and assign there values for each point as a average of a point and the 8 near points of the original array in the end copy the second array into the original, to get smoother surface - repeat the process multiple times.
*Determine that values from -10 to 0 it is water, 0 to 10 it is land, 10 to 20 is hills.
*Make function to show the surface of certain area.
B
65
S
32
G
6
Posts: 126
Reputation: 8,098

» Thu Mar 30, 2017 12:19 pm

I would say it's easier than people think - but only once you've gotten your head around arrays! You might find one of my templates useful, or for inspiration you can try this demo I released on Scirra Arcade recently:

It's a bit broken, as you can't easily use multi-line displays on the Arcade - however, you can paste into the input panel on the left from your notepad of choice.