Hi,
I have just bought dark clouds and have been trying to implement it in a project i'm working on. I'm having issues with syncing.
no matter what I seem to do, I get a strobing effect where the clouds are rendered and then the scene with the matrix and objects is rendered with a blue back ground and for some reason a big arch in the sky. (image attatched)
In the current state, I have cut and pasted most of the dark clouds example code in order to try and get something to work. i've implemented it in the following sub routine
clouds:
Rem Project: DarkCLOUDSample
Rem Created: Sunday, June 28, 2009
rem Please wait
set text font "verdana" : s$="generating World...please be patient, this may take several minutes."
center text screen width()/2,screen height()/2,s$ : sync
load image "media\sunFlare.png",10
load image "media\Moon.png",11
load image "media\Rain.jpg",15
load image "media\Cirrus.jpg",21
load image "media\sunset.jpg",3
rem init app at 60fps
rem half-fill the sky with clouds
dc set cloudy .5
dc set auto brightness 1
dc init 1,10
rem add a high-altitude cloud layer
dc set cirrus clouds .5
dc set cirrus image 21
rem clouds at 3 km
dc set cloud height 8
rem set sky brightness to 1
brightness#=1.0
dc set brightness brightness#
rem adjust brightness based on time of day
dc set auto brightness 1
rem set wind to 30 mph at 270 degrees (heading west)
dc set wind 30,270
rem init with texture number 1, and number of keyframes per hour
dc init 1,5
rem modify rayleigh scattering(optional) default: 7,11,24
dc set scattering 7,11,24
rem a slightly yellow sun:
dc set sun color 1.0,1.0,0.9
rem starting at 6am
time#=6
rem the update command creates the cloud texture
dc update time#
rem show texture 1 as the backdrop
texture backdrop 3
rem draw the sun
dc set sun image 10,.2
rem draw the moon - three times!
dc set planet image 1,11,.2,1
dc set planet direction 1,0.0,0.2,1.0
dc set planet image 2,11,.15,1
dc set planet direction 2,0.9,0.4,-0.5
dc set planet image 3,11,.05,1
dc set planet direction 3,0.9,0.4,0.5
rem create rain (rain will only appear when clouds are heavy)
dc set rain 1,1
dc set rain image 15
sync
Return
Its exactly the example code, which works with the pelican object. but not with my project.
here is the entire project code to observe the problem and see if i'm doing something stupid.
Rem Project: Island
Rem Created: Sunday, February 06, 2011
Rem ***** Main Source File *****
rem // setup camera
gosub clouds:
randomize timer()
sync on
rem autocam off
rem // load images
load image "media\water1.jpg",1
load image "media\grassand.jpg",2
rem // declare variables
size = 10000
hills = 50
hillheight = 50
playerspeed = 6
viewdistance = size
Forestmax = 500
grassmax = 1
remstart
fog on
fog distance 800
fog color 30,30,30
remend
gosub matrixgen:
set camera range 0,1,viewdistance
rem // load pre existing objects
make object cube 1,1
position object 1,size/2,get ground height(1,size/2,size/2),size/2
rotate object 1,90,0,0
rem make object sphere 2, 0 - viewdistance
rem rotate object 2,0,180,0
rem texture object 2,3
rem set object cull 2,1
rem set object fog 2, 0
load object "media\billboard_tree1.x",4
load object "media\billboard_tree2.x",5
load object "media\billboard_tree3.x",6
load object "media\billboard_tree4.x",7
load object "media\billboard_tree5.x",8
load object "media\billboard_tree6.x",9
load object "media\billboard_tree7.x",10
load object "media\billboard_tree8.x",11
load object "media\billboard_tree9.x",12
load object "media\billboard_tree10.x",13
for t = 4 to 13 step 1
set object transparency T,6
next t
gosub makeisland:
rem gosub forest:
rem // main loop
do
gosub mouselook:
sync
time#=time#+20.0/(24.0*60.0*60.0)
dc update time#
sync
loop
Forest:
for Forest =14 to Forestmax step 1
clone object forest, (rnd(9)+4),1
scalex = rnd(100)+100
scaley = rnd(100)+100
scalez = rnd(100)+100
scale object forest ,scalex,scaley,scalez
repeat
treex = rnd(size)
treez = rnd(size)
treey = get ground height(1,treex,treez)
until treey > 20
position object forest,treex,(treey - (scaley/10)),treez
next forest
sync
return
makeisland:
for makeisland = 2 to hills-2 step 1
set matrix height 1,2,makeisland,rnd(10)+2
set matrix height 1,hills-2, makeisland,rnd(10)+2
set matrix height 1,makeisland,2,rnd(10)+2
set matrix height 1,makeisland,hills-2,rnd(10)+2
update matrix 1
next makeisland
for makeisland = 1 to hills-1 step 1
set matrix height 1,1,makeisland,2
set matrix height 1,hills-1, makeisland,2
set matrix height 1,makeisland,1,2
set matrix height 1,makeisland,hills-1,2
update matrix 1
next makeisland
for makeisland = 0 to hills step 1
set matrix height 1,0,makeisland,0 - rnd(10)
set matrix height 1,hills, makeisland,0 - rnd(10)
set matrix height 1,makeisland,0,0 - rnd(10)
set matrix height 1,makeisland,hills,0 - rnd(10)
update matrix 1
next makeisland
for makeisland = 0 to (hills -1) step 1
SET MATRIX TILE 1, 0, makeisland, 4
SET MATRIX TILE 1, hills -1, makeisland, 4
SET MATRIX TILE 1, makeisland, 0, 4
SET MATRIX TILE 1, makeisland, hills-1 , 4
update matrix 1
next makeisland
for makeisland = 1 to (hills -2) step 1
SET MATRIX TILE 1, 1, makeisland, 4
SET MATRIX TILE 1, hills -2, makeisland, 4
SET MATRIX TILE 1, makeisland, 1, 4
SET MATRIX TILE 1, makeisland, hills-2 , 4
update matrix 1
next makeisland
make matrix 2,size*2,size*2,50,50
position matrix 2, 0-(size/2), 0,0-(size/2)
prepare matrix texture 2,1,1,1
update matrix 2
sync
return
Matrixgen:
make matrix 1,size,size,hills,hills
prepare matrix texture 1,2,2,2
SET MATRIX TRIM 1, 0.02, 0.02
FILL MATRIX 1,1,1
Randomize matrix 1,hillheight
position matrix 1,0,0,0
update matrix 1
sync
return
mouselook:
if Keystate(17) = 1 then move object up 1,playerspeed
if Keystate(30) = 1 then move object left 1,playerspeed
if Keystate(31) = 1 then move object down 1,playerspeed
if Keystate(32) = 1 then move object right 1,playerspeed
if Keystate(17) = 1 and Keystate(30) = 1
move object up 1,playerspeed/2
move object left 1,playerspeed/2
endif
if Keystate(17) = 1 and Keystate(32) = 1
move object up 1,playerspeed/2
move object right 1,playerspeed/2
endif
if Keystate(31) = 1 and Keystate(30) = 1
move object down 1,playerspeed/2
move object left 1,playerspeed/2
endif
if Keystate(31) = 1 and Keystate(32) = 1
move object down 1,playerspeed/2
move object right 1,playerspeed/2
endif
x = object position x(1)
z = object position z(1)
y = get ground height (1,x,z) +10
if y <= -10 then y = 0
position object 1,x,y,z
position camera 0,x,y,z
rem position object 2,x,y,z
rem // tdks mouselook
CX#=Camera Angle X(): CY#=Camera Angle Y(): CZ#=Camera Angle Z()
If MType = 0
CY#=Wrapvalue(CY#+mousemovex())
CX#=Wrapvalue(CX#+mousemovey())
Else
CY# = CurveAngle(CY#+mousemovex(),CY#,10.0)
CX# = CurveAngle(CX#+mousemovey(),CX#,10.0)
Endif
Rotate Camera CX#,CY#,CZ#
rotate object 1,90,cy#,cz#
sync
return
clouds:
Rem Project: DarkCLOUDSample
Rem Created: Sunday, June 28, 2009
rem Please wait
set text font "verdana" : s$="generating World...please be patient, this may take several minutes."
center text screen width()/2,screen height()/2,s$ : sync
load image "media\sunFlare.png",10
load image "media\Moon.png",11
load image "media\Rain.jpg",15
load image "media\Cirrus.jpg",21
load image "media\sunset.jpg",3
rem init app at 60fps
rem half-fill the sky with clouds
dc set cloudy .5
dc set auto brightness 1
dc init 1,10
rem add a high-altitude cloud layer
dc set cirrus clouds .5
dc set cirrus image 21
rem clouds at 3 km
dc set cloud height 8
rem set sky brightness to 1
brightness#=1.0
dc set brightness brightness#
rem adjust brightness based on time of day
dc set auto brightness 1
rem set wind to 30 mph at 270 degrees (heading west)
dc set wind 30,270
rem init with texture number 1, and number of keyframes per hour
dc init 1,5
rem modify rayleigh scattering(optional) default: 7,11,24
dc set scattering 7,11,24
rem a slightly yellow sun:
dc set sun color 1.0,1.0,0.9
rem starting at 6am
time#=6
rem the update command creates the cloud texture
dc update time#
rem show texture 1 as the backdrop
texture backdrop 3
rem draw the sun
dc set sun image 10,.2
rem draw the moon - three times!
dc set planet image 1,11,.2,1
dc set planet direction 1,0.0,0.2,1.0
dc set planet image 2,11,.15,1
dc set planet direction 2,0.9,0.4,-0.5
dc set planet image 3,11,.05,1
dc set planet direction 3,0.9,0.4,0.5
rem create rain (rain will only appear when clouds are heavy)
dc set rain 1,1
dc set rain image 15
sync
Return
I'm not very knowledgeable on the subject of syncing and I think my problem lies therein.
My current understanding is that syncing pretty much redraws everything at the rate define by the sync rate.
but something is wrong and I don't know what. I've been going through and rearranging the sync commands in a trial and error process of elimination style effort, I just get tired of waiting a minute for it to load and seeing the same problem each time.
any help would be greatly apreciated
thankyou
kezzla
Sometimes I like to use words out of contents