Hello! Every array in the physics memory (1d, 2d, 3d etc) are placed linear. And why you create 3 dimensional array in c++ for example, elements for this array will placed as 0,0,0 ; 1,0,0 ; .... mx-1,0,0; 0,1,0; 1,1,0; ... mx-1,1,0; etc...
the basic formula for poly dimensially arrays to transfer this to 1-dimensially array (or physics memory) for 2 and 3 dimensions:
El[0] ... El[ma] - linear array (for example, this is your map array of any type)
mx - x dimension of array you need to make my - y dimension of array you need to make mz - z dimension of array you need to make
for 2 dimensions ma = (mx * my - 1) for 3 dimensions ma = (mx * my * mz - 1)
register your El array with "ma" elements and use for access this formulas:
for element x,y of 2d array you need to get El[a] element where a = x + y*mx
for element x,y,z of 3d array you need to get El[a] element where a = x + y*mx + z*my*mx
for example, u need array with mx=2, my=3, mz=4. ma = mx*my*mz-1 = 23. 23 is the max index, but not dimension of linear array; really dimension is 24. and for access to element 0,0,0 you need to access El[0]; for access to 1,2,3 you need to access El[23]; for access to 1,0,2 you need to access El[13]
Note that all coordinates in this formulas are started with 0, not with 1! if you want to first index 1, you must replace all x,y and z with (x-1), (y-1),(z-1) and add +1 to all formulas
multidimensional arrays in c++ are represented by buffers of data scattered randomly and pointers to them. char m[10] will take 10 bytes. char n[10][20] will take 20x10 bytes for data, not necessarily continuous, AND 10x4 bytes for pointers. n[4] will be a pointer to array of 20 chars.
lol. i only were want to help human with his problem in warcraft map. by for c++ you right, i was error, because i wasnt program c++ too long... but my formulas are right and question is fully closed
Use a game cache and store your data under a heading comprized of 9 digets. Every 3 diget could refert to a deminsion and once data is set in the cache all you must do is retrieve it by giving the say reference. This is the easiest way of making a 3D array.