I made a maze generator. And it generates mazes, n stuff. I originally made it using some 24x maze bricks I made a while back, and it worked fine. But I wanted to scale it up to use something larger. SO i made a converter to turn it into maze bricks of the 64x cube style.
The converter took forever to make and probably wouldn't have been worth it if I had only used it once. Buuut Once I got it working and in the game, and generated the maze. It took forever to load the maze in via save file. And lagged like a bitch the entire time. I'm talking 3-4 seconds between frames here. Using the 24x bricks it lags some. But not THAT much.
Since I have a converter it takes only a few minutes to make a brickpack of a different size(that's 23 bricks w/brick collision all written up). So I tried a few different sizes. 54x, 32x, 18x, 12x. Only the 12x seems to work without any problems. And it's still affected by this weird quirk:
If I put a tiny gap between the bricks. It'll load 8000 bricks in .68 seconds. No matter the brick size.
I don't get it. I really don't. Is it the brick collision? Like, when I place 1 brick next to another is it spending a bunch of time calculating how many cells on it's side are covered? Or is it just spending a bunch of time setting the inside of the brick as a place you can build?
Or is it just ghosting? Are the bricks so large they span multiple chunks, so it has to do multiple table lookups or- I don't know.
I've run into this problem before when I tried to make a terrain generator using 64x terrain bricks. The generator worked fine, but the loading- god. You move a few bricks over and it'd take a good 2 seconds to load the next sliver of terrain. Teleporting around the map didn't help much because you have to sit at the next point for a good half minute for it to load, and it wasn't consistent, so you couldn't make it automatic without wasting a bunch of time. :P
My best guess is that it's calculating the coverage area on the sides. Taking into account that leaving a gap helps a ton. It would make sense too, since for a 64x cube, thats (64*2.5)*64=10240 for each side and then 4096 for the top and the bottom leaving us with a grand total of 49152 cells to calculate per brick. Which would explain 3-4 seconds between frames.
btw, when I talk about brick collision I'm talking about a brick's collision with other bricks. Like how you can't place a 1x1 in a 2x2. But you can place a 1x1 in that empty slot in that weird L shaped brick you can find near the 2x2 in the brick menu.