Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / What Am I Doing Wrong?!?!?!

Author
Message
Skybax
23
Years of Service
User Offline
Joined: 20th May 2003
Location: United States
Posted: 3rd Aug 2003 01:07 Edited at: 3rd Aug 2003 01:08
Could someone please give me some advice? No matter what code I add I can’t seem to do anything I want! I have made a ‘tree’ out of a cylinder and, like the castle model mentioned in the code below, it flashes on screen for a second and vanishes. I can’t figure out how to make things like waterfalls and streams for my matrix. I also have an ocean matrix and I've tried adding the code from the jetski demo but it doesn't work. I know I’m a novice, but I’m pretty good at understanding instructions. Please help me!

There is no king who has not had a slave among his ancestors, and no slave who has not had a king among his

Ph33r the Ringwraiths
Skybax
23
Years of Service
User Offline
Joined: 20th May 2003
Location: United States
Posted: 3rd Aug 2003 01:11
Could someone please give me some advice? No matter what code I add I can’t seem to do anything I want! I have made a ‘tree’ out of a cylinder and, like the castle model mentioned in the code below, it flashes on screen for a second and vanishes. I can’t figure out how to make things like waterfalls and streams for my matrix. I also have an ocean matrix and I've tried adding the code from the jetski demo but it doesn't work. I know I’m a novice, but I’m pretty good at understanding instructions. Please help me!


Forest Matrix:
rem Set EAX
set eax 16

rem Load castle
load object "CASTLE1.x",1

rem show
show object 1

rem This command will load a midi music file into number one
load music "Field.mid",1

rem Play the music that was loaded into number one
play music 1

Sync On
Sync Rate 24
Hide mouse
Backdrop on
Set camera range 1,5000

Fog on
Fog distance 300
Fog color RGB(128,128,499)
Color Backdrop RGB(128,128,499)

Rem make matrix
Make matrix 1,10000,10000,20,20

Rem texture matrix
Load image "creep02.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1

rem Randomize the matrix
randomize matrix 1,125
X#=5000
Z#=5000

Rem Main loop
Do
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)

Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,CameraAngleY#,10)
ZTest# = Newzvalue(Z#,CameraAngleY#,10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Downkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-180),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-180),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Leftkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Rightkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#+90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#+90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24)

Y# = Get ground height(1,X#,Z#)
Position Camera X#,Y#+50,Z#

Rem Refresh Screen
Sync
Loop

If Leftkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Rightkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#+90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#+90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

Ocean Matrix:
rem This command will load a midi music file into number one
load music "Last port of call.mid",1

rem Play the music that was loaded into number one
play music 1

Sync On
Sync Rate 29
Hide mouse
Backdrop on
Set camera range 1,8000

Fog on
Fog distance 200
Fog color RGB(128,128,499)
Color Backdrop RGB(128,128,499)


Rem make matrix
Make matrix 1,10000,10000,23,23

Rem texture matrix
Load image "water01.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1

rem Randomize the matrix
randomize matrix 1,125
X#=5000
Z#=5000

Rem Main loop
Do
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)

Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,CameraAngleY#,10)
ZTest# = Newzvalue(Z#,CameraAngleY#,10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Downkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-180),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-180),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Leftkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Rightkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#+90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#+90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24)

Y# = Get ground height(1,X#,Z#)
Position Camera X#,Y#+50,Z#

Rem Refresh Screen
Sync
Loop

If Leftkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Rightkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#+90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#+90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

There is no king who has not had a slave among his ancestors, and no slave who has not had a king among his

Ph33r the Ringwraiths
cypher
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 3rd Aug 2003 08:17
Well in order to get it to run, I had to delete a whole mess off "run on" code below the main loop. You had too many "endif" statements also, it would not even compile. But hey, no worries.

I added a resolution command and since I don't have your castle file nor do I know where the castle was supposed to be located, I added a simple box for point of reference, You will also note I rem'd out all of the other media command instead of deleting them.

What you now have is a camera action just as you intended with a box appearing directly in front of you. I also added X# and Z# location identifiers, simply printing them to the screen. I find this useful when building a 3D scene so I can "see" where I am in relation to the world or where I think something should be.
Your object disappears just as my box first did because as the world rotated it moved passed the camera range.

If your intention is to build a kick ass FPS, take a look at Kensupen's FPS with sliding collision detection built in...check it here;
http://www.darkbasicpro.com/apollo/view.php?t=10315&b=6

Below is your code edited...hope it helps.
Cypher


rem <<<<==================================>>>>
set display mode 1024,768,16
rem Load castle
make object box 1,500,300,100
position object 1,5000,20,6000
rem show
rem show object 1

rem This command will load a midi music file into number one
rem load music "Field.mid",1

rem Play the music that was loaded into number one
rem play music 1

Sync On
Sync Rate 24
Hide mouse
Backdrop on
Set camera range 1,10000

remstart
Fog on
Fog distance 300
Fog color RGB(128,128,499)
Color Backdrop RGB(128,128,499)
remend

Rem make matrix
Make matrix 1,10000,10000,20,20

Rem texture matrix
rem Load image "creep02.bmp",1
rem Prepare matrix texture 1,1,1,1
rem Fill matrix 1,0,1

rem Randomize the matrix
rem randomize matrix 1,125
X#=5000
Z#=5000

Rem Main loop
Do
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)

Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,CameraAngleY#,10)
ZTest# = Newzvalue(Z#,CameraAngleY#,10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Downkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-180),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-180),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Leftkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Rightkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#+90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#+90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24)

Y# = Get ground height(1,X#,Z#)
Position Camera X#,Y#+50,Z#
set cursor 20,20
print "X#",X#
set cursor 20,60
print "Z#",Z#

Rem Refresh Screen
Sync
Loop

cypher
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 3rd Aug 2003 08:22
BTW, are you using DBC or DBP?

UnderLord
22
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 3rd Aug 2003 09:55 Edited at: 3rd Aug 2003 10:10
lol i was just about to edit his code myself untill i saw the above post im still quite new to DB my self but i saw what he did wrong but i dident see and the nedif commands ect... i just saw that he used a whole new code for his ocean....never have to do that heh....

the code cypher wrote won't show the ground it will show the matrix but not the textures this is a easy one though remove some of the rems but here i did it for you

rem <<<<==================================>>>>
set display mode 1024,768,16
rem Load castle
make object box 1,500,300,100
position object 1,5000,20,6000
rem show
rem show object 1

rem This command will load a midi music file into number one
rem load music "Field.mid",1

rem Play the music that was loaded into number one
rem play music 1

Sync On
Sync Rate 24
Hide mouse
Backdrop on
Set camera range 1,10000

remstart
Fog on
Fog distance 300
Fog color RGB(128,128,499)
Color Backdrop RGB(128,128,499)
remend

Rem make matrix
Make matrix 1,10000,10000,20,20

Rem texture matrix
Load image "creep02.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1

rem Randomize the matrix
rem randomize matrix 1,125
X#=5000
Z#=5000

Rem Main loop
Do
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)

Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,CameraAngleY#,10)
ZTest# = Newzvalue(Z#,CameraAngleY#,10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Downkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-180),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-180),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Leftkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

If Rightkey()=1
XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#+90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#+90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif

Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24)

Y# = Get ground height(1,X#,Z#)
Position Camera X#,Y#+50,Z#
set cursor 20,20
print "X#",X#
set cursor 20,60
print "Z#",Z#

Rem Refresh Screen
Sync
Loop

http://ww.freewebs.com/independant
Skybax
23
Years of Service
User Offline
Joined: 20th May 2003
Location: United States
Posted: 4th Aug 2003 07:21
Thank you very much! It runs much better now!

There is no king who has not had a slave among his ancestors, and no slave who has not had a king among his

Ph33r the Ringwraiths
Skybax
23
Years of Service
User Offline
Joined: 20th May 2003
Location: United States
Posted: 4th Aug 2003 07:33
I still can't figure out how to make rivers or forest, though... Very puzzling....

There is no king who has not had a slave among his ancestors, and no slave who has not had a king among his

Ph33r the Ringwraiths
UnderLord
22
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 5th Aug 2003 03:21
for rivers you'd need water....then you'd need like a "shoreline" on each side if you will and then just put the water in the shore line what one company did called "mind ark" was they just put the water under the ground so everytime the ground goes below the water then they have made a river or ocean...im sure theres some code around here somewhere to help you out with that.

for a forest you'll need to have a image of a tree i suppose or make a tree using primitive objects then try and mold it i don't know if that will work but its worth a try...i can't give you any code becuase i havent done anything like that yet...

http://www.freewebs.com/independant
Skybax
23
Years of Service
User Offline
Joined: 20th May 2003
Location: United States
Posted: 6th Aug 2003 01:19
Ok...I'll be on the lookout for code like that, thanks!

There is no king who has not had a slave among his ancestors, and no slave who has not had a king among his

Ph33r the Ringwraiths
John H
Retired Moderator
23
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 6th Aug 2003 08:07
Forests would just be a bunch of objects, and some fogging would add a nice effect. For a river just lower some matrix points and add a ghosted plain textured with water above where the points are lowered

RPGamer

Current Project: Eternal Destiny
Porting all files to my new computer
Skybax
23
Years of Service
User Offline
Joined: 20th May 2003
Location: United States
Posted: 7th Aug 2003 00:49
Quote: "For a river just lower some matrix points and add a ghosted plain textured with water above where the points are lowered "


How would I do that?

There is no king who has not had a slave among his ancestors, and no slave who has not had a king among his

Ph33r the Ringwraiths
Skybax
23
Years of Service
User Offline
Joined: 20th May 2003
Location: United States
Posted: 7th Aug 2003 00:53
RPGamer: BTW, your game looks very cool!

There is no king who has not had a slave among his ancestors, and no slave who has not had a king among his

Ph33r the Ringwraiths
UnderLord
22
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 7th Aug 2003 04:38
to lower matrix points you'd have to have some kind of code to tell where to lower the points at and how far or you could try and make your own matrix and make a river bed doing that then add the water in once you put the matrix you made in game of course im not to sure becuase im still a noob trying to help a noob and rpggamer would know more about it =P

http://www.freewebs.com/independant

Login to post a reply

Server time is: 2026-07-07 01:53:07
Your offset time is: 2026-07-07 01:53:07