Hi everyone, well, this is an interesting problem. I use to get upwards of 200 fps with my current code. I then put a cap on it to 60. I recently removed the cap to see what speed I would be getting, and guess what, it's 60. Now, to see what could possibly be bogging down my code, I removed almost everything that could possibly be doing this back down to what my code use to be before I made changes, and it's STILL running at 60. I have removed everything down to just a do sync loop.
Here's my current code:
Object = 1
Gosub Start_Map:
Xeno Start
xeno set gravity -10
make object box 10, 500, 0.1, 500
xeno make rigid body static box 10
For x = 11 to 14
make object cube x, RND(10)
position object x, RND(20), 20, RND(20)
Color Object x,RGB(100,0,0)
xeno make rigid body dynamic box x
Xeno Set Rigid Body Mass x,RND(20)
Next x
For x = 1 to 8
If Object Exist(x)
xeno make character controller x, 4, 0.25, 1.5, 10, 5, 150 `no max slope
`3, 1, 0.25, 0.5, 10, 5, 150
Endif
Next x
xeno position character controller 1, 4, 10, 0
Do
Text 10,10,"X "+Str$(MapPositionX)
Text 10,20,"Z "+Str$(MapPositionZ)
Text 10,30,"FPS "+Str$(Screen FPS())
Text 10,40,"Angy# " + Str$(Angy#)
Text 10,50,"Poly's "+Str$(Statistic(1))
If Shiftkey() = 1 and View = 0 and switch = 0 Then View = View + 1 : Switch = 50
If Shiftkey() = 1 and View = 1 and switch = 0 Then View = View - 1 : Switch = 50
Dec Switch,1
If Switch < 0 then Switch = 0
positionCameraToObject(1,view)
if keystate(17) then xeno character controller move forward 1
if keystate(31) then xeno character controller move backward 1
if keystate(30) then xeno character controller move left 1
if keystate(32) then xeno character controller move right 1
if spacekey() then xeno character controller jump 1
xeno update
Sync
Loop
xeno end
function positionCameraToObject(obj,thirdPerson)
Angy# = Mousemovey()/3
AngX# = mousemovex()
Yrotate Object 1,Object Angle Y(1) + Angx#*3
Xeno Rotate Character Controller 1, Object Angle Y(1) + AngX#*3
Position Object 1, Xeno Get Character Controller Position X(1), Xeno Get Character Controller Position Y(1), Xeno Get Character Controller Position Z(1)
Position Camera 0, Xeno Get Character Controller Position X(1), Xeno Get Character Controller Position Y(1)+8, Xeno Get Character Controller Position Z(1)
Rotate Camera Camera Angle X() + Angy#,Object Angle Y(1),(Object Angle Z(1))
For y = 2 to 8
If Object Exist(y)
Position Object y, Object Position X(1), Object Position Y(1), Object Position Z(1)
Rotate Object y,Object Angle X(1), Object Angle Y(1), Object Angle Z(1)
Endif
Next y
move camera -10
if thirdPerson=1
angy# = mousemovey()/3
For x = 1 to 8
If Object Exist(x)
Show Object x
Endif
Next x
move camera 4
Rotate camera 0,(camera angle x(0)+angy#),object angle y(1),(object angle z(1))
If Wrapvalue (Camera Angle X(0))>40 and Wrapvalue (Camera Angle X(0))<190 then xrotate Camera 0,40
If Wrapvalue (Camera Angle X(0))>260 and Wrapvalue (Camera Angle X(0))<320 then xrotate Camera 0,320
else
thirdPerson=0
Angy# = MousemoveY()/3
position camera 0,object position x(1),object position y(1)+8, object position z(1)
For o = 1 to 8
If Object Exist(o)
Hide Object o
Endif
Next o
Rotate camera 0,(camera angle x(0)+angy#),object angle y(1),(object angle z(1))
If Wrapvalue (Camera Angle X(0))>40 and Wrapvalue (Camera Angle X(0))<190 then xrotate Camera 0,40
If Wrapvalue (Camera Angle X(0))>260 and Wrapvalue (Camera Angle X(0))<320 then xrotate Camera 0,320
endif
endfunction
There is the file initiation before this and some heavier image manipulation which slows the comp down a lot... BUT, after that it use to run smooth and fast. Now, I don't know what's doing it. I even removed the image manipulation.
Any ideas?
www.myspace.com/norseblod