+ 2
1D or 2D array?
In game programming what is better? Create coordinates in 2d or 1d array using this formula a[x+y*width] ?
9 Antworten
+ 4
check which one has the least time complexity and use it
+ 1
Well, it all depends upon your compiler that how it works. But using 2D array would be a better option ^_^
0
It depends on how often you access what variable.
There are a lot of optimisation posibilities depending on the final usecase.
You can look for caching optimisation of arrays.
0
2D arrays are generally implemented as 1D arrays using your formula, so it makes no difference.
0
but is it the same thing use the impementation of 2d array and creating it by yourself?
0
I'm using java and I read the array every tick
0
2d seems right🤔