13 hours ago, pathfinding said:I still don't understand how that stores a coord pair of {x:1, y:2, z:3}. Could you show an example using those?
For each of the three forms? (You didn't say which one.)
Assumptions: width=6000, height=6000, maxz=4 (I always start counting at 0 rather than 1, so max is always one bigger than the biggest allowed value). Otherwise, I am just filling in the constant 'width' and 'height' values at the spots where it says 'width' or 'height', in the text I explained before.
For D[x + y * width + z * (width*height)], D is an array like D = new Tile[6000 * 6000 * 4]; // width * height * maxz
(x=1, y=2, z=3) can be found at D[1+ 2 * 6000 + 3 * 6000 * 6000];
For the increase or decrease in y for z, D is an array like D = new Tile[6000][4*6000]; // [width][maxz * height]
(x=1, y=2, z=3) can be found at D[x][y + 6000 * z] = D[1][2 + 6000 * 3];
For the stair jump table, there is no z, only x and y. Think of it as 3 separate buildings, 1 floor high, standing right next to each other. Your x/y coordinates spans all three buildings. Each building is a "z" level. You cannot leave or enter a building without teleporting, so your reachable x/y coordinates are limited if you only walk 'horizontally'. You can however teleport between buildings, so you land in a different set of x/y coordinates that you can reach.
For example, you could have one building between (0, 0)--(3000, 300), the second building between (3001, 0)--(6000, 3000), and the 3rd building between (0, 3001)--(6000, 6000). So if you're at (4563, 123), you're in building 2, or "floor" 2. If you teleport to (77, 5931), you teleported to building 3 (aka floor 3).
Of course, in the latter case you don't need to have the same shape at every floor or have equally big amounts of space for each floor. It's much more flexible.