Hi
I have a game that is basically entirely built of cubes. The reason for this is because I simply want those simple graphics and need to store data for some of these cubes and be able to detect what cube it is that my player is standing on. But I then have the problem that the more cubes there are, the laggier the game gets. So the question is, how can I optimize the game to stop the game from dropping 30+ frames when I look in a direction with a lot of cubes?
I currently have a few ideas but I am not sure how well these will work. Any feedback on this ideas are greatly appreciated and so are new ideas!
Script to disable renderer when the object isn’t visible - The name is pretty self-explanatory. This would run on each cube and the player would tell all the visible cubes that it can see them and then they would enable their renderers. But if they can’t be seen they will be disabled.
I am not so certain about this because that would be a lot of scripts running at the same time.
Combining each type of cube into one mesh - So my game consists of different “cube types” and, in theory, that would allow me to combine all the cubes in a cube type into one mesh and it would still work. Again, not certain if it is a good way to do it.
(Hardest of them all) Building an advanced voxel engine - I could get or build an advanced voxel engine that would combine all the cubes into one mesh and then split that into chunks. I would be able to do that myself but then comes the part where I need to store information about some cubes or detecting what cube my player is standing on. So any help with that or an asset that allows me to do something like that would be great!
I would love to hear your feedback!