• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Matrixes in WC3?

Status
Not open for further replies.
Level 7
Joined
Jan 28, 2012
Messages
266
if you want an easy different way then there are gamecaches, but, those are slower then a snail.

you can also have a limited sized 2d array by doing this

set Unit[ 8*Y + X] = GetTriggerUnit()

in this example, it is a 2d array that can have a maximum of 1023 parent Y each with a storage space of 8.

if you want a 3d array then you can do set Int[ 100*Z + 10*Y +X] = 0 in this one you can have 80 data storage that have 10 y storage units each with 10 X storage units.

but despite the fact that you can use other things hashtable's are still the best way to do nd arrays in Warcraft3(as long as n > 1)
Because 1 they really aren't that slow, for most of the uses they will be used for.
and 2 they can store more data then a 2d array based off of Wacraft3's 1d arrays.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
With custom functions and a global array i guess.
Ofc you will be limited by the 8192 size.
Also don't use the index 8191 of an array, it works fine, but when you will try to load a saved game where a such index is used, wc3 will crash.

If i believe my benchmarks hashtables are like 4 times slower for read and 20 times to be set, in the best scenario, comparing using it as a big 1d array.
Ofc i don't guarantee any results, regardless the thread title, this test could be innacurate.
 
Status
Not open for further replies.
Top