Here's my new improved version of ripples 'n' lights. I've decided to go more with the "sit back and watch" approach, rather than having user input. The ripples appear randomly, and the camera pans around nicely. There's no media, so you can copy 'n' paste.
This was written in DBPro, but does work in DBC if you separate the lines out. I say 'work', it complained a lot more than DBPro did, about un-wrapped angles and divisions by zero. Eep. Also, in DBPro the stars on the background appear to have antialiasing, whereas in DBC they are just big squares in the sky.
Press spacebar to convert between wireframe and textured, and press enter to show and hide the info.
It almost didn't fit into the 20 lines, but then I figured out a way to optimize the light movement, it only takes 2 lines rather than 12!
I hope this works, it contains a few comparison operators which don't have a good history of working.
sync on:sync rate 60:hide mouse:autocam off:randomize timer()
create bitmap 1,256,256:cls rgb(255,255,255):get image 1,0,0,1,1:cls rgb(10,10,10):for i=1 to 200
ink rgb(255,255,255),0:dot int(rnd(256)),int(rnd(256)):ink rgb(100,100,100),0:dot int(rnd(256)),int(rnd(256)):next i:get image 2,0,0,256,256
set current bitmap 0:make object sphere 2,2000:position object 2,500,0,500:texture object 2,2:set object 2,1,0,0,2,0
make matrix 1,1000,1000,20,20:prepare matrix texture 1,1,1,1:dim ripple(2,4):dim light#(3,7):hide light 0
set ambient light 20:for i=1 to 3:make light i:light#(i,1)=int(rnd(1000)):light#(i,2)=int(rnd(1000))
light#(i,3)=int(rnd(16))*0.25:light#(i,4)=int(rnd(16))*0.25:light#(i,5)=int(rnd(16))*0.25:next i:message$="Ripples 'n' Lights, by The Darthster":txt1#=int(rnd(16))*0.25
txt2#=int(rnd(16))*0.25:txt3#=int(rnd(16))*0.25:txton#=1:do:a#=wrapvalue(a#+0.2)
if spacekey()=1 and pressed#=0:pressed#=1:if matrix wireframe state(1)=1:set matrix wireframe off 1:else:set matrix wireframe on 1
endif:endif:if spacekey()=0:pressed#=0:endif:if returnkey()=1 and pressedt#=0:pressedt#=1:if txton#=1
txton#=0:else:txton#=1:endif:endif:if returnkey()=0:pressedt#=0:endif:lighta#=wrapvalue(lighta#+0.1)
for i=1 to 3:light#(i,6)=light#(i,6)-((light#(i,1)-500)/abs(light#(i,1)-500)):light#(i,7)=light#(i,7)-((light#(i,2)-500)/abs(light#(i,2)-500)):light#(i,1)=light#(i,1)+light#(i,6):light#(i,2)=light#(i,2)+light#(i,7)
set point light i,light#(i,1),200,light#(i,2):color light i,rgb(abs(sin(wrapvalue(lighta#*light#(i,3)))+1)*127,abs(sin(wrapvalue(lighta#*light#(i,4)))+1)*127,abs(sin(wrapvalue(lighta#*light#(i,5)))+1)*127):next i:if int(rnd(20))=1:if ripple(1,4)=0:ripple(1,1)=int(rnd(1000))
ripple(1,2)=int(rnd(1000)):ripple(1,3)=0:ripple(1,4)=1:else:if ripple(2,4)=0:ripple(2,1)=int(rnd(1000))
ripple(2,2)=int(rnd(1000)):ripple(2,3)=0:ripple(2,4)=1:endif:endif:endif:for k=1 to 2:if ripple(k,4)0
ripple(k,3)=wrapvalue(ripple(k,3)-5):ripple(k,4)=ripple(k,4)+1:if ripple(k,4)=151:ripple(k,4)=0:endif:endif:next k:for i=0 to 20
for j=0 to 20:for k=1 to 2:if (sqrt((((i*(1000/20))-ripple(k,1))^2)+(((j*(1000/20))-ripple(k,2))^2)))(ripple(k,4)*5)-540:height#=height#+sin(2*(ripple(k,3)+sqrt((((i*(1000/20))-ripple(k,1))^2)+(((j*(1000/20))-ripple(k,2))^2))))*((150-ripple(k,4))/5):endif:next k:set matrix height 1,i,j,height#
height#=0:next j:next i:update matrix 1:position camera 500+(sin(a#)*500),110+(sin(a#)*90),500+(cos(a#)*500):point camera 500,50,500:zrotate camera wrapvalue(sin(a#)*30)
if txton#=1:ink rgb(abs(sin(wrapvalue(a#*txt1#))+1)*127,abs(sin(wrapvalue(a#*txt2#))+1)*127,abs(sin(wrapvalue(a#*txt3#))+1)*127),0:for i=1 to len(message$):text 100+(sin((a#+(i*2))*10)*5)+(i*8),100+(cos((a#+(i*2))*10)*5),mid$(message$,i):next i:endif:sync
loop
By the time you read this you should be able to get it (the .exe) at
http://www.mikeyben.org:5432/darkb/rnl3.zip
Once I was but the learner,
now, I am the Master.