the problem with shadows was solved. I should have chosen a video card.
I can't throw off the screen. I can't upload the program to the cloud.
Rem Project: spacesimgame
Rem Created: Sunday, March 29, 2020
Rem ***** Main Source File *****
rem Standard Setup Code for all examples
SET DISPLAY MODE 1024, 768, 32
SET WINDOW ON
MAXIMIZE WINDOW
SET WINDOW LAYOUT 0, 0, 0
sync on : sync rate 30
AUTOCAM OFF
`perform checklist for graphics cards
`SET GRAPHICS CARD cardstring$
PERFORM CHECKLIST FOR DISPLAY MODES
global numSpheres as integer : numSpheres = 5
global radius# as double float : radius# = 7.0
global littleRadius# as double float : littleRadius# = 2.0
global rtimer as integer
global stimer as integer
global vtimer as integer
rem player movement vector
global vx# as double float
global vy# as double float
global vz# as double float
global gravity# as double float : gravity# = -0.1
global slope# as double float : slope# = 0.5
global ground as integer : ground = 1
global jumptimer as integer : jumptimer = 0
`SET LIGHT RANGE 0, 100000
`POSITION LIGHT 0,1000, 2000, 1000
CLOUDP = 25
Dim OBJ( 7 )
RTS Set Auto Zoom 1.0
RTS Setup Skybox "RTS_MassiveMountain", 0
RTS Set Clock 3 , 0 , 1.0
RTS Set Wind Speed 0.0001, 0.00005
Set Camera Range 0,1 , 110000
Clear Camera View 0 , Rgb( 0 , 0 , 0 )
Position Camera 0 , 0 , 0
CLOUDS = RTS Get Loaded Object( 1 )
If CLOUDS = 0 Then End
makeLevel()
makePlayer()
load image "files\trees\tree1.dds",200
FOR T=2 TO 50
load object "files\trees\tree1.x",200+T
texture object 200+T,200
SET OBJECT TRANSPARENCY 200+T, 4
position object 200+T,RND(400)*10,500,-RND(400)*10
SET SHADOW SHADING ON 200+T
NEXT T
rem Cut-out view close-up
make camera 1
set current camera 1
set camera range 1,1000
set camera view 1,1024/2-48,768-48*2,1024/2+48,768
rem Setup main camera and light
set current camera 0
position camera 0,0,800,0
set camera range 1,7000000
make object box 500,5,5,5
make object sphere 600,100
position object 600,1000000,800,1000000
position object 500,0,800,0
REPEAT
Set Cursor 0 , 0
Print "Frame Rate : " , Screen Fps()
Print "View : " , XAngle , " / " , YAngle
Print "Real Time Hour : " , RTS Get Hour() , "h" , RTS Get Minutes() , "m" , RTS Get Seconds() , "s"
D$ = Inkey$()
CLOUDP = CLOUDP + ( D$ = "z" ) - ( D$ = "a" )
If CLOUDP < 0 : CLOUDP = 0 : Else : If CLOUDP > 100 : CLOUDP = 100 : Endif : Endif
MISTP = MISTP + ( D$ = "s" ) - ( D$ = "q" )
If MISTP < 0 : MISTP = 0 : Else : If MISTP > 100 : MISTP = 100 : Endif : Endif
RTS Set Cloud Density CLOUDP
RTS Set Mist Density MISTP
Print "Clouds, Mist : ", CLOUDP, " / ", MISTP
MovePlayer()
PRINT SCREEN FPS()
print "current display card name "+current graphics card$()
x#=CAMERA POSITION X()
y#=CAMERA POSITION y()
z#=CAMERA POSITION z()
print x#
print Z#
move camera 0,1
x1#=CAMERA POSITION X()
y1#=CAMERA POSITION y()
z1#=CAMERA POSITION z()
set current camera 1
POSITION CAMERA X#+1000000, Y#+800, Z#+1000000
POINT CAMERA X1#+1000000, Y1#+800, Z1#+1000000
PITCH CAMERA UP 1,-60
MOVE CAMERA 1,-30
set current camera 0
move camera 0,-1
positionCameraToObject()
RTS Update Skybox
sync
Until ESCAPEKEY() = 1
RTS Clear Skybox
end
function makeLevel()
cd "files"
load object "levelbank\level1\universe.dbo",100
cd ".."
sc_setupComplexObject 100,1,2
endfunction
function makePlayer()
make object sphere 200,10*2.0
position object 200,0,800,0
sc_setupObject 200,0,1
endfunction
function movePlayer()
rem rotate player with mouse
yrotate object 200,object angle y(200)+mousemovex()/3.0
xrotate object 200,object angle x(200)+mousemovey()/3.0
oldx# = object position x(200)
oldy# = object position y(200)
oldz# = object position z(200)
rem apply gravity, and user changes to movement
angy# = object angle y(200)
vx# = 0
vz# = 0
rem if player is jumping or falling then apply 'normal' gravity
rem if not attempt to keep the player stuck to the floor
if vy#=0 and jumptimer=0 then vy# = vy# + 10*gravity# else vy# = vy# + gravity#
if keystate(32)=1 then vx# = vx# + cos(angy#) : vz# = vz# - sin(angy#)
if keystate(30)=1 then vx# = vx# - cos(angy#) : vz# = vz# + sin(angy#)
if keystate(31)=1 then vx# = vx# - sin(angy#) : vz# = vz# - cos(angy#)
if keystate(17)=1 then vx# = vx# + sin(angy#) : vz# = vz# + cos(angy#)
rem only jump if on ground, and a certain time after last jump
if ground=1
if spacekey()=1 and jumptimer=0 then vy# = vy# + 3.0 : jumptimer = 20
endif
rem this would be the player's final position without collision
x# = oldx#+vx#
y# = oldy#+vy#
z# = oldz#+vz#
rem first handle gravity - seperated from horizontal movement
rem to achieve a more realistic effect
rem Method: simple - cast a sphere vertically down, if it hits the level then
rem position the object there (sticky collision) then move
rem on to horizontal movement
rem more complex - if we were to only use the simple method the player would be
rem allowed to climb almost vertical slopes. Alternative is to
rem get the normalY direction to work out how flat the gorund
rem below the player is, 0-slope# is flatter, slope#-1 is steeper.
rem if it's flat, use sticky collision, if it's steep slide the
rem player down the slope. Changing slope# determines how steep the
rem player can climb. NOTE: this also effects stairs.
collide = sc_SphereCastGroup(1,oldx#,oldy#,oldz#,oldx#,oldy#+vy#,oldz#,radius#,0)
if collide>0
rem how flat is this ground
ny# = sc_getCollisionNormalY()
if abs(ny#)>slope#
rem FLAT, stick
oldy# = sc_getStaticCollisionY()
else
rem STEEP, slide
x# = x# - oldx# : z# = z# - oldz#
oldx# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
oldz# = sc_getCollisionSlideZ()
x# = x# + oldx# : z# = z# + oldz#
endif
rem ny#<0 means the player has hit a ceiling rather than a floor
if ny#>slope#
rem only on ground if standing on flat ground
ground = 1
vy# = 0
else
ground = 0
rem if player has hit a flat ceiling then stop vy# movement
if ny#<-slope# then vy# = gravity#
endif
else
rem nothing below player, not on ground, add vertical speed to player
oldy# = oldy# + vy#
ground = 0
endif
rem jumptimer will decrease only when player is back on ground
rem creates a pause between two successive jumps
if ground = 1 and jumptimer>0 then dec jumptimer
rem handle horizontal movement as sliding
rem player only collides with group 1 (level) objs and moves freely through others
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,oldy#,z#,radius#,0)
if collide>0
rem if hit, reposition player, halt movement vector
x# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
rem possible code for giving the player a jumping help up stairs...
rem might be useful if slope# is set very high but stairs are still required
`dy# = oldy#-sc_getStaticCollisionY()
`if dy#<slope# and dy#>0 and ground=1 then vy# = 0.5
endif
rem position the player
position object 200,x#,oldy#,z#
sc_updateObject 200
endfunction
function positionCameraToObject()
position camera object position x(200),object position y(200),object position z(200)
rotate camera object angle x(200),object angle y(200),object angle z(200)
`if thirdPerson=1
` pitch camera down 10
` move camera -30
`endif
endfunction