OK pls answer this (if you can)....
I create a cube like this...
Then I do this...
Now, if I create a map of 22*22*22 blocks all is fine the FPS is great however at 25*25*25 the FPS goes to 1!
So the question is what is causing the slow down and how to prevent it?
How many surfaces do I have it I create a map of 5*5*5 say based on the above code and how many meshes are there? If copyentity doesn't copy the surface then a map of 5*5*5 would have 1 mesh, 3 surfaces and 625 entities.
I don't think it's the tris count thats causing the probem but the number of surfaces but perhaps it is the number of entities.
Each 'cube' should share a texture for the floor, wall and ceiling so in essence all i really need is 3 surfaces right?
How can I do this? I wonder what the entity limit is with blitz?
I create a cube like this...
Function map_create_brick_template() brush_wall = LoadBrush(Pak(g_game_textures[1]\texture$),49 ) brush_ceiling = LoadBrush(Pak(g_game_textures[1]\texture$),49 ) brush_floor = LoadBrush(Pak(g_game_textures[1]\texture$),49 ) ; Prepare the mesh mesh = CreateMesh() surf = CreateSurface(mesh,brush_wall) ;front face v0 = AddVertex(surf,-1,+1,-1,0,0) v1 = AddVertex(surf,+1,+1,-1,1,0) v2 = AddVertex(surf,+1,-1,-1,1,1) v3 = AddVertex(surf,-1,-1,-1,0,1) AddTriangle surf,v0,v1,v2 AddTriangle surf,v0,v2,v3 ;right face v0 = AddVertex(surf,+1,+1,-1,0,0) v1 = AddVertex(surf,+1,+1,+1,1,0) v2 = AddVertex(surf,+1,-1,+1,1,1) v3 = AddVertex(surf,+1,-1,-1,0,1) AddTriangle surf,v0,v1,v2 AddTriangle surf,v0,v2,v3 ;back face v0 = AddVertex(surf,+1,+1,+1,0,0) v1 = AddVertex(surf,-1,+1,+1,1,0) v2 = AddVertex(surf,-1,-1,+1,1,1) v3 = AddVertex(surf,+1,-1,+1,0,1) AddTriangle surf,v0,v1,v2 AddTriangle surf,v0,v2,v3 ;left face v0 = AddVertex(surf,-1,+1,+1,0,0) v1 = AddVertex(surf,-1,+1,-1,1,0) v2 = AddVertex(surf,-1,-1,-1,1,1) v3 = AddVertex(surf,-1,-1,+1,0,1) AddTriangle surf,v0,v1,v2 AddTriangle surf,v0,v2,v3 surf1 = CreateSurface(mesh,brush_floor) ;bottom face v0 = AddVertex(surf1,-1,+1,+1,0,1) v1 = AddVertex(surf1,+1,+1,+1,0,0) v2 = AddVertex(surf1,+1,+1,-1,1,0) v3 = AddVertex(surf1,-1,+1,-1,1,1) AddTriangle surf1,v0,v1,v2 AddTriangle surf1,v0,v2,v3 surf2 = CreateSurface(mesh,brush_ceiling) ;top face v0 = AddVertex(surf2,-1,-1,-1,1,0) v1 = AddVertex(surf2,+1,-1,-1,1,1) v2 = AddVertex(surf2,+1,-1,+1,0,1) v3 = AddVertex(surf2,-1,-1,+1,0,0) AddTriangle surf2,v0,v1,v2 AddTriangle surf2,v0,v2,v3 ; free up the brushes FreeBrush brush_floor FreeBrush brush_ceiling FreeBrush brush_wall UpdateNormals mesh Return mesh End Function
Then I do this...
brick_template=map_create_brick_template() ScaleEntity brick_template,2,2,2 EntityBox brick_template, -2, -2, -2, 4, 4, 4 EntityPickMode brick_template,2 EntityFX brick_template, 1 ; Now lets create the maze structure... For x = 1 To g_game_mazesize For y = 1 To g_game_mazesize For z = 1 To g_game_mazesize maze(x, y, z)\entity = CopyEntity(brick_template) EntityType maze(x, y, z)\entity,g_game_collision_type_brick HideEntity maze(x, y, z)\entity PositionEntity maze(x, y, z)\entity,x*4,y*4,z*4 Next Next Next FreeEntity brick_template
Now, if I create a map of 22*22*22 blocks all is fine the FPS is great however at 25*25*25 the FPS goes to 1!
So the question is what is causing the slow down and how to prevent it?
How many surfaces do I have it I create a map of 5*5*5 say based on the above code and how many meshes are there? If copyentity doesn't copy the surface then a map of 5*5*5 would have 1 mesh, 3 surfaces and 625 entities.
I don't think it's the tris count thats causing the probem but the number of surfaces but perhaps it is the number of entities.
Each 'cube' should share a texture for the floor, wall and ceiling so in essence all i really need is 3 surfaces right?
How can I do this? I wonder what the entity limit is with blitz?