Q: What will be the maximum variable array size?
Note : in war3, it is 8192 or so.
Ok- But, is this a valuable question or just an informative question? I'm not sure what arrays are used for (never understood variables too well).
Compared to other questions, it's far from being a critical one since odds are it will at least 8192.
However, I think about a more important question related to them should be the following :
Q : Will SC2 support 2 or 3 dimension arrays? (Note : War3 only supports 1 dimension array.)
The rest of this post is explanation about arrays, feel free to skip the rest of this post if you don't want to read it.
By the way, arrays are mostly useful to the more "programmer" of triggerer persons.
Non-Array explanation
An integer variable (integer = number without decimals) can only hold one number. Let's say 15.
So inside the variable in more graphical form, it would be like that :
[ 15 ]
In terms of variable reference, it is like that : Variable is equal to 15.
Array explanation (1 dimension)
However if you want an ARRAY integer variable of a size of 3. It means it could contain 3 numbers.
Then, let's say it contains the number 14, 56 and 33.
So inside the array variable in more graphical form, it would be like that :
In terms of variable reference ...
... if I want to know the number at the position X of 0, it would be the number 14. Variable[0] is equal to 14.
... if I want to know the number at the position X of 2, it would be the number 33. Variable[2] is equal to 33.
Note that all arrays start with 0 instead of 1 as their first value's reference.
In Warcraft 3, they allow only one dimensional arrays up to a size of 8192 (8192 numbers or whatever else of the same base thing).
Array explanation (2 dimensions)
An array can have more than one dimension. For example, it can be 2 dimensions, one of a size of 5 and one of a size of 3. In total, they can hold 15 numbers if we combine all the available space.
Let's say we try to pack the simple numbers 14 to 28 inside into all available spaces and it will look like that :
Code: Select all
X0 X1 X2 X3 X4
Y0 [ 14 ] [ 15 ] [ 16 ] [ 17 ] [ 18 ]
Y1 [ 19 ] [ 20 ] [ 21 ] [ 22 ] [ 23 ]
Y2 [ 24 ] [ 25 ] [ 26 ] [ 27 ] [ 28 ]
In terms of variable reference ...
... number at position X,Y of 3, 1, it would be the number 22. Variable[3][1] is equal to 22.
... number at position X,Y of 4, 0, it would be the number 18. Variable[4][0] is equal to 18.
... number at position X,Y of 2, 2, it would be the number 26. Variable[2][2] is equal to 26.
Array explanation (more than 2 dimensions)
Logically, you can have an array with an infinite number of dimensions. However, only up to 3 dimensions tend to be practical for most people to make an X,Y,Z-like system. Basically the extra dimensions only follow the same base logic from the 1 to 2 dimension switch in terms of variable reference.