256MB Array... well that seems a tad overkill.
One of the big issues with AppGameKit is that you're basically restricted to a 4 Byte Value (Float / Integer)… which is quite restrictive in terms of Data.
In any case., all you want to do is have a Data Buffer System; where you're Reading / Write Data Chunks.
How big said Buffer is... eh that's really down to you.
But I'd say you probably don't need one larger than say 32x32.
So like:
Type MapChunk_Struct
ChunkID As Integer
ChunkData As Integer[31,31]
EndType
You also want to have a Secondary Type., that Associates the Chunks by ID... meaning that even if you rebuild the Array you're keeping all the Data in, the Unique ID will remain the same and thus so will the position.
Type MapChunkAssoc_Struct
ChunkID As Integer
ChunkAssociations As Integer[7]
EndType
// Enum (why AppGameKit doesn't have this basic programming tool remains a mystery)
#Constant CHUNK_N 0
#Constant CHUNK_NE 1
#Constant CHUNK_E 2
#Constant CHUNK_SE 3
#Constant CHUNK_S 4
#Constant CHUNK_SW 5
#Constant CHUNK_W 6
#Constant CHUNK_NW 7
// EndEnum
I mean you can name them differently., it's just to have a more natural way to access them without trying to remember what each of the indexes mean.
As a result you can keep a much smaller Buffer Array that's always going to be the same size (i.e. MapBuffer As MapChunk_Struct[8] and MapBufferAssoc As MapChunkAssoc_Struct)
Then your Dynamic Array (that is storing the "Final Result" so-to-speak) can Expand and Contract as a New Chunk is Created in the Buffer; and Updated when new Associations are made.
I mean you might want to also want to expand it for Empty Associations., to know if you need to update or not; but that's really just a performance optimisation, which frankly probably won't matter much.