• 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.

arrays dont work anymore

Status
Not open for further replies.
Level 4
Joined
Jan 20, 2011
Messages
65
hi

im useing pretty many arrays in my map, and they kinda high indexed too
im createing them in the trigger editors interface and as highest index i give them 1 (so i can use as many as i want?)

now to my problem, when i create a new array now of type group or force, then filling index higher then 20 it will bug and never be filled with data , it just stays null

so im asking if there is some kind of memory limit?
also whats this thing with highest array index [1] ? im sometimes not even useing the first 300 slots in an array, so i use only slot 300 to 400 or something, is that mb a problem? will the slots from 0 to 300 be waste of memory?

thanks for any help
alfalfalfa
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Yes, there is a memory/operation limit. Arrays that you declare via the editor's variable editor get initialized in the main (starting) thread, setting their members to the preset value from index 0 to size. The higher the size and the more arrays, the main thread will have to execute more operations and may finally halt, which would deactivate all your other triggers because these get initialized afterwards in the same thread. You can use the array's elements all up the way to 8190/8191, the size only determines up to which index the starting value gets assigned. You can do this yourself as shown or better yet scrap the variable editor and go vJass.
 
also whats this thing with highest array index [1] ? im sometimes not even useing the first 300 slots in an array, so i use only slot 300 to 400 or something, is that mb a problem? will the slots from 0 to 300 be waste of memory?

Why would you use slots 300-400 and skip the first 300 slots? Yes it will be a terrible waste of memory especially if you are talking about groups/forces. And if you initialize too many arrays from variable editor and not from triggers, you will crash the main thread and none of your triggers will initialize.
 
Level 4
Joined
Jan 20, 2011
Messages
65
ok thank you for ur helpfull answers :)
never would have guessed that the main thread crashes lol

and when you use as highest array index 1 in the interface, the highest array index really is..? the highest one u ever use? but it is not known how many array indicies i use , in game u could make so many units which would cause the game to use indicies to 8000 or somethin, so whats the highest? or does it malloc extra space during run time?

edit: we only see that it initialized slot 0 and 1 then... dohh^^
so how is it possible that unit groups higher then 1 are also initialized?

edit2: it isnt possible is it xD
 
Status
Not open for further replies.
Top