lag from cubes?

Blitz3D Forums/Blitz3D Beginners Area/lag from cubes?

I have a guy moving and jumping around a plane with a bunch of cubes(no more then 40). It mostly stays at 60 fps, but drops to below 30 in some spots. I think it's because I creating so many variables that are not needed. It could also be because I have 2 cameras going at the same time(thus doubling the polycount?). Please tell me there is an easier way then this(all the cubes do the same thing and have the same collisions, just different textures and sizes):
o1=CreateCube()
PositionEntity o1,0,-0.5,-3
ScaleEntity o1,10,0.5,1
EntityType o1,wall_col

o2=CreateCube()
PositionEntity o2,0,0.51,1
ScaleEntity o2,10,0.5,1
EntityType o2,wall_col

o3=CreateCube()
PositionEntity o3,0,-0.5,5
ScaleEntity o3,10,0.5,1
EntityType o3,wall_col

o4=CreateCube()
PositionEntity o4,0,0.51,9
ScaleEntity o4,10,0.5,1
EntityType o4,wall_col

o5=CreateCube()
PositionEntity o5,-26,0.5,16.5
ScaleEntity o5,3,1.5,2.5
EntityType o5,wall_col

o6=CreateCube()
PositionEntity o6,-26,0.5,23.5
ScaleEntity o6,3,1.5,2.5
EntityType o6,wall_col

o7=CreateCube()
PositionEntity o7,-18,0.5,23.5
ScaleEntity o7,3,1.5,2.5
EntityType o7,wall_col

o8=CreateCube()
PositionEntity o8,-18,0.5,16.5
ScaleEntity o8,3,1.5,2.5
EntityType o8,wall_col

o9=CreateCube()
PositionEntity o9,-12,-0.5,19.5
ScaleEntity o9,1,0.5,9
EntityType o9,wall_col

o10=CreateCube()
PositionEntity o10,21,0.5,15.5
ScaleEntity o10,8,1.5,1
EntityType o10,wall_col

o11=CreateCube()
PositionEntity o11,23,0.5,20
ScaleEntity o11,8,1.5,1
EntityType o11,wall_col

o12=CreateCube()
PositionEntity o12,21,0.5,24.5
ScaleEntity o12,8,1.5,1
EntityType o12,wall_col

o13=CreateCube()
PositionEntity o13,12,0.5,20
ScaleEntity o13,1,1.5,5.5
EntityType o13,wall_col

o14=CreateCube()
PositionEntity o14,0,-0.5,31
ScaleEntity o14,9,0.5,1
EntityType o14,wall_col

o15=CreateCube()
PositionEntity o15,0,1.6,31
ScaleEntity o15,9,0.5,1
EntityType o15,wall_col

o16=CreateCube()
PositionEntity o16,0,-0.5,49
ScaleEntity o16,9,0.5,1
EntityType o16,wall_col

o17=CreateCube()
PositionEntity o17,0,1.6,49
ScaleEntity o17,9,0.5,1
EntityType o17,wall_col

o18=CreateCube()
PositionEntity o18,1,0.5,43
ScaleEntity o18,8,1.5,3
EntityType o18,wall_col

o19=CreateCube()
PositionEntity o19,-1,0.5,36
ScaleEntity o19,8,1.5,2
EntityType o19,wall_col

o20=CreateCube()
PositionEntity o20,0,-0.5,20
ScaleEntity o20,7,0.5,6
EntityType o20,wall_col

PositionEntity item,0,1,20
SpriteViewMode item,4

cube2=CreateCube()
PositionEntity cube2,10,0.5,0
ScaleEntity cube2,1,1.5,10
EntityType cube2,wall_col

cube3=CreateCube()
PositionEntity cube3,0,0.5,-11
ScaleEntity cube3,11,1.5,1
EntityType cube3,wall_col

cube4=CreateCube()
PositionEntity cube4,-10,0.5,0
ScaleEntity cube4,1,1.5,10
EntityType cube4,wall_col

cube5=CreateCube()
PositionEntity cube5,-20,0.5,11
ScaleEntity cube5,11,1.5,1
EntityType cube5,wall_col

cube6=CreateCube()
PositionEntity cube6,-32,0.5,20
ScaleEntity cube6,1,1.5,10
EntityType cube6,wall_col

cube7=CreateCube()
PositionEntity cube7,20,0.5,11
ScaleEntity cube7,11,1.5,1
EntityType cube7,wall_col

cube8=CreateCube()
PositionEntity cube8,32,0.5,20
ScaleEntity cube8,1,1.5,10
EntityType cube8,wall_col

cube9=CreateCube()
PositionEntity cube9,-20,0.5,29
ScaleEntity cube9,11,1.5,1
EntityType cube9,wall_col

cube10=CreateCube()
PositionEntity cube10,20,0.5,29
ScaleEntity cube10,11,1.5,1
EntityType cube10,wall_col

cube11=CreateCube()
PositionEntity cube11,10,0.5,40
ScaleEntity cube11,1,1.5,10
EntityType cube11,wall_col

cube12=CreateCube()
PositionEntity cube12,0,0.5,51
ScaleEntity cube12,11,1.5,1
EntityType cube12,wall_col

cube13=CreateCube()
PositionEntity cube13,-10,0.5,40
ScaleEntity cube13,1,1.5,10
EntityType cube13,wall_col

ScaleTexture red_tile,0.1,0.5
ScaleTexture blue_tile,0.1,0.5
ScaleTexture orange_tile,0.1,0.5
ScaleTexture pink_tile,0.1,0.5
ScaleTexture green_tile,0.1,0.5

EntityTexture ground,floor_tex
EntityTexture sky,sky_tex
EntityTexture o1,blue_tile
EntityTexture o2,orange_tile
EntityTexture o3,pink_tile
EntityTexture o4,green_tile
EntityTexture o5,green_tile
EntityTexture o6,pink_tile
EntityTexture o7,blue_tile
EntityTexture o8,orange_tile
EntityTexture o9,red_tile
EntityTexture o10,pink_tile
EntityTexture o11,blue_tile
EntityTexture o12,orange_tile
EntityTexture o13,green_tile
EntityTexture o14,orange_tile
EntityTexture o15,orange_tile
EntityTexture o16,green_tile
EntityTexture o17,green_tile
EntityTexture o18,pink_tile
EntityTexture o19,blue_tile
EntityTexture o20,red_tile
EntityTexture cube2,red_tile
EntityTexture cube3,red_tile
EntityTexture cube4,red_tile
EntityTexture cube5,red_tile
EntityTexture cube6,red_tile
EntityTexture cube7,red_tile
EntityTexture cube8,red_tile
EntityTexture cube9,red_tile
EntityTexture cube10,red_tile
EntityTexture cube11,red_tile
EntityTexture cube12,red_tile
EntityTexture cube13,red_tile


an array?

Trust me, it has nothing to do with the number of variables you are using.

It obviously isn't the number of cubes you have on-screen because 40 is only 480 polygons.

Almost certainly it is due to the number of collision types you are using. Try reducing that number and I bet you'll see better results.

Also, if the frame rate drops below a certain number, it's probably to do with the flip true you will most likely have. Try flip false, and the frame rate should stay more stable.

I'd go with Wolron too and suggest the number of collisions your using, maybe even the number of surfaces might have an effect too. Try and combine them using addmesh or something :o)

you could work from your player and do visable distance to say if it rendered

works it you are doing single player turn enties of untill needed

Make a box type:
Type box
  Field entityhandle
End Type


Then use a loop:
For 1 to [however many boxes you want]
  b.box = New box
  b\entityhandle = CreateCube()
  EntityType b\entityhandle, wall_col
  etc.......


It's not the variables that's causing the slowdown. It's the number of collisions or and the number of surfaces :o)

actually, in quad1, where the cities were generated with cubes, i only had 50 cubes and the FPS was TERRIBLE. that was on a celeron 1.4, with an intel 810 graphics set...
Quad2 ran much better as the cities (when they were in there) were generated from a single surface, building the cubes by hand onto it...