Working with lots of cubes. Improving performance?
Posted
by
Randomman159
on Game Development
See other posts from Game Development
or by Randomman159
Published on 2011-05-24T11:54:18Z
Indexed on
2012/07/08
21:24 UTC
Read the original article
Hit count: 215
Edit: To sum the question up, I have a voxel based world (Minecraft style (Thanks Communist Duck)) which is suffering from poor performance. I am not positive on the source but would like any possible advice on how to get rid of it.
I am working on a project where a world consists of a large quantity of cubes (I would give you a number, but it is user defined worlds). My test one is around (48 x 32 x 48) blocks.
Basically these blocks don't do anything in themselves. They just sit there.
They start being used when it comes to player interaction.
I need to check what cubes the users mouse interacts with (mouse over, clicking, etc.), and for collision detecting as the player moves.
Now I had a massive amount of lag at first, looping through every block.
I have managed to decrease that lag, by looping through all the blocks, and finding which blocks are within a particular range of the character, and then only looping through those blocks for the collision detection, etc.
However, I am still going at a depressing 2fps.
Does anyone have any other ideas on how I could decrease this lag?
Btw, I am using XNA (C#) and yes, it is 3d.
© Game Development or respective owner