Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - araghavan

#1
Support / Re: Problem with fps in a randomized 3d world
February 26, 2013, 09:35:36 PM
Right, that makes a lot of sense. With this method I'm probably creating over 100 cubes...

A combination of using full walls and merging objects will hopefully smooth things out

Thanks
#2
Support / Problem with fps in a randomized 3d world
February 26, 2013, 04:19:41 PM
I'm having trouble finding the best way to create my world. Right now, I created a random 2-D map generator which outputs a bunch of rooms. When I start the game, I create a NxM floor of cubes from primitives, then from there wherever there's a wall shown in my 2D map, I add a few blocks at that position above the floor to gain some height.

It's creating the world fine, and I can navigate it... except that its giving me very few FPS. I'm using cubes of size five, and a 20x20 base 2D map:

/*Load World Map Floor*/
for (int row = 0; row < r.length; row++)
for (int col = 0; col < r[0].length; col++)
{
worldMap[row][col][0] = block.cloneObject();
}

MemoryHelper.compact();
boolean player_location_set = false;
//Load rest of map
for (int h = 1; h < 3; h++)
for (int row = 0; row < r.length; row++)
for (int col = 0; col < r[0].length; col++)
{
if (r[row][col] == RoomData.WALL || r[row][col] == RoomData.PERMWALL){

worldMap[row][col][h] = block.cloneObject();

}
if (r[row][col] == RoomData.ENTRANCE && player_location_set == false){
player_location_set = true;
initial_player_position = new SimpleVector(row * 10, h * 10 + 5, col * 10);
}
}


^Here is how I am creating my map. In the onSurfaceChanged function, I have:


for (int h = 0; h < worldMap[0][0].length; h++)
for (int row = 0; row < worldMap.length; row++)
for (int col = 0; col < worldMap[0].length; col++)
{
//If there is a block
if (worldMap[row][col][h] != null){
block = worldMap[row][col][h];
block.translate(SimpleVector.create(row * 10, h * 10 + 5, col * 10));
block.rotateY((float) (Math.PI/4));
block.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
block.build();
block.strip();
world.addObject(block);
}
}

world.buildAllObjects();
MemoryHelper.compact();


Any advice on how I should go about this? I can't really pre-create the world because it's randomized

Thanks