Pretty cool!
I managed to make some boiling water...
set display mode 800,600,32,1
sync on
sync rate 30
backdrop on
dim grid1(31,31):dim grid2(31,31):dim tempgrid(31,31):dim velocity(31,31):dim smoothed(31,31)
make matrix 1,4096,4096,32,32:set camera range 1,20000:position camera -512,2048,-512:point camera 2048,-1024,2048
do
for x = 1 To 30
for y = 1 To 30
velocity(x,y) = -grid2(X, Y)
smoothed(x,y) = (grid1(X - 1, Y) + grid1(X + 1, Y) + grid1(X, Y - 1) + grid1(X, Y + 1) + grid1(X + 1, Y - 1) + grid1(X - 1, Y + 1) + grid1(X - 1, Y - 1) + grid1(X + 1, Y + 1)) / 8
grid2(X, Y) = smoothed(x,y) * 2 + velocity(x,y)
grid2(X, Y) = grid2(X, Y) * 0.95
set matrix height 1,x,y,grid1(x,y)
next Y
next X
for x = 0 to 31
for y = 0 to 31
tempgrid(x,y)=grid2(x,y)
grid2(x,y)=grid1(x,y)
grid1(x,y)=tempgrid(x,y)
next y
next x
update matrix 1
if rnd(1)=1 then grid1(rnd(29)+1,rnd(29)+1)=-1024
sync
loop
I saw something like this on the codebase, hang on, I will find it.
Edit: Here it is:
DBP:
` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com
sync on
sync rate 60
backdrop on
color backdrop 0
make object sphere 1,15
hide mouse
xres=80
yres=80
make matrix 1,1000.0,1000.0,xres,yres
position camera 400,400,-200
point camera 400,-20,400
cls rgb(30,10,180)
get image 1,0,0,32,32
prepare matrix texture 1,1,1,1
rem make light 1
rem set point light 1,1000.0,800.0,20.0
rem color light 1,rgb(255,200,150)
set matrix 1,1,1,1,1,1,1,0
numwaves=10
dim wavepos(numwaves,2)
dim wavestage(numwaves)
wave=1
dim g#(3,xres,yres)
prev=1
current=2
future=3
sep#=1000/xres
repeat
position mouse 320,240
xpos=xpos+mousemovex()
ypos=ypos+mousemovey()
IF xpos<100 THEN xpos=100
IF xpos>900 THEN xpos=900
IF ypos<100 THEN ypos=100
IF ypos>900 THEN ypos=900
position object 1,xpos,10,1000-ypos
xspot=xpos/sep#
yspot=ypos/sep#
yspot=yres-yspot
IF click=-1 AND mouseclick()=0 THEN click=0
IF mouseclick()=1 and click>-1
click=1
ENDIF
IF click=1
IF wavestage(wave)<=0
wavepos(wave,1)=xspot
wavepos(wave,2)=yspot
wavestage(wave)=180
wave=wave+1
IF wave>numwaves THEN wave=1
click=-1
ENDIF
ENDIF
FOR n=1 TO numwaves
IF wavestage(n)>0
g#(current,wavepos(n,1),wavepos(n,2))=g#(current,wavepos(n,1),wavepos(n,2))+sin(wavestage(n))*150
wavestage(n)=wavestage(n)-30
ENDIF
NEXT n
prev=prev+1
current=current+1
future=future+1
if prev>3 then prev=1
if current>3 then current=1
if future>3 then future=1
for x=2 to xres-1
for y=2 to yres-1
g#(future,x,y)=(g#(current,x-1,y)+g#(current,x+1,y)+g#(current,x,y-1)+g#(current,x,y+1))/2-g#(prev,x,y)
g#(future,x,y)=g#(future,x,y)*0.98
next y
next x
for x=1 to xres
for y=1 to yres
set matrix height 1,x,y,g#(future,x,y)
next y
next x
box 10,10,20,rnd(30)
update matrix 1
sync
until 1=2
DBC:
` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com
sync on
make object sphere 1,15
hide mouse
xres=50
yres=50
make matrix 1,1000.0,1000.0,xres,yres
position camera 400,400,-200
point camera 400,-20,400
cls rgb(30,10,180)
get image 1,0,0,32,32
prepare matrix texture 1,1,1,1
make light 1
set point light 1,1000.0,800.0,20.0
color light 1,rgb(255,200,150)
set matrix 1,0,1,1,1,1,1,0
numwaves=10
dim wavepos(numwaves,2)
dim wavestage(numwaves)
wave=1
dim #g(3,xres,yres)
prev=1
current=2
future=3
sep#=1000/xres
repeat
position mouse 320,240
xpos=xpos+mousemovex()
ypos=ypos+mousemovey()
IF xpos<100 THEN xpos=100
IF xpos>900 THEN xpos=900
IF ypos<100 THEN ypos=100
IF ypos>900 THEN ypos=900
position object 1,xpos,10,1000-ypos
xspot=xpos/sep#
yspot=ypos/sep#
yspot=yres-yspot
IF click=-1 AND mouseclick()=0 THEN click=0
IF mouseclick()=1 AND click>-1
click=1
ENDIF
IF click=1
IF wavestage(wave)<=0
wavepos(wave,1)=xspot
wavepos(wave,2)=yspot
wavestage(wave)=180
wave=wave+1
IF wave>numwaves THEN wave=1
click=-1
ENDIF
ENDIF
FOR n=1 TO numwaves
IF wavestage(n)>0
#g(current,wavepos(n,1),wavepos(n,2))=#g(current,wavepos(n,1),wavepos(n,2))+sin(wavestage(n))*150
wavestage(n)=wavestage(n)-30
ENDIF
NEXT n
prev=prev+1
current=current+1
future=future+1
if prev>3 then prev=1
if current>3 then current=1
if future>3 then future=1
for x=2 to xres-1
for y=2 to yres-1
#g(future,x,y)=(#g(current,x-1,y)+#g(current,x+1,y)+#g(current,x,y-1)+#g(current,x,y+1))/2-#g(prev,x,y)
#g(future,x,y)=#g(future,x,y)*0.98
next y
next x
for x=1 to xres
for y=1 to yres
set matrix height 1,x,y,#g(future,x,y)
next y
next x
box 10,10,20,rnd(30)
update matrix 1
sync
until 1=2
Peachy, and the Chaos of the Gems