Does existance of GIANT 3D array can cause lags?

Hello. I’m want make my own Pathfinding system, which I plan make using 3D array (Array[x,y,z] = DangerLevel) my map is really big, and due to this, I have 1 question:

Does existance of GIANT 3D array (smth around 20.000 x 4.000 x 20.000) can cause lags?

It will cause memory problems but I don’t think it’s going to create a lot of lag. Just make sure to not use table methods related to insertion/deletion.

I would also recommend you to split the array in regions/chunks, and dynamically load the map when needed.

So, if I correctly understand, I should split that giant array from something like this:
image
into this:
image
?
And if yes, how creating 6D array from 3D may help me?..

1 Like

It could be a 4D array as well, like Minecraft chunks. I thought it could help because it allows you to get a portion of a big area easily but now that I think about it, there are equally good ways to achieve that with a 3D array. It’s up to preference.

I was saying that you don’t have to use that giant 3D array, and instead, you can load the parts of the map you’ll need in game, when you need to compute a path. You wouldn’t assign anything to unloaded places.