Well, here you go:
rem Initialise Scene
set display mode 800,600,32
sync on : sync rate 30
position camera 0,0,-16
autocam off
hide mouse
backdrop on
color backdrop 0
set directional light 0,0,0,1
set ambient light 0
rem Create Atoms
dim atom#(20,6)
for i = 1 to 20
make object sphere i,0.5
color object i,rgb(192,128,255)
ghost object on i
ax#=rnd(360) : ay#=rnd(360)
x#=0 : y#=0 : z#=0 : dist#=(rnd(350)+30)*0.01
gosub CALC_Move
atom#(i,1)=x# : atom#(i,4)=x#*0.02
atom#(i,2)=y# : atom#(i,5)=y#*0.02
atom#(i,3)=z# : atom#(i,6)=z#*0.02
next i
rem Start Loop
do
rem Control Atoms
for i = 1 to 20
rem Apply Gravitational Effect
scale object i,100,100,100
for j = 1 to 20
if j<>i
point object i,atom#(j,1),atom#(j,2),atom#(j,3)
ax#=object angle x(i) : ay#=object angle y(i)
x#=0 : y#=0 : z#=0
dist#=(1/CALC_Distance(atom#(i,1),atom#(i,2),atom#(i,3),atom#(i2,1),atom#(i2,2),atom#(i2,3)))*0.002
gosub CALC_Move
atom#(i,4)=atom#(i,4)+x#
atom#(i,5)=atom#(i,5)+y#
atom#(i,6)=atom#(i,6)+z#
rem Check for Atom Collisions
if CALC_Distance(atom#(i,1),atom#(i,2),atom#(i,3),atom#(j,1),atom#(j,2),atom#(j,3))<0.2
x#=0 : y#=0 : z#=0 : dist#=0.5
gosub CALC_Move
atom#(i,4)=x# : atom#(j,4)=0-x#
atom#(i,5)=y# : atom#(j,5)=0-y#
atom#(i,6)=z# : atom#(j,6)=0-z#
scale object i,500,500,500
endif
endif
next i2
rem Stop Atoms from Straying too far
if CALC_Distance(atom#(i,1),atom#(i,2),atom#(i,3),0.0,0.0,0.0)>6
point object i,0,0,0
ax#=object angle x(i) : ay#=object angle y(i)
x#=0 : y#=0 : z#=0 : dist#=0.02
gosub CALC_Move
atom#(i,4)=(atom#(i,4)*0.8)+x#
atom#(i,5)=(atom#(i,5)*0.8)+y#
atom#(i,6)=(atom#(i,6)*0.8)+z#
endif
rem Final Atom Update
for j = 1 to 3 : atom#(i,j)=atom#(i,j)+atom#(i,j+3) : next j
position object i,atom#(i,1),atom#(i,2),atom#(i,3)
rotate object i,0,0,0
next i
rem End Loop
sync
loop
rem 3D Movement Calculation
CALC_Move:
Y#=Y#-(Dist#*sin(AX#))
Temp#=Dist#*cos(AX#)
X#=X#+(Temp#*sin(AY#))
Z#=Z#+(Temp#*cos(AY#))
return
rem 3D Distance Calculation
function CALC_Distance(x1#,y1#,z1#,x2#,y2#,z2#)
dist#=sqrt(((x1#-x2#)^2)+((y1#-y2#)^2)+((z1#-z2#)^2))
endfunction dist#
This has been made with DBClassic but will probably work with DBPro too. The original looks a bit better because I've used textured plains instead and you get a better view of the depth. I don't really mind if anybody uses this code for anything, but I'd like for you to tell me if you do use it. Thanks!
"I am a living, thinking entity who was created in the sea of information."