Which method would be best for optimization?

Hello

I’m creating a voxel game in which I need to have a large grid of cubes - say 1024 by 1024 or larger. The players will be from Quibicle and animated with PicaVoxel. But the grid is just solid-colored cubes.

My goal is to dynamically create a level by simple changing the colors and heights of each block in the grid. This would happen once every time the level starts and then they would not change until the maps is wiped and a new one is created.

For optimization purposes, could I ask if there are any performance issues with doing the following (Or are their any other suggestions that would yeild better memory and framerate on mobile devices?)…

I would layout a grid of prefab gameobjects that contain:
1 )a cube with a material that you can change the diffuse via C# (I’m assuming you can do that),
2) a collision box - I’m assuming that could just be a component of the box? Is that too many collision components for mobile?
3) a volume/collision box? (is that what I’d use?) that would track if the player standing on the square. (Suggestions here?)

Then, based on my algorithm, I would go through each box on the grid and change its color, height and type accordingly.

Thank you very much. Any suggestions would help. I don’t want to do the whole thing and find out an iPhone wouldn’t handle what I’m doing.

Dave

If you’re talking about a prefab per cube, then no, that’s not at all feasible, on any platform. You’re talking about over a million objects. The standard method is to build mesh chunks using the Mesh class.

–Eric

I see, thank you Eric. I assume the Mesh class allows me to change the color of the mesh, yes?

Two additional follow-up questions.

  1. So then would I still be able to add something per square that would allow me to know what color square the player is on?
  2. Would I be able to dynamically add a collision modifier to that mesh? Or make that mesh a rigid body?