Ok, I have a piece of <****> computer, so I average about 20fps on most of my games. But with this code:
Sync On
Sync Rate 30
gosub setup1
Rem Main loop
Do
set cursor 0,0
print screen fps()
Rem Store Object angle
AngleY# = object angle Y(10)
Rem Control input for camera
If Upkey()=1 and selected=0
XTest# = Newxvalue(X#,AngleY#,20)
ZTest# = Newzvalue(Z#,AngleY#,20)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
Move object 10,10
Endif
Endif
If Downkey()=1 and selected=0
XTest# = Newxvalue(X#,AngleY#,20)
ZTest# = Newzvalue(Z#,AngleY#,20)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
Move object 10,-10
Endif
Endif
If Leftkey()=1 then Yrotate object 10,Wrapvalue(AngleY#-5)
If Rightkey()=1 then Yrotate object 10,Wrapvalue(AngleY#+5)
X# = Object position x(10)
Z# = Object position z(10)
Y# = Get Ground Height(1,X#,Z#)
Position object 10,X#,Y#+2.5,Z#
CameraZ# = Newzvalue(Z#,AngleY#-180,20)
CameraX# = Newxvalue(X#,AngleY#-180,20)
CameraY# = Get Ground Height(1,CameraX#,CameraZ#)
Position camera CameraX#,CameraY#+15,CameraZ#
Point camera X#,Y#+10,Z#
Rem Refresh Screen
Sync
Loop
setup1:
load bitmap "media\terrain1.bmp",1
width=bitmap width(1)
height=bitmap height(1)
Rem make matrix
Make matrix 1,500,500,width,height
Rem texture matrix
Load image "media\grass.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1
Rem Make player pawn
Make object cone 10,5
position object 10,100,0,100
set current bitmap 1
for x=0 to width-2
for z=0 to height-2
for xpixel = x to x+1
for zpixel = z to z+1
height# = height#+rgbr(point(xpixel,zpixel))
next zpixel
next xpixel
height#=height#/4
set matrix height 1,x,z,height#
next z
next x
delete bitmap 1
set current bitmap 0
update matrix 1
Make matrix 2,500,500,20,20
load image "media\dirt.jpg",2
prepare matrix texture 2,2,1,1
fill matrix 2,2,1
update matrix 2
return
I only get like 8fps!!! Why would there be such a drop in frame rate with such simple things going on? Btw, my terrain image is only 50x50 and the bmp files are actually quite small in filesize...
Im only "Apolloed" In Spirit