T
TriiiKill
Guest
Just like the title suggests.
If you're referring to memory addresses, that depends entirely on how the array is originally declared. Declaring an array's dimensions in reverse *SHOULD* keep all the memory addresses linear (ie, starting from the absolute extent of its dimensions). I think a ds_grid does that by default. Besides, all GM data structures are actually just black-boxed arrays with specialized GML functions to access/manipulate the data contained in them. At the actual code level, there's no difference between them.Also a 2d array is not the same shape as a ds_grid. A ds_grid is rectangular in structure, whereas a 2d array has no defined shape and is merely an indexed set of 1d arrays.
Ah! Gotcha. Wasn't quite sure what you meant, but that clears it up.I mean a grid takes up w*h memory, but a 2d array takes up a+b+c+d+e+...etc memory. If you have a 3x4 grid, it takes up the equivalent of 12 variables. A [w,h] 2d array takes up a minimum 2w variables. A grid will always take up the same amount of memory, whereas a 2d array can take up a variable amout of memory.
Most people will never intentionally mane use of that difference, but it's there.