@MrValentine
Intel Q6600 @ 3 GHz
Radeon HD 6850
3.5GB system ram
Windows 7 32
I am looking at culling systems, hence the experiments
#constant TRUE = 1
#constant FALSE = 0
set window off
set display mode 1280, 720, 32, 0
hide mouse
input "please enter the number of objects to test (boxes) (i.e. 10000) >", maxBoxes
cls
print "please wait while objects are created"
sync
sync on
//sync rate 60
set camera range 1,20000
color backdrop rgb(64,64,64)
hide light 0
set ambient light 0
color ambient light rgb(255,255,255)
// build sector A
MAKE_WALL(1,-500,500,500,500,0, rgb(255,0,0))
MAKE_WALL(2, 0,500,500,500,90, rgb(0,255,0))
MAKE_WALL(3, 0,0,500,500,0, rgb(0,0,255))
MAKE_WALL(4, 500,0,1500,500,90, rgb(255,0,0))
MAKE_WALL(5, 500,-1500,1500,500,-180, rgb(0,255,0))
MAKE_WALL(6, -1000,-1500,1500,500,90, rgb(0,0,255))
MAKE_WALL(7, -1000,-3000,1000,500,-180, rgb(255,0,0))
MAKE_WALL(8, -2000,-3000,2000,500,-90, rgb(0,255,0))
MAKE_WALL(9, -2000,-1000,500,500,-90, rgb(0,0,0))
MAKE_WALL(10, -2000,-500,1000,500,-90, rgb(0,0,255))
MAKE_WALL(11, -2000,500,1000,500,0, rgb(255,0,0))
MAKE_WALL(12, -1000,500,500,500,0, rgb(0,255,0))
// build sector B
MAKE_WALL(100, -4500,-1000,1500,500,-90, rgb(128,0,0))
MAKE_WALL(101, -4500, 500,1500,500,0, rgb(0,128,0))
MAKE_WALL(102, -3000, 500,500,500,90, rgb(0,0,128))
MAKE_WALL(103, -3000, 0,500,500,0, rgb(128,0,0))
MAKE_WALL(104, -2500, 0,500,500,90, rgb(0,128,0))
MAKE_WALL(105, -2500, -500,500,500,0, rgb(128,128,0))
MAKE_WALL(106, -4500, -1000,500,500,0, rgb(0,128,0))
// simulate large amount of objects
excludeState = TRUE
//maxboxes = 10000
for boxNum = 1 to maxBoxes
MAKE_BOX(boxNum + 1000, rnd(5000), rnd(5000), rnd(5000), rgb(128, 255, 128))
if excludeState = TRUE then EXCLUDE OBJECT ON boxNum + 1000
next boxNum
// place player at starting position looking at walls with excluded boxes in the distance
xpos# = -1975 //-688
ypos# = 80
zpos# = -2700 //-299
cx# = -10 //0
cy# = 51 //315
ncx# = cx#
ncy# = cy#
position camera xpos#,ypos#,zpos#
ticks = 0
//cx# = 0
//cy# = 315
cameraMouseSpeed# = 0.4
do
// Very nice camera control code with mouse smoothing and simple inertia (*** ripped and modded from an Evolved demo ***)
cr#=0
cf#=0
cameraWalkSpeed# = cameraMouseSpeed#
if KEYSTATE(42) = 1 then cameraWalkSpeed# = cameraWalkSpeed# * 2
if rightkey()=1 or KEYSTATE(32)=1 then cr#=-(cameraWalkSpeed# * 30)
if leftkey()=1 or KEYSTATE(30)=1 then cr#=(cameraWalkSpeed# * 30)
if upkey()=1 or KEYSTATE(17)=1 then cf#=(cameraWalkSpeed# * 30)
if downkey()=1 or KEYSTATE(31)=1 then cf#=-(cameraWalkSpeed# * 30)
ncr#=curvevalue(cr#,ncr#,3)
ncf#=curvevalue(cf#,ncf#,3)
cx#=cx#+mousemovey()*cameraMouseSpeed#
cy#=cy#+mousemovex()*cameraMouseSpeed#
if cx#>80 then cx#=80
if cx#<-80 then cx#=-80
ncx#=curveangle(cx#,ncx#,2.5)
ncy#=curveangle(cy#,ncy#,2.5)
move camera ncf#
rotate camera 0,wrapvalue(ncy#-90),0
move camera ncr#
rotate camera 0,wrapvalue(ncy#+90),0
rotate camera ncx#,ncy#,0
xpos# = camera position x(0)
ypos# = camera position y(0)
zpos# = camera position z(0)
// *** end of evolved rip ***
// Press H to exlude all the boxes
if (KEYSTATE(35) = 1) and (excludeState = FALSE)
hs = HITIMER()
for boxNum = 1 to maxBoxes
//HIDE OBJECT boxNum + 1000
//SET OBJECT MASK boxNum + 1000, 0
EXCLUDE OBJECT ON boxNum + 1000
next boxNum
he = HITIMER()
excludeState = TRUE
endif
// Press J to include all the boxes
if (KEYSTATE(36) = 1) and (excludeState = TRUE)
hs = HITIMER()
for boxNum = 1 to maxBoxes
//SHOW OBJECT boxNum + 1000
//SET OBJECT MASK boxNum + 1000, %11111111
EXCLUDE OBJECT OFF boxNum + 1000
next boxNum
he = HITIMER()
excludeState = FALSE
endif
txty = 0
text 0,txty, "Use WSAD and mouse to move and look around": inc txty, 20
text 0,txty, "Press H to exluded boxes (EXCLUDE OBJECT ON)": inc txty, 20
text 0,txty, "Press J to include boxes (EXCLUDE OBJECT OFF)": inc txty, 20
inc txty, 20
text 0,txty, "FPS = "+str$(screen fps()): inc txty, 20
text 0,txty, "camera = "+str$(xpos#)+", "+str$(ypos#)+", "+str$(zpos#): inc txty, 20
text 0,txty, "ncx#, ncy# = "+str$(ncx#)+", "+str$(ncy#): inc txty, 20
text 0,txty, "cx#, cy# = "+str$(cx#)+", "+str$(cy#): inc txty, 20
text 0,txty, "scancode = "+str$(SCANCODE() ): inc txty, 20
text 0,txty, "he - hs = "+str$(he - hs): inc txty, 20
text 0,txty, "ticks = "+str$(ticks): inc txty, 20
text 0,txty, "sync T = "+str$(se - ss): inc txty, 20
text 0,txty, "maxBoxes = "+str$(maxboxes): inc txty, 20
if excludeState = TRUE
text 0,txty, "excludeState = TRUE": inc txty, 20
else
text 0,txty, "excludeState = FALSE": inc txty, 20
endif
ss = HITIMER()
sync
se = HITIMER()
inc ticks
loop
exit
function MAKE_WALL(objectnumber as integer, x as float, z as float, w as integer, h as integer, ang as float, clr as dword)
local hw as float
local hh as float
hw = w / 2
hh = h / 2
xx = x + cos(ang) * hw;
zz = z - sin(ang) * hw;
make object plane objectnumber, w, h
//offset limb objectnumber,1, hw, hh, 1
position object objectnumber, xx, 0, zz
set object emissive objectnumber, clr
rotate object objectnumber, 0, ang, 0
calculate object bounds objectnumber
//show object bounds objectnumber
endfunction
function MAKE_BOX(objectnumber, x as float, y as float, z as float, clr as dword)
make object box objectnumber, 100, 100, 100
position object objectnumber, x, y, z
set object emissive objectnumber, clr
rotate object objectnumber, 0, ang, 0
calculate object bounds objectnumber
endfunction
function MAKE_OBJECT_LINE3D(onum as integer, x1#, y1#, z1#, x2#, y2#, z2#)
make object triangle onum, x1#, y1#, z1#, x1# + (x2# - x1#) / 2, y1# + (y2# - y1#) / 2, z1# + (z2# - z1#) / 2, x2#, y2#, z2#
set object wireframe onum, 1
SET OBJECT CULL onum, 0
endfunction
1 box
EXCLUDE ON = 2500 FPS
EXCLUDE OFF = 2500 FPS
10000 boxes
EXCLUDE ON = 208 FPS
EXCLUDE OFF = 16 FPS
20000 boxes
EXCLUDE ON = 105 FPS
EXCLUDE OFF = 7 FPS
80000 boxes
EXCLUDE ON = 26
EXCLUDE OFF = FPS = too slow to measure i.e. 0