Kanga -
"1. Are you SURE Patch 3 code will work on Patch 4? I'm only using x models, bmps and mp3 files btw."
Never assume this. A good example - in patch 3 all objects have their transparency property turned on by default. Lee has fixed this for P4 so this isn't the case - but you might have not even noticed it. So where before say you had a PNG file as a texture on an object you wouldn't need to turn the transparency on, now you will. Mostly the code will work, but you might find that you coded around something you don't need to any longer.
"2. At the moment over 1000 objects slows the frame rate down to a halt on my system I would ideally need to use closer to 100,000 at a time for my rather ambitious project"
I just ran a test for you. The code is below - it's pretty simple, nothing special, but two important things came to light. First of all - DBPro 3.1 got to about 5000 objects being created and I got fed-up of waiting! It was taking on average 60-90 seconds per 1000 objects. I never even got to the point of seeing the frame rate, but I would imagine it would be under 1 fps.
DBPro Patch4b3 completed the object creation code extremely quickly and the program ran at a solid 49 fps no matter where in the scene I moved.
sync rate 0
sync on
hide mouse
autocam off
position camera 500,4,1
set camera range 1,250
set text opaque
for i=1 to 10000
make object cube i,1
color object i,rgb(100+rnd(155),100+rnd(155),100+rnd(155))
position object i,rnd(1000),rnd(18),rnd(1000)
if upkey() then end
if t=1000
text 0,0,str$(i)
sync
t=0
else
inc t
endif
next i
do
set cursor 0,0 : print screen fps()
control camera using arrowkeys 0,1,1
sync
loop
Now that's with 10,000 cubes (which is 120,000 polygons) spread over a 1000x1000 area with a camera range of 250. I have no doubts that I could increase the object count if I increased the area size and perhaps decreased the camera range.
For a test I upped the object count to 25,000 and despite taking just over 5 minutes to do nothing but create the objects, the program still ran at a respectable 30 fps on average. That's 300,000 polygons.
Out of pure curiosity I tested similar code in
Blitz 3D. I again set the camera range to 250, used the same grid space and object count but wrote my own very simple keyboard routine for the main loop (as you would need to do in DB).
The code is here:
Graphics3D 640,480
SetBuffer BackBuffer()
camera=CreateCamera()
CameraRange camera,1,250
light=CreateLight()
RotateEntity light,90,0,0
For i=1 To 10000
c = CreateCube()
PositionEntity c,Rnd(1000),Rnd(6),Rnd(1000)
EntityColor c,100+Rnd(155),100+Rnd(155),100+Rnd(155)
Next
x=500
y=3
z=500
PositionEntity camera,x,y,z
Repeat
If KeyDown(200) Then
z=z+1
PositionEntity camera,x,y,z
End If
If KeyDown(208) Then
z=z-1
PositionEntity camera,x,y,z
End If
If KeyDown(203) Then
x=x-1
PositionEntity camera,x,y,z
End If
If KeyDown(205) Then
x=x+1
PositionEntity camera,x,y,z
End If
RenderWorld
Flip
Until KeyDown(1)
End
The results? Well for a start the object (entity) creation was a lot faster but then you could speed it up in DB by disabling the 3D backdrop until you're ready.
With 1000 cubes it was superb - fast, responsive, instant. With 5000 cubes the result was similar although you could being to see it struggle a little. With 10,000 cubes the story was very different. The frame rate varied depending on the number of cubes in the viewport quite a bit, everything ran a lot faster than DB could handle it, but a lot slower than DBPro was showing. The program itself was unresponsive and it took an awful long time to manage to quit out of it and for it to close down. With 20,000 objects it was massively lagging now, too unplayable for a game and it wouldn't close down at all and had to be "end tasked" from the task manager of XP.
Back in DBPro I did try 100,000 objects but got fed-up waiting for the creation process to finish (I reckon it would take nearly 20 minutes!). If you truly need this many objects in your game then Patch4 won't be the answer to your prayers - but please, show me a language that is!
Cheers,
Rich
"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming