So this is for something that is similar at least to what you might run into in a minecraft game.
Basically I have a game where you objects and I want to create and destroy objects based on there position in the world.
I feel like I should use an array because I can sort the array and search it very quickly by doing
array[spawnposition] = gameobject
when I create an object to store that object and its instantly in the correctly sorted spot for that position
and then of course use the exact spawn position to modify and delete.
The issue is that an even 100 X 100 X 100 area is a very large array.
So i'm not sure how best to alleviate this. I think its largely the cubing thats the issue so I think If I just restricted one dimension I could get a lot further but i'm curious how things like minecraft deal with massive worlds.
I'm sure partly they chunk the arrays and perhaps create arrays of arrays to navigate to the correct array.
But i'm wondering if there is a better way, something that makes it so for example null values don't take up space maybe. So only once I assign a value to the array it finds room for it making it so a very large array size is actually only as big as the amount of actual items in it, not potentional but still allows for rapid access like an actual array does.
basically i'd use List for example for the dynamic but I would lose the indexer access of fixed arrays that lets me access and retrieve stuff really fast without doing a search.
ArrayList- it's obsolete.