This is primarily a small project to help me get accustomed to basic c++ before i move onto more complex bits of it. Mnemonix is helping me convert my code to a usable DLL.
this is a DLL that generates fractal heightmaps using the "plasma" or "diamond-square" algorithm. needs to be placed in the
compiler/plugins-user folder.
commands so far:
ft generate heightmap a,b,c,d,size
-> a,b,c and d are the height values of the 4 corners, which are used to generate the rest of the terrain
-> size must be a base 2 number, ie ...64,128,256...
ft get height(x,y)
-> returns height value at co-ordinates of the map.
ft set seed(float)
-> sets the initial variation limit between the max and min height values of the terrain. It is recommended that the value is approximately double that of the average height value of the 4 corners.
ft set fallout(float)
-> sets the rate at which the seed value is decreased per pass. recommend 0.3 to 0.5. anything over 1 will generate craaaazy results.
example code:
#constant mapsize 64
FT set seed 1000
FT set fallout 0.4
sync rate 60
FT generate heightmap rnd(255),rnd(255),rnd(255),rnd(255),mapsize
make matrix 1,1000,1000,mapsize,mapsize
for s=0 to mapsize
for t = 0 to mapsize
set matrix height 1,s,t,FT get height(s,t)/3
next t
next s
update matrix 1
do
control camera using arrowkeys 0,10,10
sync
loop
Next up will be a commands to set the spikiness of the terrain, otherwise known as the "h-constant", and also a smooth terrain function.
updates:
march 10th: added FT to start of each command to save confusion. Added commands "set fallout" and "set seed". Mnemonix fixed a potential memory leak issue.