Try this..it has math collision on..you can change the object number by setting the objnum value
i get 97 fps with this with 100 objects , checking character collision with all of them at each frame
what do you get?
Rem * Title : maxicollision
Rem * Author : Scorpyo
Rem * Date : July2002
rem sky = object 9990
rem ********** MAIN 1 ****************
set display mode 800,600,16
hide mouse
sync on
backdrop off
grid=30
mtxrandomize=1
landsize=20000
skysize=20000
objnum=100
gosub Setupland1
gosub Character
gosub Vars1
set global collision off
sync rate 0
set camera range 1,skysize + 1000
rem set camera fov 120
rem *****MAIN LOOP******
do
rem check borders
if x#<100 then x#=100
if x#>landsize-100 then x#=landsize-100
if z#<100 then z#=100
if z#>landsize-100 then z#=landsize-100
if collflag=0
collx#=x#
collz#=z#
endif
gosub colcheck
if collflag=1
x#=collx#
z#=collz#
endif
gosub Playercontrol
rem call to camera changes subroutine ( bottom key row )
gosub camera_controls
rem Calculate position data
oldx#=x#
oldz#=z#
x#=newxvalue(x#,a#,s#)
z#=newzvalue(z#,a#,s#)
rem calls camera update subroutine
gosub update_camera
rem Update active model (yflag adds height of the current floor/object)
h#=get ground height(1,x#,z#)
position object 9999,x#,h#+5,z#
yrotate object 9999,a#
rem Sky follows active character
position object 9990,x#,0,z#
rem Update screen
sync
rem End loop
loop
rem ** SUBROUTINES ***************************
rem ****** CREATE LEVEL ******
Setupland1:
make matrix 1,landsize,landsize,grid,grid
randomize matrix 1,mtxrandomize
rem get ground done
update matrix 1
count=landsize/objnum
for n=1 to objnum
zeta=rnd(15000)
make object cube n,200
position object n,zeta,get ground height(1,zeta,count)+100,count
count=count+(landsize/objnum)
rem if count>landsize-50 then count=100
next n
rem Create fog and ambience
set ambient light 60
if fog available()=1 then fog on : fog distance 9000 : fog color rgb(150,150,255)
rem Create Sky
rem sky texture
make object sphere 9990,skysize
scale object 9990,100,50,100
set object 9990,1,1,0
fade object 9990,0
return
rem ******** VARIABLES ******
rem ****VARS1****
Vars1:
collflag=0
collx#=0
collz#=0
rem **Player Start position**
x#=5000
z#=1000
rem initial cam settings
camdist=-300
camhgt=200
camrot=0
camlen=200
rem forced timing for player movement keys
basetime = timer()
playertime = basetime
return
rem ***** PLAYERCONTROL *****
Playercontrol:
set cursor 0,0
set text opaque
rem debug check
print "Fps=",screen fps()
print "landsize=",landsize
print "grid=",grid
print "objects=",objnum
print "x=",x#
print "z=",z#
print "a#=",a#
print "camlen=",camlen
print "camrot=",camrot
print "obsqrt#=",obsqrt#
rem ****Character walk ****
if upkey()=1 and s#<12 then s#=s#+2
if downkey()=1 and s#>-12 then s#=s#-2
if leftkey()=1 then a#=wrapvalue(a#-4)
if rightkey()=1 then a#=wrapvalue(a#+4)
rem stop if "-"
if inkey$()="-" then s#=0.0
if inkey$()="ù" then s#=60.0
rem forces timing
playertime = basetime + 30
return
rem ***CONTROL EXTENSIONS ******
rem empty
rem ****BUILD PLAYER****
rem object 9999
Character:
rem make cone
make object cone 9999,100
scale object 9999,80,100,140
rem point tip forward
xrotate object 9999,60
set object cull 9999,0
return
camera_controls:
if inkey$()="<" then camrot2=wrapvalue(camrot2)+2
if inkey$()="z" then camdist=camdist+2
if inkey$()="x" then camdist=camdist-2
if inkey$()="b" then camrot=camrot+2
if inkey$()="n" then camrot=camrot-2
if inkey$()="c" then camhgt=camhgt+2
if inkey$()="v" then camhgt=camhgt-2
if inkey$()="m" then camlen=camlen+2
if inkey$()="," then camrot = 180
if inkey$()="." then gosub Resetcam
return
rem camera update
update_camera:
rem Position camera to the back of the character
cx#=newxvalue(x#,wrapvalue(a#+camrot),camdist)
cz#=newzvalue(z#,wrapvalue(a#+camrot),camdist)
cy#=get ground height(1,cx#,cz#)
position camera cx#,cy#+camhgt,cz#
rem Point camera at object
point camera x#,y#+camlen+yflag,z#
return
rem camera reset
Resetcam:
camdist=-400
camhgt=400
camrot=0
camlen=200
return
rem --- check collision-----
colcheck:
for o=1 to objnum
if object exist(o)
diffposx#=abs(object position x(9999)-object position x(o))
diffposz#=abs(object position z(9999)-object position z(o))
obsqrt#=sqrt((diffposx#*diffposx#)+(diffposz#*diffposz#))
if obsqrt#<160 then collflag=1 : return
if obsqrt#>160 then collflag=0
endif
next o
return